diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2020-11-24 18:53:06 +0100 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2020-12-03 10:36:42 +0100 |
commit | e179e53e3c703153bb0bb3155c1c6e2d25577fe0 (patch) | |
tree | 2e74acd5468273ef66a14f607f5299bea6950be7 /emfio/qa/cppunit | |
parent | 5ae5767c8acfc301bf24437312ca5832121b7f16 (diff) |
EMF: tdf#138467 Fix MapMode translation
Add proper translation for map mapping modes:
MM_LOMETRIC = 0x02, MM_HIMETRIC = 0x03, MM_LOENGLISH = 0x04, MM_HIENGLISH = 0x05, MM_TWIPS = 0x06
according to MS-EMF documentation.
Change-Id: If4c71b52e5236441837e62590797ced8acd6c80f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106251
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio/qa/cppunit')
-rw-r--r-- | emfio/qa/cppunit/emf/EmfImportTest.cxx | 36 | ||||
-rw-r--r-- | emfio/qa/cppunit/emf/data/test_mm_hienglish_ref.emf | bin | 0 -> 3212 bytes | |||
-rw-r--r-- | emfio/qa/cppunit/emf/data/test_mm_himetric_ref.emf | bin | 0 -> 3212 bytes |
3 files changed, 36 insertions, 0 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index 29c084874b6d..e8d4833e6424 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -50,6 +50,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest: void TestDrawLine(); void TestLinearGradient(); void TestTextMapMode(); + void TestEnglishMapMode(); void TestCreatePen(); void TestPdfInEmf(); @@ -67,6 +68,7 @@ public: CPPUNIT_TEST(TestDrawLine); CPPUNIT_TEST(TestLinearGradient); CPPUNIT_TEST(TestTextMapMode); + CPPUNIT_TEST(TestEnglishMapMode); CPPUNIT_TEST(TestCreatePen); CPPUNIT_TEST(TestPdfInEmf); CPPUNIT_TEST_SUITE_END(); @@ -272,6 +274,40 @@ void Test::TestTextMapMode() assertXPath(pDocument, "/primitive2D/metafile/transform/polygonstroke[20]/line", "width", "11"); } +void Test::TestEnglishMapMode() +{ + // Check import of EMF image with records: SETMAPMODE with MM_ENGLISH MapMode, STROKEANDFILLPATH, EXTTEXTOUTW, SETTEXTALIGN, STRETCHDIBITS + // MM_LOENGLISH is mapped to 0.01 inch. Positive x is to the right; positive y is up.M + Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/test_mm_hienglish_ref.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/mask/polypolygon", 1); + assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygon[1]", "path", "m0 0h29699v20999h-29699z"); + + 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[2]/polypolygon", "path", "m1058 7937v5293h3175v-1059h-2118v-4234z"); + assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[3]/polypolygon", "path", "m12699 1058h4234v1060h-1587v4231h-1059v-4231h-1588z"); + + assertXPath(pDocument, "/primitive2D/metafile/transform/mask/textsimpleportion", 4); + assertXPath(pDocument, "/primitive2D/metafile/transform/mask/textsimpleportion[1]", "text", "UL"); + assertXPath(pDocument, "/primitive2D/metafile/transform/mask/textsimpleportion[1]", "fontcolor", "#000000"); + assertXPath(pDocument, "/primitive2D/metafile/transform/mask/textsimpleportion[1]", "x", "106"); + assertXPath(pDocument, "/primitive2D/metafile/transform/mask/textsimpleportion[1]", "y", "459"); + assertXPath(pDocument, "/primitive2D/metafile/transform/mask/textsimpleportion[1]", "width", "424"); + 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[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::TestCreatePen() { diff --git a/emfio/qa/cppunit/emf/data/test_mm_hienglish_ref.emf b/emfio/qa/cppunit/emf/data/test_mm_hienglish_ref.emf Binary files differnew file mode 100644 index 000000000000..28f4f1fc7fa0 --- /dev/null +++ b/emfio/qa/cppunit/emf/data/test_mm_hienglish_ref.emf diff --git a/emfio/qa/cppunit/emf/data/test_mm_himetric_ref.emf b/emfio/qa/cppunit/emf/data/test_mm_himetric_ref.emf Binary files differnew file mode 100644 index 000000000000..86c568fc17e7 --- /dev/null +++ b/emfio/qa/cppunit/emf/data/test_mm_himetric_ref.emf |