summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2022-05-11 12:54:48 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2022-05-13 13:49:18 +0200
commite709ebe42ad06974b822366e4eea1a6c2ee61e10 (patch)
tree6a1d2f1638fb92de8fbd07a7965fbde9003d80f7 /emfio
parent99e10099b5d63c30b9a960fc94fc438ae7ab63dd (diff)
tdf#142261 EMF+ Add support for Miter Limit
With this commit the Miter is properly implemented, according to [EMF-PLUS] documentation: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-emfplus/5ef071f3-f503-4f16-b027-7c4bcf2d1d81 The formula for stroke miter limit is described here: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit Change-Id: Ida87063cc045460e61ffae118f64cf133c810dbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134164 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/qa/cppunit/emf/EmfImportTest.cxx50
-rw-r--r--emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithMiterLimit.emfbin0 -> 1104 bytes
2 files changed, 50 insertions, 0 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index f83688745e02..6c5e77bb67dd 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -67,6 +67,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest:
void TestFillRegion();
void TestEmfPlusGetDC();
void TestEmfPlusSave();
+ void TestEmfPlusDrawPathWithMiterLimit();
void TestExtTextOutOpaqueAndClipTransform();
void TestBitBltStretchBltWMF();
@@ -115,6 +116,7 @@ public:
CPPUNIT_TEST(TestFillRegion);
CPPUNIT_TEST(TestEmfPlusGetDC);
CPPUNIT_TEST(TestEmfPlusSave);
+ CPPUNIT_TEST(TestEmfPlusDrawPathWithMiterLimit);
CPPUNIT_TEST(TestExtTextOutOpaqueAndClipTransform);
CPPUNIT_TEST(TestBitBltStretchBltWMF);
@@ -1019,6 +1021,54 @@ void Test::TestEmfPlusSave()
"12832.6557236512,4907.54325697157");
}
+void Test::TestEmfPlusDrawPathWithMiterLimit()
+{
+ // tdf#142261 EMF+ records: DrawPath, TranslateWorldTransform, Object (Brush, Pen, Path)
+ // Check if Miter is correctly set for Lines
+ Primitive2DSequence aSequence
+ = parseEmf(u"emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithMiterLimit.emf");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
+ CPPUNIT_ASSERT(pDocument);
+
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke", 3);
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "color", "#c800c8");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "width", "1057");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "linejoin", "Miter");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "miterangle", "5");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/stroke", 0);
+
+ assertXPath(pDocument, aXPathPrefix + "unifiedtransparence", 3);
+ assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[1]", "transparence", "85");
+ assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[1]/polypolygonstroke/line", "color",
+ "#6400c8");
+ assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[1]/polypolygonstroke/line", "width",
+ "1057");
+ assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[1]/polypolygonstroke/line",
+ "linejoin", "Miter");
+ assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[1]/polypolygonstroke/line",
+ "miterangle", "19");
+ assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[2]", "transparence", "69");
+ assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[2]/polypolygonstroke/line",
+ "miterangle", "19");
+ assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[3]", "transparence", "53");
+ assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[3]/polypolygonstroke/line",
+ "miterangle", "19");
+
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "color", "#0000ff");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "width", "1057");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "linejoin", "Miter");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "miterangle", "60");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/stroke", 0);
+
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/line", "color", "#0000ff");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/line", "width", "1057");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/line", "linejoin", "Miter");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/line", "miterangle", "60");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/stroke", 0);
+}
+
void Test::TestExtTextOutOpaqueAndClipTransform()
{
// tdf#142495 EMF records: SETBKCOLOR, SELECTOBJECT, EXTTEXTOUTW, MODIFYWORLDTRANSFORM, CREATEFONTINDIRECT.
diff --git a/emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithMiterLimit.emf b/emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithMiterLimit.emf
new file mode 100644
index 000000000000..e8e46486384b
--- /dev/null
+++ b/emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithMiterLimit.emf
Binary files differ