summaryrefslogtreecommitdiff
path: root/emfio/qa
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2022-04-20 19:44:05 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2022-04-21 10:30:26 +0200
commit80c856336668e35837667323957fa3ad4172f3c0 (patch)
tree09a27e37c0940717a1ad3ab343d73ff762d9316d /emfio/qa
parent59393b73ec4c0f1f1965a9c24a2635780c707189 (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>
Diffstat (limited to 'emfio/qa')
-rw-r--r--emfio/qa/cppunit/emf/EmfImportTest.cxx33
-rw-r--r--emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithDash.emfbin0 -> 9636 bytes
2 files changed, 33 insertions, 0 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 0f2816962a91..6c4785bf2c8d 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -51,6 +51,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest:
void TestDrawStringTransparent();
void TestDrawStringWithBrush();
void TestDrawLine();
+ void TestDrawLineWithDash();
void TestLinearGradient();
void TestTextMapMode();
void TestEnglishMapMode();
@@ -96,6 +97,7 @@ public:
CPPUNIT_TEST(TestDrawStringTransparent);
CPPUNIT_TEST(TestDrawStringWithBrush);
CPPUNIT_TEST(TestDrawLine);
+ CPPUNIT_TEST(TestDrawLineWithDash);
CPPUNIT_TEST(TestLinearGradient);
CPPUNIT_TEST(TestTextMapMode);
CPPUNIT_TEST(TestEnglishMapMode);
@@ -386,6 +388,37 @@ 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(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
new file mode 100644
index 000000000000..dc5af59e3f66
--- /dev/null
+++ b/emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithDash.emf
Binary files differ