diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-01-19 16:59:38 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-01-19 21:35:24 +0100 |
commit | 1359e8c566970fcef860f7ba7f54a07d8e6e0513 (patch) | |
tree | 3a348d7971e805be5e113d85dbcf83562834911c /sd | |
parent | d104d8048045af049502f694c2af8fa8f131f1b9 (diff) |
oox smartart: composite algo: handle right constraint when left+width is given
The bugdoc had this constraint:
<dgm:constr type="l" for="ch" forName="text" refType="r" refFor="ch" refForName="img"/>
While img has no "r", it has:
<dgm:constr type="w" for="ch" forName="img" refType="w" refFor="ch" refForName="box" fact="0.2"/>
<dgm:constr type="l" for="ch" forName="img" refType="h" refFor="ch" refForName="box" fact="0.1"/>
Which is enough to fix the x position of the text to not overlap with
img.
Change-Id: I80db290bd1695884ffb7b1eabaffa09462e8883d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109642
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/smartart-composite-infer-right.pptx | bin | 0 -> 23234 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 26 |
2 files changed, 26 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart-composite-infer-right.pptx b/sd/qa/unit/data/pptx/smartart-composite-infer-right.pptx Binary files differnew file mode 100644 index 000000000000..ca417499fa16 --- /dev/null +++ b/sd/qa/unit/data/pptx/smartart-composite-infer-right.pptx diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 37e6941c997c..ecd881330f63 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -116,6 +116,7 @@ public: void testLinearRuleVert(); void testAutofitSync(); void testSnakeRows(); + void testCompositeInferRight(); CPPUNIT_TEST_SUITE(SdImportTestSmartArt); @@ -168,6 +169,7 @@ public: CPPUNIT_TEST(testLinearRuleVert); CPPUNIT_TEST(testAutofitSync); CPPUNIT_TEST(testSnakeRows); + CPPUNIT_TEST(testCompositeInferRight); CPPUNIT_TEST_SUITE_END(); }; @@ -1726,6 +1728,30 @@ void SdImportTestSmartArt::testSnakeRows() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testCompositeInferRight() +{ + // Load a smartart which contains a composite algorithm. + // One contraint says that the left of the text should be the right of the image. + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/smartart-composite-infer-right.pptx"), + PPTX); + + uno::Reference<drawing::XShape> xDiagram(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xMiddle = getChildShape(xDiagram, 1); + uno::Reference<drawing::XShape> xImage = getChildShape(xMiddle, 1); + uno::Reference<drawing::XShape> xText = getChildShape(xMiddle, 2); + sal_Int32 nRightOfImage = xImage->getPosition().X + xImage->getSize().Width; + sal_Int32 nLeftOfText = xText->getPosition().X; + + // Without the accompanying fix in place, this test would have failed with: + // - Expected greater than: 7925 + // - Actual : 2430 + // i.e. the text was overlapping with the image. + CPPUNIT_ASSERT_GREATER(nRightOfImage, nLeftOfText); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt); CPPUNIT_PLUGIN_IMPLEMENT(); |