From 39369c6e67dffe04acc4abb678c1a94526237fd8 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Tue, 18 May 2021 17:36:21 +0200 Subject: tdf#55007 tdf#142263 tdf#142268 EMF Properly display ARC and CHORD With previous implementation the ARC, ARCTO and CHORD were not displayed if the corners of rectangle was switched. With this patch the shapes are always displayed correctly. Change-Id: Ie8ac7af812298c0b96c3b5af417117784f128ce1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115757 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek --- emfio/qa/cppunit/emf/EmfImportTest.cxx | 15 +++++++++++++++ .../emf/data/TestArcInsideWronglyDefinedRectangle.emf | Bin 0 -> 264 bytes 2 files changed, 15 insertions(+) create mode 100644 emfio/qa/cppunit/emf/data/TestArcInsideWronglyDefinedRectangle.emf (limited to 'emfio') diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index fceb43b30215..64c7effa1baa 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -53,6 +53,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest: void TestTextMapMode(); void TestEnglishMapMode(); void TestRectangleWithModifyWorldTransform(); + void TestArcInsideWronglyDefinedRectangle(); void TestChordWithModifyWorldTransform(); void TestEllipseWithSelectClipPath(); void TestEllipseXformIntersectClipRect(); @@ -81,6 +82,7 @@ public: CPPUNIT_TEST(TestTextMapMode); CPPUNIT_TEST(TestEnglishMapMode); CPPUNIT_TEST(TestRectangleWithModifyWorldTransform); + CPPUNIT_TEST(TestArcInsideWronglyDefinedRectangle); CPPUNIT_TEST(TestChordWithModifyWorldTransform); CPPUNIT_TEST(TestEllipseWithSelectClipPath); CPPUNIT_TEST(TestEllipseXformIntersectClipRect); @@ -360,6 +362,19 @@ void Test::TestChordWithModifyWorldTransform() assertXPathContent(pDocument, "/primitive2D/metafile/transform/polygonstroke/polygon", "590,448 436,541 382,598 361,643 385,710 430,731 654,725 919,628"); } +void Test::TestArcInsideWronglyDefinedRectangle() +{ + // tdf#142268 EMF import test with records: ARC + Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestArcInsideWronglyDefinedRectangle.emf"); + CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/metafile/transform/polygonhairline", "color", "#000000"); + assertXPathContent(pDocument, "/primitive2D/metafile/transform/polygonhairline/polygon", "1630,1460 1800,1530 1850,1540 1980,1540 2030,1530 2170,1470 2220,1440 2330,1330 2380,1240 2420,1140 2430,1060 2430,950 2420,930 2410,870 2410,850 2380,770 2290,640 2120,520 2090,510 2070,510 2040,500 2020,490 1970,480 1860,480 1760,500 1670,540 1600,580 1520,660 1510,680 1480,720 1460,740 1450,760"); +} + void Test::TestEllipseWithSelectClipPath() { // EMF import test with records: RECTANGLE, BEGINPATH, ENDPATH, ELLIPSE diff --git a/emfio/qa/cppunit/emf/data/TestArcInsideWronglyDefinedRectangle.emf b/emfio/qa/cppunit/emf/data/TestArcInsideWronglyDefinedRectangle.emf new file mode 100644 index 000000000000..3a785fba6cac Binary files /dev/null and b/emfio/qa/cppunit/emf/data/TestArcInsideWronglyDefinedRectangle.emf differ -- cgit