summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
Diffstat (limited to 'emfio')
-rw-r--r--emfio/qa/cppunit/emf/EmfImportTest.cxx25
-rw-r--r--emfio/qa/cppunit/emf/data/TestRectangleWithModifyWorldTransform.emfbin0 -> 292 bytes
-rw-r--r--emfio/source/reader/emfreader.cxx9
3 files changed, 30 insertions, 4 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 590b0e6beac1..aa62dcd4b00b 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 TestLinearGradient();
void TestTextMapMode();
void TestEnglishMapMode();
+ void TestRectangleWithModifyWorldTransform();
void TestDrawPolyLine16WithClip();
void TestFillRegion();
void TestCreatePen();
@@ -72,6 +73,7 @@ public:
CPPUNIT_TEST(TestLinearGradient);
CPPUNIT_TEST(TestTextMapMode);
CPPUNIT_TEST(TestEnglishMapMode);
+ CPPUNIT_TEST(TestRectangleWithModifyWorldTransform);
CPPUNIT_TEST(TestDrawPolyLine16WithClip);
CPPUNIT_TEST(TestFillRegion);
CPPUNIT_TEST(TestCreatePen);
@@ -127,7 +129,7 @@ void Test::testPolyPolygon()
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygon", "path", "m0 0h19746v14817h-19746z");
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor", 2);
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[1]", "color", "#ffffff");
- assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[1]/polypolygon", "path", "m0 0h19780v14851h-19780z");
+ assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[1]/polypolygon", "path", "m0 0h19781v14852h-19781z");
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[2]/polypolygon", "path", "m2574 13194v-12065h15303v12065z");
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polygonstroke", 116);
@@ -294,7 +296,7 @@ void Test::TestEnglishMapMode()
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor", 3);
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[1]", "color", "#ffffad");
- assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[1]/polypolygon", "path", "m-1-1h29699v21005h-29699z");
+ assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[1]/polypolygon", "path", "m-1-1h29700v21001h-29700z");
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[2]/polypolygon", "path", "m1058 7937v5293h3175v-1059h-2118v-4234z");
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[3]/polypolygon", "path", "m12699 1058h4234v1060h-1587v4231h-1059v-4231h-1588z");
@@ -307,11 +309,28 @@ void Test::TestEnglishMapMode()
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/textsimpleportion[1]", "height", "424");
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polygonhairline", 3);
- assertXPathContent(pDocument, "/primitive2D/metafile/transform/mask/polygonhairline[1]/polygon", "-1,-1 29698,-1 29698,21004 -1,21004");
+ assertXPathContent(pDocument, "/primitive2D/metafile/transform/mask/polygonhairline[1]/polygon", "-1,-1 29699,-1 29699,21000 -1,21000");
assertXPathContent(pDocument, "/primitive2D/metafile/transform/mask/polygonhairline[2]/polygon", "1058,7937 1058,13230 4233,13230 4233,12171 2115,12171 2115,7937");
assertXPathContent(pDocument, "/primitive2D/metafile/transform/mask/polygonhairline[3]/polygon", "12699,1058 16933,1058 16933,2118 15346,2118 15346,6349 14287,6349 14287,2118 12699,2118");
+}
+
+
+void Test::TestRectangleWithModifyWorldTransform()
+{
+ // Check import of EMF image with records: EXTCREATEPEN, SELECTOBJECT, MODIFYWORLDTRANSFORM, RECTANGLE
+
+ Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestRectangleWithModifyWorldTransform.emf");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
+ CPPUNIT_ASSERT (pDocument);
+ assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygoncolor", 1);
+ assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygoncolor[1]", "color", "#ffffff");
+ assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygoncolor[1]/polypolygon", "path", "m1042 417 918 529 353 610-918-528z");
+ assertXPath(pDocument, "/primitive2D/metafile/transform/polygonstroke", 1);
+ assertXPathContent(pDocument, "/primitive2D/metafile/transform/polygonstroke[1]/polygon", "1042,417 1960,946 2313,1556 1395,1028");
}
void Test::TestDrawPolyLine16WithClip()
diff --git a/emfio/qa/cppunit/emf/data/TestRectangleWithModifyWorldTransform.emf b/emfio/qa/cppunit/emf/data/TestRectangleWithModifyWorldTransform.emf
new file mode 100644
index 000000000000..8f8889284229
--- /dev/null
+++ b/emfio/qa/cppunit/emf/data/TestRectangleWithModifyWorldTransform.emf
Binary files differ
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index ecef6ba6fe95..2296855c7603 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1341,7 +1341,14 @@ namespace emfio
case EMR_RECTANGLE :
{
mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 ).ReadInt32( nx32 ).ReadInt32( ny32 );
- DrawRect( ReadRectangle( nX32, nY32, nx32, ny32 ) );
+ SAL_INFO("emfio", "\t\t Rectangle, left: " << nX32 << ", top: " << nY32 << ", right: " << nx32 << ", bottom: " << ny32);
+ Point aPoints[] { Point(nX32, nY32),
+ Point(nx32, nY32),
+ Point(nx32, ny32),
+ Point(nX32, ny32) };
+ tools::Polygon aPoly(4, aPoints);
+ aPoly.Optimize( PolyOptimizeFlags::CLOSE );
+ DrawPolygon( aPoly, mbRecordPath );
}
break;