diff options
author | Sarper Akdemir <sarper.akdemir@collabora.com> | 2023-03-15 19:25:03 +0300 |
---|---|---|
committer | Sarper Akdemir <sarper.akdemir@collabora.com> | 2023-04-18 17:43:18 +0200 |
commit | c27946fb157fe46fbfaefbe93f2c6794b1af4411 (patch) | |
tree | 0ddcaa0e4439713835d8e6b80121336adaf056e5 /svx/qa/unit | |
parent | be7ce49f33035fcd289a5ffc7a2307bd9a566780 (diff) |
tdf#150020 pptx import: handle algn for outerShdw
Introduces RectangleAlignmentItem that holds a value of the enum
model::RectangleAlignment.
Introduces SDRATTR_SHADOWALIGNMENT that holds alignment for a shadow.
Implements import of algn for outerShdw.
Makes the alignment considered while the shadow is being scaled.
Also adds a unit test that covers this.
Change-Id: I8f4eaed5f0d9428a7f405c65f19237f9e70ca151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148934
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir <sarper.akdemir@collabora.com>
Diffstat (limited to 'svx/qa/unit')
-rw-r--r-- | svx/qa/unit/data/tdf150020-shadow-alignment.pptx | bin | 0 -> 51529 bytes | |||
-rw-r--r-- | svx/qa/unit/sdr.cxx | 47 |
2 files changed, 47 insertions, 0 deletions
diff --git a/svx/qa/unit/data/tdf150020-shadow-alignment.pptx b/svx/qa/unit/data/tdf150020-shadow-alignment.pptx Binary files differnew file mode 100644 index 000000000000..caba1a122da5 --- /dev/null +++ b/svx/qa/unit/data/tdf150020-shadow-alignment.pptx diff --git a/svx/qa/unit/sdr.cxx b/svx/qa/unit/sdr.cxx index 432eeeaa4999..b98df8b58041 100644 --- a/svx/qa/unit/sdr.cxx +++ b/svx/qa/unit/sdr.cxx @@ -80,6 +80,53 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowScaleOrigin) CPPUNIT_ASSERT_EQUAL(sal_Int32(-684), fShadowY); } +CPPUNIT_TEST_FIXTURE(SdrTest, testShadowAlignment) +{ + loadFromURL(u"tdf150020-shadow-alignment.pptx"); + + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence + = renderPageToPrimitives(xDrawPage); + + // Examine the created primitives. + drawinglayer::Primitive2dXmlDump aDumper; + xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: -567 + // - Actual : 162 + // - In <>, attribute 'xy13' of '(//shadow/transform)[1]' incorrect value. + // i.e. shadow alignment was ignored while scaling the shadow. + assertXPath(pDocument, "(//shadow/transform)[1]", "xy13", "-567"); + assertXPath(pDocument, "(//shadow/transform)[1]", "xy23", "162"); + + assertXPath(pDocument, "(//shadow/transform)[2]", "xy13", "-1794"); + assertXPath(pDocument, "(//shadow/transform)[2]", "xy23", "162"); + + assertXPath(pDocument, "(//shadow/transform)[3]", "xy13", "-3021"); + assertXPath(pDocument, "(//shadow/transform)[3]", "xy23", "161"); + + assertXPath(pDocument, "(//shadow/transform)[4]", "xy13", "-567"); + assertXPath(pDocument, "(//shadow/transform)[4]", "xy23", "-749"); + + assertXPath(pDocument, "(//shadow/transform)[5]", "xy13", "-3021"); + assertXPath(pDocument, "(//shadow/transform)[5]", "xy23", "-750"); + + assertXPath(pDocument, "(//shadow/transform)[6]", "xy13", "-566"); + assertXPath(pDocument, "(//shadow/transform)[6]", "xy23", "-1691"); + + assertXPath(pDocument, "(//shadow/transform)[7]", "xy13", "-1794"); + assertXPath(pDocument, "(//shadow/transform)[7]", "xy23", "-1693"); + + assertXPath(pDocument, "(//shadow/transform)[8]", "xy13", "-3022"); + assertXPath(pDocument, "(//shadow/transform)[8]", "xy23", "-1691"); + + assertXPath(pDocument, "(//shadow/transform)[9]", "xy13", "-1794"); + assertXPath(pDocument, "(//shadow/transform)[9]", "xy23", "-750"); +} + CPPUNIT_TEST_FIXTURE(SdrTest, testZeroWidthTextWrap) { // Load a document containing a 0-width shape with text. |