summaryrefslogtreecommitdiff
path: root/emfio/qa
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2022-05-15 00:09:44 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2022-05-16 17:26:20 +0200
commit2156c1090d318b4d28bc14537754bea73507d501 (patch)
treeaf83bcd345c9bf800a328ddb19230a5ee10d1ffa /emfio/qa
parentc9711f2ff2ee40f9e3928325ac1ba7c47da158ad (diff)
tdf#143876 EMF+ Add DrawClosedCurve and FillClosedCurve support
With this commit EmfPlusDrawClosedCurve and EmfPlusFillClosedCurve support was added. There is still missing Filling Mode (it is always set to Even Odd Alternate: https://en.wikipedia.org/wiki/Even%E2%80%93odd_rule ) and Tension support for spline bends. The graphics is displayed as Tension=0. A value of Tension=0 specifies that the spline is a sequence of straight lines. As the value increases, the curve becomes more rounded. For more information, see [SPLINE77] and [PETZOLD]. Change-Id: Ibccfd584e3d55cd0ca8a29da9f450916d56705d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134333 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio/qa')
-rw-r--r--emfio/qa/cppunit/emf/EmfImportTest.cxx48
-rw-r--r--emfio/qa/cppunit/emf/data/TestEmfPlusFillClosedCurve.emfbin0 -> 1496 bytes
2 files changed, 48 insertions, 0 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 6c5e77bb67dd..cf999c2dff6e 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -68,6 +68,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest:
void TestEmfPlusGetDC();
void TestEmfPlusSave();
void TestEmfPlusDrawPathWithMiterLimit();
+ void TestEmfPlusFillClosedCurve();
void TestExtTextOutOpaqueAndClipTransform();
void TestBitBltStretchBltWMF();
@@ -117,6 +118,7 @@ public:
CPPUNIT_TEST(TestEmfPlusGetDC);
CPPUNIT_TEST(TestEmfPlusSave);
CPPUNIT_TEST(TestEmfPlusDrawPathWithMiterLimit);
+ CPPUNIT_TEST(TestEmfPlusFillClosedCurve);
CPPUNIT_TEST(TestExtTextOutOpaqueAndClipTransform);
CPPUNIT_TEST(TestBitBltStretchBltWMF);
@@ -1069,6 +1071,52 @@ void Test::TestEmfPlusDrawPathWithMiterLimit()
assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/stroke", 0);
}
+void Test::TestEmfPlusFillClosedCurve()
+{
+ // tdf#143876 EMF+ records: SetWorldTransform, FillClosedCurve, DrawClosedCurve
+ Primitive2DSequence aSequence
+ = parseEmf(u"emfio/qa/cppunit/emf/data/TestEmfPlusFillClosedCurve.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 + "polypolygoncolor", 2);
+ assertXPath(pDocument, aXPathPrefix + "polypolygoncolor[1]", "color", "#808080");
+ assertXPath(pDocument, aXPathPrefix + "polypolygoncolor[1]/polypolygon", "path",
+ "m18202.841744243 13758.4401790456 1269.96570308672 "
+ "3175.02465670283-2539.93140617345-2116.68310446856h2539.93140617345l-2539."
+ "93140617345 2116.68310446856z");
+
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke", 2);
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "color", "#000000");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "width", "10");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "linejoin", "Miter");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "miterangle", "3");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "linecap", "BUTT");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/polypolygon", "path",
+ "m18202.841744243 13758.4401790456 1269.96570308672 "
+ "3175.02465670283-2539.93140617345-2116.68310446856h2539.93140617345l-2539."
+ "93140617345 2116.68310446856z");
+
+ assertXPath(pDocument, aXPathPrefix + "polypolygoncolor[2]", "color", "#808080");
+ //TODO Check path with implemented Winding
+ assertXPath(pDocument, aXPathPrefix + "polypolygoncolor[2]/polypolygon", "path",
+ "m22012.7388535032 13758.4401790456 1269.96570308672 "
+ "3175.02465670283-2539.93140617344-2116.68310446856h2539.93140617344l-2539."
+ "93140617344 2116.68310446856z");
+
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "color", "#000000");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "width", "10");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "linejoin", "Miter");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "miterangle", "3");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "linecap", "BUTT");
+ assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/polypolygon", "path",
+ "m22012.7388535032 13758.4401790456 1269.96570308672 "
+ "3175.02465670283-2539.93140617344-2116.68310446856h2539.93140617344l-2539."
+ "93140617344 2116.68310446856z");
+}
+
void Test::TestExtTextOutOpaqueAndClipTransform()
{
// tdf#142495 EMF records: SETBKCOLOR, SELECTOBJECT, EXTTEXTOUTW, MODIFYWORLDTRANSFORM, CREATEFONTINDIRECT.
diff --git a/emfio/qa/cppunit/emf/data/TestEmfPlusFillClosedCurve.emf b/emfio/qa/cppunit/emf/data/TestEmfPlusFillClosedCurve.emf
new file mode 100644
index 000000000000..ad9140a770d0
--- /dev/null
+++ b/emfio/qa/cppunit/emf/data/TestEmfPlusFillClosedCurve.emf
Binary files differ