diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-09-29 17:41:12 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-30 21:13:38 +0200 |
commit | 6eb7158e2b9049587f79e2225964ada1746bd83c (patch) | |
tree | 15248ac3976fb7651811ab116c370b104d9a48c5 /sd | |
parent | 800baa9c60d8fb7b4ed8cf8ae0ba7b6b68c69c9c (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.
(cherry picked from commit 5d899bf3ee59a226f855c8c56389344862efaa95)
Change-Id: I4eb2f06676df11c1432e0934ca3a0ec8891c5843
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103696
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
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 70f11844a0fd..13d3af8f0df2 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -1602,15 +1602,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(); } |