diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2022-04-20 19:44:05 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-04-25 11:13:17 +0200 |
commit | 960a4aefde91746b0fde69b04ba67793797aab9b (patch) | |
tree | 286112219fba4201be8f408dbd6b67b479812e3a /emfio | |
parent | 2a05d1aaf31686babd75d80316639e625ca5ea81 (diff) |
tdf#55058 tdf#143875 EMF+ Fix display of dashed lines and line joints
With previous implementation, empty spaces between dashes
were too long.
Additionally line joints were not working correctly, after
EMF+ reworking: tdf#111486
This commit fixes all these issues and additionally it is
covering it with tests.
Change-Id: I9404e566d2d7d3405ab817268ad9b1f538c200eb
Change-Id: I523f92a928ab592ff175d0d01c1ad1a3bc22e324
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133207
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
(cherry picked from commit 80c856336668e35837667323957fa3ad4172f3c0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133152
Diffstat (limited to 'emfio')
-rw-r--r-- | emfio/qa/cppunit/emf/EmfImportTest.cxx | 34 | ||||
-rw-r--r-- | emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithDash.emf | bin | 0 -> 9636 bytes |
2 files changed, 34 insertions, 0 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index 799f8eef9c46..63661c9c73c2 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -52,6 +52,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest: void TestDrawStringTransparent(); void TestDrawStringWithBrush(); void TestDrawLine(); + void TestDrawLineWithDash(); void TestLinearGradient(); void TestTextMapMode(); void TestEnglishMapMode(); @@ -95,6 +96,7 @@ public: CPPUNIT_TEST(TestDrawStringTransparent); CPPUNIT_TEST(TestDrawStringWithBrush); CPPUNIT_TEST(TestDrawLine); + CPPUNIT_TEST(TestDrawLineWithDash); CPPUNIT_TEST(TestLinearGradient); CPPUNIT_TEST(TestTextMapMode); CPPUNIT_TEST(TestEnglishMapMode); @@ -390,6 +392,38 @@ void Test::TestDrawLine() assertXPath(pDocument, aXPathPrefix + "polypolygonstroke/line", "width", "33"); } +void Test::TestDrawLineWithDash() +{ + // EMF+ with records: DrawLine + // The lines with different dash styles + Primitive2DSequence aSequence + = parseEmf(u"/emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithDash.emf"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument + = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); + CPPUNIT_ASSERT(pDocument); + + // check correct import of the DrawLine: color and width of the line + assertXPath(pDocument, aXPathPrefix + "polypolygonstroke", 10); + assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "color", "#000000"); + assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "width", "132"); + assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/stroke", 0); + + assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "width", "132"); + assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/stroke", "dotDashArray", + "13225 13225 "); + assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/stroke", "dotDashArray", + "39674 13225 "); + assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[4]/stroke", "dotDashArray", + "39674 13225 13225 13225 "); + assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[5]/stroke", "dotDashArray", + "39674 13225 13225 13225 13225 13225 "); + //TODO polypolygonstroke[6-9]/stroke add support for PenDataDashedLineOffset + assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[10]/stroke", "dotDashArray", + "66124 26450 198372 52899 "); +} + void Test::TestLinearGradient() { // EMF+ file with LinearGradient brush diff --git a/emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithDash.emf b/emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithDash.emf Binary files differnew file mode 100644 index 000000000000..dc5af59e3f66 --- /dev/null +++ b/emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithDash.emf |