diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-09-29 17:41:12 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-09-29 21:05:54 +0200 |
commit | 5d899bf3ee59a226f855c8c56389344862efaa95 (patch) | |
tree | c08388d5bbea4f978d0839ccd7aa6d597ae4dfa6 /sd | |
parent | 24e69c8450004e9ae40f40d4bee76b50d0f017d9 (diff) |
oox smartart: snake algo: apply constraints on child shape widths
This requires tracking what is the total of the width request of child
shapes, then scaling them according to what is the total available
width.
Additionally, the height of child shapes should be adjusted based on
their aspect ratio requests. A related trap is when an (invisible)
spacing shape is at the end of the row, that would result in smaller
spacing between the rows, so track the max height of shapes inside a
single row.
With this, finally the 6 child shapes are arranged on 2 rows, not 3
ones.
Change-Id: I4eb2f06676df11c1432e0934ca3a0ec8891c5843
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103629
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 72d8811571fb..55cc20343e8e 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -1618,15 +1618,20 @@ void SdImportTestSmartArt::testSnakeRows() std::set<sal_Int32> aYPositions; for (sal_Int32 nChild = 0; nChild < xDiagram->getCount(); ++nChild) { + if (nChild == 0) + { + // Ignore background shape, we check how many rows actual children use. + continue; + } uno::Reference<drawing::XShape> xChild(xDiagram->getByIndex(nChild), uno::UNO_QUERY); aYPositions.insert(xChild->getPosition().Y); } // Without the accompanying fix in place, this test would have failed with: - // - Expected: 3 - // - Actual : 4 - // i.e. one more unwanted row appeared. This is better, but the ideal would be just 2 rows. - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aYPositions.size()); + // - Expected: 2 + // - Actual : 3 + // i.e. an unwanted row appeared. + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aYPositions.size()); xDocShRef->DoClose(); } |