[Libreoffice-commits] core.git: emfio/qa

2023-12-06 Thread Stephan Bergmann (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   36 +
 1 file changed, 19 insertions(+), 17 deletions(-)

New commits:
commit 7575e8afcadc1b907f803ebfd1e38ef168597eec
Author: Stephan Bergmann 
AuthorDate: Wed Dec 6 13:42:39 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Dec 7 07:15:25 2023 +0100

loplugin:ostr (macOS)

Change-Id: I1b169e0c170c26a49941d22f0982a24ef547f941
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160391
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 8a74745b6e12..c164b7ac6122 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -1405,37 +1405,39 @@ CPPUNIT_TEST_FIXTURE(Test, 
testExtTextOutOpaqueAndClipWMF)
 
 // These values come from the fix for tdf#88163
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor", 5);
-assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[1]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[1]/polypolygon", "path"_ostr,
 "m7257 1836h320v3628h-320z");
-assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[1]", "color", 
"#ff");
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[1]", 
"color"_ostr, "#ff");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[2]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[2]/polypolygon", "path"_ostr,
 "m7257 5976h320v321h-320z");
-assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[2]", "color", 
"#00ff00");
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[2]", 
"color"_ostr, "#00ff00");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[3]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[3]/polypolygon", "path"_ostr,
 "m10203 5976h320v321h-320z");
-assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[3]", "color", 
"#8080ff");
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[3]", 
"color"_ostr, "#8080ff");
 
 assertXPath(pDocument, aXPathPrefix + "mask/group", 5);
-assertXPath(pDocument, aXPathPrefix + "mask/group[1]/polypolygoncolor", 
"color", "#00ff00");
-assertXPath(pDocument, aXPathPrefix + "mask/group[1]/textsimpleportion", 
"text", "ABCD");
-assertXPath(pDocument, aXPathPrefix + "mask/group[1]/textsimpleportion", 
"fontcolor",
+assertXPath(pDocument, aXPathPrefix + "mask/group[1]/polypolygoncolor", 
"color"_ostr,
+"#00ff00");
+assertXPath(pDocument, aXPathPrefix + "mask/group[1]/textsimpleportion", 
"text"_ostr, "ABCD");
+assertXPath(pDocument, aXPathPrefix + "mask/group[1]/textsimpleportion", 
"fontcolor"_ostr,
 "#00");
 
-assertXPath(pDocument, aXPathPrefix + "mask/group[2]/polypolygoncolor", 
"color", "#8080ff");
-assertXPath(pDocument, aXPathPrefix + "mask/group[2]/textsimpleportion", 
"text", "");
-assertXPath(pDocument, aXPathPrefix + "mask/group[2]/textsimpleportion", 
"fontcolor",
+assertXPath(pDocument, aXPathPrefix + "mask/group[2]/polypolygoncolor", 
"color"_ostr,
+"#8080ff");
+assertXPath(pDocument, aXPathPrefix + "mask/group[2]/textsimpleportion", 
"text"_ostr, "");
+assertXPath(pDocument, aXPathPrefix + "mask/group[2]/textsimpleportion", 
"fontcolor"_ostr,
 "#00");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/polypolygoncolor", "color",
+assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/polypolygoncolor", "color"_ostr,
 "#ff8000");
 assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/polypolygoncolor/polypolygon",
-"path", "m1067 1067h1296v473h-1296z");
-assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/textsimpleportion", "text",
+"path"_ostr, "m1067 1067h1296v473h-1296z");
+assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/textsimpleportion", "text"_ostr,
 "");
-assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/textsimpleportion", "fontcolor",
-"#00");
+assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/textsimpleportion",
+"fontcolor"_ostr, "#00");
 #endif
 }
 


[Libreoffice-commits] core.git: emfio/qa emfio/source

2023-11-19 Thread Stephan Bergmann (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |  824 +
 emfio/qa/cppunit/wmf/wmfimporttest.cxx |  364 +++---
 emfio/source/reader/mtftools.cxx   |8 
 3 files changed, 620 insertions(+), 576 deletions(-)

New commits:
commit e66ccbecfb414800271e066c630cf7e90d5f3b74
Author: Stephan Bergmann 
AuthorDate: Sun Nov 19 22:04:45 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Nov 20 08:25:16 2023 +0100

Extended loplugin:ostr: emfio

Change-Id: Ida43018a83c68f5d20dbee30325b8f32099e5b1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159713
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 9e892b67eaa5..8a74745b6e12 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -43,7 +43,7 @@ public:
 {
 }
 
-const OString aXPathPrefix = "/primitive2D/metafile/transform/";
+const OString aXPathPrefix = "/primitive2D/metafile/transform/"_ostr;
 
 Primitive2DSequence parseEmf(std::u16string_view aSource);
 };
@@ -79,37 +79,38 @@ CPPUNIT_TEST_FIXTURE(Test, testPolyPolygon)
 CPPUNIT_ASSERT(pDocument);
 
 // Chart axis
-assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 
0h19746v14817h-19746z");
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path"_ostr,
+"m0 0h19746v14817h-19746z");
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor", 2);
-assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[1]", "color", 
"#ff");
-assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[1]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[1]", 
"color"_ostr, "#ff");
+assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[1]/polypolygon", "path"_ostr,
 "m0 0h19781v14852h-19781z");
-assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[2]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[2]/polypolygon", "path"_ostr,
 "m2574 13194v-12065h15303v12065z");
 
 assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke", 44);
 assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[1]/polygon",
"2574,13194 2574,1129");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"color", "#00");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"width", "0");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"color"_ostr, "#00");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"width"_ostr, "0");
 assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[2]/polygon",
"2574,1129 2574,1129");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[2]/line", 
"color", "#00");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[2]/line", 
"width", "0");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[2]/line", 
"color"_ostr, "#00");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[2]/line", 
"width"_ostr, "0");
 assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[10]/polygon",
"8674,1129 8674,1129");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[10]/line", 
"color", "#00");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[10]/line", 
"width", "0");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[10]/line", 
"color"_ostr, "#00");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[10]/line", 
"width"_ostr, "0");
 
 assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion", 28);
-assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", 
"width", "459");
-assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", "x", 
"9908");
-assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", "text", 
"0.5");
-assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", 
"fontcolor", "#00");
+assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", 
"width"_ostr, "459");
+assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", 
"x"_ostr, "9908");
+assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", 
"text"_ostr, "0.5");
+assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", 
"fontcolor"_ostr, "#00");
 assertXPath(pDocument, aXPathPrefix + "mask/pointarray", 98);
-assertXPath(pDocument, aXPathPrefix + "mask/pointarray[1]", "color", 
"#00");
-assertXPath(pDocument, aXPathPrefix + "mask/pointarray[1]/point", "x", 
"2574");
-assertXPath(pDocument, aXPathPrefix + "mask/pointarray[1]/point", "y", 
"1129");
+

[Libreoffice-commits] core.git: emfio/qa include/test test/source

2023-10-06 Thread Ilmari Lauhakangas (via logerrit)
 emfio/qa/cppunit/wmf/wmfimporttest.cxx |   26 +-
 include/test/xmltesttools.hxx  |8 
 test/source/xmltesttools.cxx   |8 
 3 files changed, 29 insertions(+), 13 deletions(-)

New commits:
commit b693d19884a09b5f841b30f2e8b586778584ed16
Author: Ilmari Lauhakangas 
AuthorDate: Thu Sep 28 16:42:18 2023 +0300
Commit: Ilmari Lauhakangas 
CommitDate: Fri Oct 6 12:48:17 2023 +0200

xmltesttools: add assertXPathDoubleValue that takes a double with delta

and use it to make WmfTest::testSetTextAlignWmf independent of DPI

Change-Id: I2048239088a8dcc3e3ab1db96413894b5bcc56d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157377
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx 
b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index 172d20d99fed..de9be9ba0a52 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -207,70 +207,70 @@ void WmfTest::testSetTextAlignWmf()
 assertXPathContent(pDoc, "/metafile/push[2]/textarray[2]/text", 
"textalignment:default");
 
 assertXPath(pDoc, "/metafile/push[2]/textalign[3]", "align", "top");
-assertXPath(pDoc, "/metafile/push[2]/textarray[3]", "x", "12700");
+assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[3]", "x", 12700, 
30);
 assertXPath(pDoc, "/metafile/push[2]/textarray[3]", "y", "212");
 assertXPathContent(pDoc, "/metafile/push[2]/textarray[3]/text", 
"textalignment:0x00");
 
 assertXPath(pDoc, "/metafile/push[2]/textalign[4]", "align", "top");
-assertXPath(pDoc, "/metafile/push[2]/textarray[4]", "x", "12026");
+assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[4]", "x", 12026, 
30);
 assertXPath(pDoc, "/metafile/push[2]/textarray[4]", "y", "423");
 assertXPathContent(pDoc, "/metafile/push[2]/textarray[4]/text", 
"textalignment:0x02");
 
 assertXPath(pDoc, "/metafile/push[2]/textalign[5]", "align", "top");
 // Fails without the fix: Expected: 12026, Actual: 12350
-assertXPath(pDoc, "/metafile/push[2]/textarray[5]", "x", "12026");
+assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[5]", "x", 12026, 
30);
 assertXPath(pDoc, "/metafile/push[2]/textarray[5]", "y", "635");
 assertXPathContent(pDoc, "/metafile/push[2]/textarray[5]/text", 
"textalignment:0x04");
 
 assertXPath(pDoc, "/metafile/push[2]/textalign[6]", "align", "top");
-assertXPath(pDoc, "/metafile/push[2]/textarray[6]", "x", "12363");
+assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[6]", "x", 12363, 
30);
 assertXPath(pDoc, "/metafile/push[2]/textarray[6]", "y", "847");
 assertXPathContent(pDoc, "/metafile/push[2]/textarray[6]/text", 
"textalignment:0x06");
 
 assertXPath(pDoc, "/metafile/push[2]/textalign[7]", "align", "top");
-assertXPath(pDoc, "/metafile/push[2]/textarray[7]", "x", "12700");
+assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[7]", "x", 12700, 
30);
 assertXPath(pDoc, "/metafile/push[2]/textarray[7]", "y", "1058");
 assertXPathContent(pDoc, "/metafile/push[2]/textarray[7]/text", 
"textalignment:0x08");
 
 assertXPath(pDoc, "/metafile/push[2]/textalign[8]", "align", "top");
-assertXPath(pDoc, "/metafile/push[2]/textarray[8]", "x", "12026");
+assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[8]", "x", 12026, 
30);
 assertXPath(pDoc, "/metafile/push[2]/textarray[8]", "y", "1270");
 assertXPathContent(pDoc, "/metafile/push[2]/textarray[8]/text", 
"textalignment:0x0A");
 
 assertXPath(pDoc, "/metafile/push[2]/textalign[9]", "align", "bottom");
 // Fails without the fix: Expected: 12026, Actual: 12350
-assertXPath(pDoc, "/metafile/push[2]/textarray[9]", "x", "12026");
+assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[9]", "x", 12026, 
30);
 assertXPath(pDoc, "/metafile/push[2]/textarray[9]", "y", "1482");
 assertXPathContent(pDoc, "/metafile/push[2]/textarray[9]/text", 
"textalignment:0x0C");
 
 assertXPath(pDoc, "/metafile/push[2]/textalign[10]", "align", "bottom");
-assertXPath(pDoc, "/metafile/push[2]/textarray[10]", "x", "12363");
+assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[10]", "x", 
12363, 30);
 assertXPath(pDoc, "/metafile/push[2]/textarray[10]", "y", "1693");
 assertXPathContent(pDoc, "/metafile/push[2]/textarray[10]/text", 
"textalignment:0x0E");
 
 assertXPath(pDoc, "/metafile/push[2]/textalign[11]", "align", "bottom");
-assertXPath(pDoc, "/metafile/push[2]/textarray[11]", "x", "12700");
+assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[11]", "x", 
12700, 30);
 assertXPath(pDoc, "/metafile/push[2]/textarray[11]", "y", "1905");
 assertXPathContent(pDoc, "/metafile/push[2]/textarray[11]/text", 
"textalignment:0x10");
 
 assertXPath(pDoc, "/metafile/push[2]/textalign[12]", "align", 

[Libreoffice-commits] core.git: emfio/qa emfio/source

2023-05-10 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx|   24 +++
 emfio/qa/cppunit/emf/data/TestEmfPolydraw.emf |binary
 emfio/source/reader/emfreader.cxx |   88 +-
 emfio/source/reader/mtftools.cxx  |6 +
 4 files changed, 115 insertions(+), 3 deletions(-)

New commits:
commit ba0bf0ab2c24d309e8a938cec26daa41eba9c8cf
Author: Bartosz Kosiorek 
AuthorDate: Mon Mar 21 20:20:02 2022 +0100
Commit: Bartosz Kosiorek 
CommitDate: Wed May 10 16:45:47 2023 +0200

tdf#142249 EMF Implement EMR_POLYDRAW record

The EMR_POLYDRAW record specifies a set of line segments and Bezier curves.

Change-Id: I93d846d2fbb7a60b0565668a17ee092da30ef21c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151424
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 5f8ad7e18044..ba0a8050f24e 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -891,6 +891,30 @@ CPPUNIT_TEST_FIXTURE(Test, testPolylinetoCloseStroke)
 assertXPath(pDocument, aXPathPrefix + "polygonhairline[2]", "color", 
"#00");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testEmfPolydraw)
+{
+// tdf#142249 EMF import with records: POLYDRAW, CREATEPEN.
+Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestEmfPolydraw.emf");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequence));
+CPPUNIT_ASSERT(pDocument);
+
+assertXPath(pDocument, aXPathPrefix + "polygonhairline", 2);
+assertXPath(pDocument, aXPathPrefix + "polygonhairline[1]", "color", 
"#00");
+assertXPathContent(pDocument, aXPathPrefix + "polygonhairline[1]/polygon",
+   "2000,200 3000,200 3000,1000");
+assertXPath(pDocument, aXPathPrefix + "polygonhairline[2]", "color", 
"#00");
+assertXPathContent(pDocument, aXPathPrefix + "polygonhairline[2]/polygon",
+   "3000,2000 3000,2000 4000,2000 3000,3000");
+
+assertXPath(pDocument, aXPathPrefix + "polygonstroke", 1);
+assertXPathContent(pDocument, aXPathPrefix + "polygonstroke[1]/polygon",
+   "50,50 50,50 1000,1000 1000,1000 2000,2500 2000,1000");
+assertXPath(pDocument, aXPathPrefix + "polygonstroke[1]/line", "color", 
"#ff");
+assertXPath(pDocument, aXPathPrefix + "polygonstroke[1]/stroke", 
"dotDashArray", "30 10 ");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testEmfPlusBrushPathGradientWithBlendColors)
 {
 // tdf#131506 EMF+ records: FillRects, Brush with PathGradient and 
BlendColor, FillRects
diff --git a/emfio/qa/cppunit/emf/data/TestEmfPolydraw.emf 
b/emfio/qa/cppunit/emf/data/TestEmfPolydraw.emf
new file mode 100644
index ..962b163bf363
Binary files /dev/null and b/emfio/qa/cppunit/emf/data/TestEmfPolydraw.emf 
differ
diff --git a/emfio/source/reader/emfreader.cxx 
b/emfio/source/reader/emfreader.cxx
index af676e7de669..ee848097b84f 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -175,6 +175,16 @@ constexpr sal_Int32 ARCDIRECTION_CLOCKWISE = 0x0002;
 namespace
 {
 
+/* [MS-EMF] - v20210625 - page 41 */
+/* 2.1.26 Point Enumeration */
+enum EMFPointTypes
+{
+PT_CLOSEFIGURE = 0x01,
+PT_LINETO = 0x02,
+PT_BEZIERTO = 0x04,
+PT_MOVETO = 0x06
+};
+
 const char *
 record_type_name(sal_uInt32 nRecType)
 {
@@ -932,6 +942,83 @@ namespace emfio
 DrawPolyLine(ReadPolygonWithSkip(true, 
nNextPos), true, mbRecordPath);
 break;
 
+case EMR_POLYDRAW:
+{
+sal_uInt32 nPointsCount, nBezierCount = 0;
+std::vector aPoints;
+sal_Int32 nX, nY;
+bool wrongFile = false;
+unsigned char nPointType;
+std::vector aPointTypes;
+mpInputStream->ReadInt32(nX32)
+.ReadInt32(nY32)
+.ReadInt32(nx32)
+.ReadInt32(ny32)
+.ReadUInt32(nPointsCount);
+
+aPoints.reserve(nPointsCount);
+for (sal_uInt32 i = 0; i < nPointsCount && 
mpInputStream->good(); i++)
+{
+*mpInputStream >> nX >> nY;
+aPoints.push_back(Point(nX, nY));
+}
+aPointTypes.reserve(nPointsCount);
+for (sal_uInt32 i = 0; i < nPointsCount && 
mpInputStream->good(); i++)
+{
+mpInputStream->ReadUChar(nPointType);
+

[Libreoffice-commits] core.git: emfio/qa

2023-04-11 Thread Xisco Fauli (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |  186 +++--
 1 file changed, 45 insertions(+), 141 deletions(-)

New commits:
commit ee7746227645ea2307ed803cce7bb51f2d7678a7
Author: Xisco Fauli 
AuthorDate: Tue Apr 11 12:09:23 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Apr 11 14:30:30 2023 +0200

CppunitTest_emfio_emf: use CPPUNIT_TEST_FIXTURE()

This suite is large enough so that avoiding the
declaration/registration/definition of each test manually saves a lot of
space.

Change-Id: I476b58a1c45ed5c977ce71a92d172b7e2df93015
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150224
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index e858fd7afc4d..b315a2f69ae4 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -28,8 +28,6 @@
 #include 
 #include 
 
-namespace
-{
 using namespace css;
 using namespace css::uno;
 using namespace css::io;
@@ -39,106 +37,15 @@ using drawinglayer::primitive2d::Primitive2DContainer;
 
 class Test : public UnoApiXmlTest
 {
-const OString aXPathPrefix = "/primitive2D/metafile/transform/";
-
-void testPolyPolygon();
-void TestDrawImagePointsTypeBitmap();
-void TestDrawString();
-void TestDrawStringAlign();
-void TestDrawStringTransparent();
-void TestDrawStringWithBrush();
-void TestDrawLine();
-void TestDrawLineWithCaps();
-void TestDrawLineWithDash();
-void TestLinearGradient();
-void TestTextMapMode();
-void TestEnglishMapMode();
-void TestRectangleWithModifyWorldTransform();
-void TestArcStartPointEqualEndPoint();
-void TestArcInsideWronglyDefinedRectangle();
-void TestChordWithModifyWorldTransform();
-void TestEllipseWithSelectClipPath();
-void TestEllipseXformIntersectClipRect();
-void TestSetArcDirection();
-void TestDrawPolyLine16WithClip();
-void TestFillRegion();
-void TestEmfPlusBrushPathGradientWithBlendColors();
-void TestEmfPlusGetDC();
-void TestEmfPlusSave();
-void TestEmfPlusDrawPathWithCustomCap();
-void TestEmfPlusDrawPathWithMiterLimit();
-void TestEmfPlusFillClosedCurve();
-void TestExtTextOutOpaqueAndClipTransform();
-void TestNegativeWinOrg();
-
-void TestBitBltStretchBltWMF();
-void TestExtTextOutOpaqueAndClipWMF();
-void TestPaletteWMF();
-void TestRestoreDCWMF();
-void TestRoundrectWMF();
-void TestStretchDIBWMF();
-void TestMoveToLineToWMF();
-void TestPolylinetoCloseStroke();
-void TestPolyLineWidth();
-
-void TestRestoreDC();
-void TestRoundRect();
-void TestCreatePen();
-void TestPdfInEmf();
-
-Primitive2DSequence parseEmf(std::u16string_view aSource);
-
 public:
 Test()
 : UnoApiXmlTest("/emfio/qa/cppunit/emf/data/")
 {
 }
 
-CPPUNIT_TEST_SUITE(Test);
-CPPUNIT_TEST(testPolyPolygon);
-CPPUNIT_TEST(TestDrawImagePointsTypeBitmap);
-CPPUNIT_TEST(TestDrawString);
-CPPUNIT_TEST(TestDrawStringAlign);
-CPPUNIT_TEST(TestDrawStringTransparent);
-CPPUNIT_TEST(TestDrawStringWithBrush);
-CPPUNIT_TEST(TestDrawLine);
-CPPUNIT_TEST(TestDrawLineWithCaps);
-CPPUNIT_TEST(TestDrawLineWithDash);
-CPPUNIT_TEST(TestLinearGradient);
-CPPUNIT_TEST(TestTextMapMode);
-CPPUNIT_TEST(TestEnglishMapMode);
-CPPUNIT_TEST(TestRectangleWithModifyWorldTransform);
-CPPUNIT_TEST(TestArcStartPointEqualEndPoint);
-CPPUNIT_TEST(TestArcInsideWronglyDefinedRectangle);
-CPPUNIT_TEST(TestChordWithModifyWorldTransform);
-CPPUNIT_TEST(TestEllipseWithSelectClipPath);
-CPPUNIT_TEST(TestEllipseXformIntersectClipRect);
-CPPUNIT_TEST(TestSetArcDirection);
-CPPUNIT_TEST(TestDrawPolyLine16WithClip);
-CPPUNIT_TEST(TestFillRegion);
-CPPUNIT_TEST(TestEmfPlusBrushPathGradientWithBlendColors);
-CPPUNIT_TEST(TestEmfPlusGetDC);
-CPPUNIT_TEST(TestEmfPlusSave);
-CPPUNIT_TEST(TestEmfPlusDrawPathWithCustomCap);
-CPPUNIT_TEST(TestEmfPlusDrawPathWithMiterLimit);
-CPPUNIT_TEST(TestEmfPlusFillClosedCurve);
-CPPUNIT_TEST(TestExtTextOutOpaqueAndClipTransform);
-CPPUNIT_TEST(TestNegativeWinOrg);
-
-CPPUNIT_TEST(TestBitBltStretchBltWMF);
-CPPUNIT_TEST(TestExtTextOutOpaqueAndClipWMF);
-CPPUNIT_TEST(TestPaletteWMF);
-CPPUNIT_TEST(TestRestoreDCWMF);
-CPPUNIT_TEST(TestRoundrectWMF);
-CPPUNIT_TEST(TestStretchDIBWMF);
-CPPUNIT_TEST(TestMoveToLineToWMF);
-CPPUNIT_TEST(TestPolylinetoCloseStroke);
-CPPUNIT_TEST(TestPolyLineWidth);
-CPPUNIT_TEST(TestRestoreDC);
-CPPUNIT_TEST(TestRoundRect);
-CPPUNIT_TEST(TestCreatePen);
-CPPUNIT_TEST(TestPdfInEmf);
-CPPUNIT_TEST_SUITE_END();
+const OString aXPathPrefix = "/primitive2D/metafile/transform/";
+
+Primitive2DSequence parseEmf(std::u16string_view aSource);
 };
 
 Primitive2DSequence 

[Libreoffice-commits] core.git: emfio/qa

2023-03-08 Thread Stephan Bergmann (via logerrit)
 emfio/qa/cppunit/wmf/wmfimporttest.cxx |  113 +
 1 file changed, 73 insertions(+), 40 deletions(-)

New commits:
commit a5c83673ba987bd6ed1a36fe5b8c4b1f600f9626
Author: Stephan Bergmann 
AuthorDate: Wed Mar 8 23:03:08 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Mar 9 07:06:05 2023 +

Demultiplex test code

It is so much easier to work with if a test failure's line number 
unambiguously
points at the code's sole execution.  (That is, test code is necessarily 
non-
DRY.)

Change-Id: I75919c55671348f6190e9e108e72e24ec18ce986
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148514
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx 
b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index c5b2ddbc3205..48e47fb0fd36 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -55,8 +55,10 @@ public:
 void testBigPPI();
 void testTdf93750();
 void testTdf99402();
-void testTdf39894();
-void testETO_PDY();
+void testTdf39894Wmf();
+void testTdf39894Emf();
+void testETO_PDYWmf();
+void testETO_PDYEmf();
 void testStockObject();
 
 CPPUNIT_TEST_SUITE(WmfTest);
@@ -70,8 +72,10 @@ public:
 CPPUNIT_TEST(testBigPPI);
 CPPUNIT_TEST(testTdf93750);
 CPPUNIT_TEST(testTdf99402);
-CPPUNIT_TEST(testTdf39894);
-CPPUNIT_TEST(testETO_PDY);
+CPPUNIT_TEST(testTdf39894Wmf);
+CPPUNIT_TEST(testTdf39894Emf);
+CPPUNIT_TEST(testETO_PDYWmf);
+CPPUNIT_TEST(testETO_PDYEmf);
 CPPUNIT_TEST(testStockObject);
 CPPUNIT_TEST_SUITE_END();
 };
@@ -369,49 +373,78 @@ void WmfTest::testTdf99402()
 CPPUNIT_ASSERT_EQUAL(RTL_TEXTENCODING_SYMBOL, 
fontStyle.aFont.GetCharSet());
 }
 
-void WmfTest::testTdf39894()
+void WmfTest::testTdf39894Wmf()
 {
-OUString files[] = { "tdf39894.wmf", "tdf39894.emf" };
-for (const auto& file : files)
-{
-SvFileStream aFileStream(getFullUrl(file), StreamMode::READ);
-GDIMetaFile aGDIMetaFile;
-ReadWindowMetafile(aFileStream, aGDIMetaFile);
+SvFileStream aFileStream(getFullUrl(u"tdf39894.wmf"), StreamMode::READ);
+GDIMetaFile aGDIMetaFile;
+ReadWindowMetafile(aFileStream, aGDIMetaFile);
 
-MetafileXmlDump dumper;
-xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
+MetafileXmlDump dumper;
+xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
-CPPUNIT_ASSERT(pDoc);
+CPPUNIT_ASSERT(pDoc);
 
-// The x position of the second text must take into account
-// the previous text's last Dx (previously was ~300)
-auto x = getXPath(pDoc, "/metafile/push[2]/textarray[2]", "x");
-CPPUNIT_ASSERT_GREATER(sal_Int32(2700), x.toInt32());
-}
+// The x position of the second text must take into account
+// the previous text's last Dx (previously was ~300)
+auto x = getXPath(pDoc, "/metafile/push[2]/textarray[2]", "x");
+CPPUNIT_ASSERT_GREATER(sal_Int32(2700), x.toInt32());
 }
 
-void WmfTest::testETO_PDY()
+void WmfTest::testTdf39894Emf()
 {
-OUString files[] = { "ETO_PDY.wmf", "ETO_PDY.emf" };
-for (const auto& file : files)
-{
-SvFileStream aFileStream(getFullUrl(file), StreamMode::READ);
-GDIMetaFile aGDIMetaFile;
-ReadWindowMetafile(aFileStream, aGDIMetaFile);
-
-MetafileXmlDump dumper;
-xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
-
-CPPUNIT_ASSERT(pDoc);
-
-// The y position of following text
-// must be smaller than that of previous
-auto y1 = getXPath(pDoc, "/metafile/push[2]/textarray[1]", "y");
-auto y2 = getXPath(pDoc, "/metafile/push[2]/textarray[2]", "y");
-auto y3 = getXPath(pDoc, "/metafile/push[2]/textarray[3]", "y");
-CPPUNIT_ASSERT_MESSAGE(file.toUtf8().getStr(), y2.toInt32() < 
y1.toInt32());
-CPPUNIT_ASSERT_MESSAGE(file.toUtf8().getStr(), y3.toInt32() < 
y2.toInt32());
-}
+SvFileStream aFileStream(getFullUrl(u"tdf39894.emf"), StreamMode::READ);
+GDIMetaFile aGDIMetaFile;
+ReadWindowMetafile(aFileStream, aGDIMetaFile);
+
+MetafileXmlDump dumper;
+xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
+
+CPPUNIT_ASSERT(pDoc);
+
+// The x position of the second text must take into account
+// the previous text's last Dx (previously was ~300)
+auto x = getXPath(pDoc, "/metafile/push[2]/textarray[2]", "x");
+CPPUNIT_ASSERT_GREATER(sal_Int32(2700), x.toInt32());
+}
+
+void WmfTest::testETO_PDYWmf()
+{
+SvFileStream aFileStream(getFullUrl(u"ETO_PDY.wmf"), StreamMode::READ);
+GDIMetaFile aGDIMetaFile;
+ReadWindowMetafile(aFileStream, aGDIMetaFile);
+
+MetafileXmlDump dumper;
+xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
+
+CPPUNIT_ASSERT(pDoc);
+
+// The y position of following text
+// must be 

[Libreoffice-commits] core.git: emfio/qa emfio/source

2023-02-11 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   45 ++---
 emfio/source/reader/emfreader.cxx  |   25 +++---
 emfio/source/reader/mtftools.cxx   |4 +-
 3 files changed, 43 insertions(+), 31 deletions(-)

New commits:
commit bbdbe8ea2ef176ef6f08b30b3c18876c2c4f0c22
Author: Bartosz Kosiorek 
AuthorDate: Fri Feb 3 22:55:54 2023 +0100
Commit: Bartosz Kosiorek 
CommitDate: Sat Feb 11 21:24:18 2023 +

tdf#142018 Properly create Pen width if style is COSMETIC

Change-Id: I6453058c4af352a3b0e14cbccbc1a67c73cd1426
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146551
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 75f2b9001a08..e858fd7afc4d 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -180,14 +180,19 @@ void Test::testPolyPolygon()
 assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[2]/polypolygon", "path",
 "m2574 13194v-12065h15303v12065z");
 
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke", 116);
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke", 44);
 assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[1]/polygon",
-   "2574,13194 2574,1129 17877,1129 17877,13194");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"color", "#ff");
-
+   "2574,13194 2574,1129");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"color", "#00");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"width", "0");
+assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[2]/polygon",
+   "2574,1129 2574,1129");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[2]/line", 
"color", "#00");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[2]/line", 
"width", "0");
 assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[10]/polygon",
-   "8674,13194 8674,1129");
+   "8674,1129 8674,1129");
 assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[10]/line", 
"color", "#00");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[10]/line", 
"width", "0");
 
 assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion", 28);
 assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", 
"width", "459");
@@ -1547,7 +1552,7 @@ void Test::TestRoundRect()
 void Test::TestCreatePen()
 {
 // Check import of EMF image with records: RESTOREDC, SAVEDC, MOVETOEX, 
LINETO, POLYLINE16, EXTTEXTOUTW with DxBuffer
-// The CREATEPEN record is used with PS_COSMETIC line style, which 
sometimes will be displayed as solid hairline
+// The CREATEPEN record is used with PS_COSMETIC line style, and in this 
case width must be set to 0
 Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestCreatePen.emf");
 CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
 drawinglayer::Primitive2dXmlDump dumper;
@@ -1556,29 +1561,29 @@ void Test::TestCreatePen()
 
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 
0h31250v18192h-31250z");
 
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke", 748);
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke", 3);
 assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[1]/polygon",
-   "27875,16523 27875,1453");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"color", "#ff");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"width", "6");
+   "17898,5693 20172,5693");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"color", "#008000");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"width", "0");
 
 assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[2]/polygon",
-   "27975,16453 27875,16453");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[2]/line", 
"color", "#ff");
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[2]/line", 
"width", "6");
+   "17898,6959 20172,6959");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[2]/line", 
"color", "#80");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[2]/line", 
"width", "0");
 
 assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[3]/polygon",
-   "27925,16078 27875,16078");
+   "17898,7381 20172,7381");
 assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[3]/line", 
"color", "#ff");
-assertXPath(pDocument, aXPathPrefix + 

[Libreoffice-commits] core.git: emfio/qa emfio/source

2022-12-12 Thread Paris Oplopoios (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   15 ++-
 emfio/source/reader/mtftools.cxx   |1 +
 2 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 75093a9f7fbde760a3034f41694739c7454cb7eb
Author: Paris Oplopoios 
AuthorDate: Mon Dec 12 11:30:27 2022 +
Commit: Miklos Vajna 
CommitDate: Tue Dec 13 06:59:06 2022 +

tdf#152435 Revert "Make EMR_SAVEDC not UpdateClipRegion"

This reverts commit 1230b88055c7389d2c376c316f91549e4aaef8aa.

Reason for revert:
The reverted commit breaks the files documented in tdf#152435 (some
text is not shown in those .EMF files). The reverted commit would solve
an issue where some text was not clipped correctly, albeit in a naive
way. As it is more important that text is shown rather than some text
having correct clipping, that patch is reverted and I will look for one
that fixes both cases.

Change-Id: I42e85b802b8bf1e77e96f0016cd1d83201047032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143970
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 3d77dd95e5a0..75f2b9001a08 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -1019,19 +1019,16 @@ void Test::TestEmfPlusSave()
 
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 
0h33544v21311h-33544z");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[1]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor/polypolygon", "path",
 "m327.4583 
638.h437007.1875v29.6h-437007.1875z");
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[1]", "color",
-"#ff0cad");
+assertXPath(pDocument, aXPathPrefix + "mask/group/mask/polypolygoncolor", 
"color", "#ff0cad");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[2]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor/polypolygon", 
"path",
 "m10853.4145539602 
7321.41354709201h41952690v29630720h-41952690z");
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[2]", "color",
-"#00ffad");
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor", "color", 
"#00ffad");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polygonstrokearrow/line", "color",
-"#00");
-assertXPathContent(pDocument, aXPathPrefix + 
"mask/group/mask/polygonstrokearrow/polygon",
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstrokearrow/line", 
"color", "#00");
+assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstrokearrow/polygon",
"10853.4145539602,7321.41354709201 
10853.4145539602,4907.54325697157 "
"12832.6557236512,4907.54325697157");
 }
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 2683151166b2..7f067e4fcd15 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -2365,6 +2365,7 @@ namespace emfio
 
 void MtfTools::Push()   // !! to be able to access the 
original ClipRegion it
 {   // is not allowed to use 
the MetaPushAction()
+UpdateClipRegion(); // (the original clip 
region is on top of the stack) (SJ)
 auto pSave = std::make_shared();
 
 pSave->aLineStyle = maLineStyle;


[Libreoffice-commits] core.git: emfio/qa emfio/source

2022-11-08 Thread Paris Oplopoios (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   15 +--
 emfio/source/reader/mtftools.cxx   |1 -
 2 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 1230b88055c7389d2c376c316f91549e4aaef8aa
Author: Paris Oplopoios 
AuthorDate: Fri Nov 4 12:52:27 2022 +0200
Commit: Miklos Vajna 
CommitDate: Tue Nov 8 15:48:53 2022 +0100

Make EMR_SAVEDC not UpdateClipRegion

EMR_SAVEDC would call UpdateClipRegion which would break the clip region
sometimes before drawing the text causing it to not be clipped

This line was introduced in a i#964 related patch
(https://bz.apache.org/ooo/show_bug.cgi?id=964)
The document in that test seems to render the same and the test file
from the changed test renders the same also before and after this patch

Change-Id: Id515b90efc9e533e18a35030a9a677de4d4ea02d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142272
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 75f2b9001a08..3d77dd95e5a0 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -1019,16 +1019,19 @@ void Test::TestEmfPlusSave()
 
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 
0h33544v21311h-33544z");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[1]/polypolygon", "path",
 "m327.4583 
638.h437007.1875v29.6h-437007.1875z");
-assertXPath(pDocument, aXPathPrefix + "mask/group/mask/polypolygoncolor", 
"color", "#ff0cad");
+assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[1]", "color",
+"#ff0cad");
 
-assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor/polypolygon", 
"path",
+assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[2]/polypolygon", "path",
 "m10853.4145539602 
7321.41354709201h41952690v29630720h-41952690z");
-assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor", "color", 
"#00ffad");
+assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[2]", "color",
+"#00ffad");
 
-assertXPath(pDocument, aXPathPrefix + "mask/polygonstrokearrow/line", 
"color", "#00");
-assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstrokearrow/polygon",
+assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polygonstrokearrow/line", "color",
+"#00");
+assertXPathContent(pDocument, aXPathPrefix + 
"mask/group/mask/polygonstrokearrow/polygon",
"10853.4145539602,7321.41354709201 
10853.4145539602,4907.54325697157 "
"12832.6557236512,4907.54325697157");
 }
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index b6e225bfd97c..02643b202ef8 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -2366,7 +2366,6 @@ namespace emfio
 
 void MtfTools::Push()   // !! to be able to access the 
original ClipRegion it
 {   // is not allowed to use 
the MetaPushAction()
-UpdateClipRegion(); // (the original clip 
region is on top of the stack) (SJ)
 auto pSave = std::make_shared();
 
 pSave->aLineStyle = maLineStyle;


[Libreoffice-commits] core.git: emfio/qa

2022-07-08 Thread Stephan Bergmann (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |2 +-
 emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithCustomCap.emf |binary
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8abe6916308ed849ece9b3a58b860a73b04fec51
Author: Stephan Bergmann 
AuthorDate: Fri Jul 8 12:17:01 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jul 8 13:49:29 2022 +0200

Make TestEmfPlusDrawPathWithCustomCap succeed on Aarch64

CppunitTest_emfio_emf 
CPPUNIT_TEST_NAME=Test::TestEmfPlusDrawPathWithCustomCap
introduced in 5b21b65572610df88986e700b81f1156aff14f65 "tdf#142770 
tdf#143031
EMF+ Implement CustomLineCap" failed for me both in a local master build on
macOS on Apple M1 and in a Linux aarch64 test build of the 
libreoffice-7.4.0.1
Flathub flatpak (at 
)
with

> xmltesttools.cxx:195:Assertion
> Test name: (anonymous namespace)::Test::TestEmfPlusDrawPathWithCustomCap
> equality assertion failed
> - Expected: 1423.297394625,1268.98481214025 
830.006276132353,558.656004112967
> - Actual  : 1423.297394625,1268.98481214025 
830.006276132352,558.656004112967
> - In <>, XPath contents of child does not match

As this failed in exactly the same way for rather different builds (Clang 
vs.
GCC; Apple M1 vs. whatever ARM processor used by 
),
it smells like the test input might trigger a case where operations can
legitimately produce slightly different floating point results, which would 
then
cause the test to erroneously fail for some builds.

So I hacked the test input
emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithCustomCap.emf slightly, 
making
the EmfPlusPath's 2nd EmfPlusPointF Y coordinate identical to the 1st 
one's, so
that the arrow now points west rather than north-west,

>  0190: 02 10 c0 db 00 00 00 00 00 00 cc ff 08 40 0e 03
>  01a0: 2c 00 00 00 20 00 00 00 02 10 c0 db 02 00 00 00
>  01b0: 00 00 00 00 2b b5 05 45 05 54 56 45 d6 66 00 45
> -01c0: 05 54 56 45 00 01 81 01 15 40 0e 00 10 00 00 00
> +01c0: 51 23 4d 45 00 01 81 01 15 40 0e 00 10 00 00 00
>  01d0: 04 00 00 00 0f 00 00 00 0e 00 00 00 14 00 00 00
>  01e0: 00 00 00 00 10 00 00 00 14 00 00 00

which happens to let the test compute a different polygonstrokearrow/polygon
value now, but which appears to be stable across at least my x86-64 and 
aarch64
test builds.

And temporarily reverting the non-test (i.e., drawinglayer) parts of
5b21b65572610df88986e700b81f1156aff14f65 would make the test fail with

> xmltesttools.cxx:121:Assertion
> Test name: (anonymous namespace)::Test::TestEmfPlusDrawPathWithCustomCap
> assertion failed
> - Expression: xmlXPathNodeSetGetLength(pXmlNodes) > 0
> - In <>, XPath 
'/primitive2D/metafile/transform/polygonstrokearrow/polygon' not found

so the test appears to still faithfully check the intended difference in
behavior.

Change-Id: Iec31246dd7666ec764176622ccc4f246eea6e4ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136896
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index b423eae91721..fd89ade0c899 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -1060,7 +1060,7 @@ void Test::TestEmfPlusDrawPathWithCustomCap()
 CPPUNIT_ASSERT(pDocument);
 
 assertXPathContent(pDocument, aXPathPrefix + "polygonstrokearrow/polygon",
-   "1423.297394625,1268.98481214025 
830.006276132353,558.656004112967");
+   "1423.297394625,1268.98481214025 
705.717657763014,1304.88786195939");
 assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow/line", "color", 
"#cc");
 assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow/line", "width", 
"96");
 assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow/line", 
"linecap", "BUTT");
diff --git a/emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithCustomCap.emf 
b/emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithCustomCap.emf
index e94986431618..df83e65516dd 100644
Binary files a/emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithCustomCap.emf 
and b/emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithCustomCap.emf differ


[Libreoffice-commits] core.git: emfio/qa

2022-04-24 Thread Hossein (via logerrit)
 emfio/qa/cppunit/wmf/wmfimporttest.cxx |5 -
 1 file changed, 5 deletions(-)

New commits:
commit 45aac5b97192a97369c7785772ce7400d9ea8abc
Author: Hossein 
AuthorDate: Sun Apr 24 14:13:21 2022 +0200
Commit: Hossein - 
CommitDate: Sun Apr 24 14:56:24 2022 +0200

Remove brittle test from WmfTest

The WmfTest::testStockObject() contained test for the number of
children in the metafile dump. This can be changed when unimplemented
records are implemented.

The problem was revelead while implementing SetPolyFillMode record:


xmltesttools.cxx:234:WmfTest::testStockObject
equality assertion failed
- Expected: 42
- Actual  : 47
- In <>, XPath '/metafile/push[2]' number of child-nodes is incorrect

Change-Id: I627801b7ac535a2f0c736880d9675f3d0136136a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133353
Tested-by: Jenkins
Reviewed-by: Hossein - 

diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx 
b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index d8a4ed82d0f0..a85876e03a7d 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -402,11 +402,6 @@ void WmfTest::testStockObject()
 
 CPPUNIT_ASSERT(pDoc);
 
-//   Without the fix in place, this test would have failed with
-// - Expected: 42
-// - Actual  : 37
-assertXPathChildren(pDoc, "/metafile/push[2]", 42);
-
 //   Without the fix in place, this test would have failed with
 // - Expected: 1
 // - Actual  : 0


[Libreoffice-commits] core.git: emfio/qa emfio/source

2022-04-06 Thread Hossein (via logerrit)
 emfio/qa/cppunit/wmf/data/stockobject.emf |binary
 emfio/qa/cppunit/wmf/wmfimporttest.cxx|   25 +
 emfio/source/reader/mtftools.cxx  |2 +-
 3 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit f385661ec1463053c1ca51dc50db075c478de87c
Author: Hossein 
AuthorDate: Tue Apr 5 14:07:36 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Apr 6 16:41:57 2022 +0200

tdf#148359 Fix emfio regression: missing emf image

This patch fixes tdf#148359 which prevented the display of EMF images
embedded in the rtf files or even loading when loading them directly.

Looking into the problem caused by the cleanup commit
3e7dd04dd8ca1baea4b7918eb7a7080c595c4625, it became visible that
while enums were converted to enum class, there was a cast that
was wrongly ommited:

- sal_uInt16 nStockId = static_cast(nIndex);
+ StockObject nStockId = static_cast(nIndex);

Now, it is re-written as:

StockObject nStockId = static_cast(nIndex & 0xFF);

The symptom was that the StockObject field was mishandled, and thus
the shapes were displayed in white, instead of black.

"Stock Logical Object" is discussed in the MS document for EMF:

* [MS-EMF] v20210625 - pages 44, 45 and 182

A unit test is provided to make sure that the regression does not
happen again. The test can be run by:

make CPPUNIT_TEST_NAME=testStockObject -sr CppunitTest_emfio_wmf

Change-Id: I9a7f1008e92a96d9fb12aeb7bd057af828c1722a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132540
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/emfio/qa/cppunit/wmf/data/stockobject.emf 
b/emfio/qa/cppunit/wmf/data/stockobject.emf
new file mode 100644
index ..8de7c1ae591c
Binary files /dev/null and b/emfio/qa/cppunit/wmf/data/stockobject.emf differ
diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx 
b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index b8c2218fdec2..d8a4ed82d0f0 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -56,6 +56,7 @@ public:
 void testTdf99402();
 void testTdf39894();
 void testETO_PDY();
+void testStockObject();
 
 CPPUNIT_TEST_SUITE(WmfTest);
 CPPUNIT_TEST(testNonPlaceableWmf);
@@ -69,6 +70,7 @@ public:
 CPPUNIT_TEST(testTdf99402);
 CPPUNIT_TEST(testTdf39894);
 CPPUNIT_TEST(testETO_PDY);
+CPPUNIT_TEST(testStockObject);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -389,6 +391,29 @@ void WmfTest::testETO_PDY()
 }
 }
 
+void WmfTest::testStockObject()
+{
+SvFileStream aFileStream(getFullUrl(u"stockobject.emf"), StreamMode::READ);
+GDIMetaFile aGDIMetaFile;
+ReadWindowMetafile(aFileStream, aGDIMetaFile);
+
+MetafileXmlDump dumper;
+xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
+
+CPPUNIT_ASSERT(pDoc);
+
+//   Without the fix in place, this test would have failed with
+// - Expected: 42
+// - Actual  : 37
+assertXPathChildren(pDoc, "/metafile/push[2]", 42);
+
+//   Without the fix in place, this test would have failed with
+// - Expected: 1
+// - Actual  : 0
+// - In <>, XPath '/metafile/push[2]/fillcolor[2]' number of nodes is 
incorrect
+assertXPath(pDoc, "/metafile/push[2]/fillcolor[2]", "color", "#00");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(WmfTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index f829788dbd1b..5cb43ec68510 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -750,7 +750,7 @@ namespace emfio
 if ( nIndex & ENHMETA_STOCK_OBJECT )
 {
 SAL_INFO ( "emfio", "\t\t ENHMETA_STOCK_OBJECT, StockObject 
Enumeration: 0x" << std::hex  << nIndex );
-StockObject nStockId = static_cast(nIndex);
+StockObject nStockId = static_cast(nIndex & 0xFF);
 switch( nStockId )
 {
 case StockObject::WHITE_BRUSH :


[Libreoffice-commits] core.git: emfio/qa

2022-03-15 Thread Stephan Bergmann (via logerrit)
 emfio/qa/cppunit/wmf/wmfimporttest.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8da06340788296e5004f1625fc39fbf2a4c93fc9
Author: Stephan Bergmann 
AuthorDate: Tue Mar 15 19:18:58 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Mar 15 22:23:24 2022 +0100

-Werror,-Wdeprecated-enum-enum-conversion

...after 3e7dd04dd8ca1baea4b7918eb7a7080c595c4625 "tdf#145614 Convert 
#define to
enum and constexpr"

Change-Id: I3ef1d17295e99c040125acd4b03fd5096848a0e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131630
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx 
b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index 31511202abcd..1ae7416521aa 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -336,7 +336,7 @@ void WmfTest::testTdf99402()
 logfontw.lfUnderline = 0;
 logfontw.lfStrikeOut = 0;
 logfontw.lfCharSet = emfio::CharacterSet::OEM_CHARSET;
-logfontw.lfPitchAndFamily = emfio::FamilyFont::FF_ROMAN | 
emfio::PitchFont::DEFAULT_PITCH;
+logfontw.lfPitchAndFamily = +emfio::FamilyFont::FF_ROMAN | 
+emfio::PitchFont::DEFAULT_PITCH;
 logfontw.alfFaceName = "Symbol";
 
 emfio::WinMtfFontStyle fontStyle(logfontw);


[Libreoffice-commits] core.git: emfio/qa

2022-02-08 Thread Caolán McNamara (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   11 ---
 1 file changed, 11 deletions(-)

New commits:
commit dbf92d1825bed9f79925f232a5be7cd9f3a330f3
Author: Caolán McNamara 
AuthorDate: Tue Feb 8 08:37:34 2022 +
Commit: Caolán McNamara 
CommitDate: Tue Feb 8 12:44:56 2022 +0100

drop checksum assert that is platform dependent

Change-Id: I3459d753a8f655ca34ecf6c25fdfd9655687c6d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129660
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 0f0bd76d199d..c9c2bcb94219 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -853,10 +853,6 @@ void Test::TestBitBltStretchBltWMF()
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "xy23", "406");
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "height", "10");
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "width", "10");
-#if !defined(MACOSX)   
\
-&& !defined(_WIN32) // TODO Bitmap display needs to be aligned for macOS 
and Windows
-assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "checksum", 
"747141214295528493");
-#endif
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]/data", 10);
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]/data[1]", "row",
 
"00,00,00,00,00,00,00,00,00,00");
@@ -874,10 +870,6 @@ void Test::TestBitBltStretchBltWMF()
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap[2]", "height", "10");
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap[2]", "width", "10");
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap[2]/data", 10);
-#if !defined(MACOSX)   
\
-&& !defined(_WIN32) // TODO Bitmap display needs to be aligned for macOS 
and Windows
-assertXPath(pDocument, aXPathPrefix + "mask/bitmap[2]", "checksum", 
"3134789313661517563");
-#endif
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap[2]/data[1]", "row",
 
"00,1c,38,55,71,8d,aa,c6,e2,ff");
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap[2]/data[5]", "row",
@@ -1052,9 +1044,6 @@ void Test::TestStretchDIBWMF()
 
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap", "height", "10");
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap", "width", "10");
-#if !defined(MACOSX) // TODO DIB display needs to be aligned for macOS
-assertXPath(pDocument, aXPathPrefix + "mask/bitmap", "checksum", 
"14148300367030905133");
-#endif
 assertXPath(pDocument, aXPathPrefix + "mask/bitmap/data", 10);
 assertXPath(pDocument, aXPathPrefix + "/mask/bitmap/data[1]", "row",
 
"00,1c,38,55,71,8d,aa,c6,e2,ff");


[Libreoffice-commits] core.git: emfio/qa

2022-01-11 Thread Stephan Bergmann (via logerrit)
 emfio/qa/cppunit/wmf/wmfimporttest.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 20a9b1ba01636b2b35b6cc2bc5c1c807055c5e8d
Author: Stephan Bergmann 
AuthorDate: Tue Jan 11 09:20:54 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Jan 11 11:55:26 2022 +0100

Adapt test value intervals to my Linux --without-system-fontconfig build

Change-Id: Ie0867782b0925800cc094f43f8387fb9d1ff0c21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128272
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx 
b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index a967930ae5ab..db84998523fa 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -123,7 +123,7 @@ void WmfTest::testTdf88163NonPlaceableWmf()
 // Mac: With fix: 3230, without fix: ~ 8000
 // Windows: With fix: 3303, without fix: ~ 8000
 auto x = getXPath(pDoc, "/metafile/push[2]/font[1]", "height");
-CPPUNIT_ASSERT_GREATER(sal_Int32(3000), x.toInt32());
+CPPUNIT_ASSERT_GREATEREQUAL(sal_Int32(3000), x.toInt32());
 CPPUNIT_ASSERT_LESS(sal_Int32(3500), x.toInt32());
 
 // Fails without the fix: Expected: 7359, Actual: 7336
@@ -161,7 +161,7 @@ void WmfTest::testTdf88163PlaceableWmf()
 // The fix does not affect the font size
 // Linux: 300 - Mac: 309 - Windows: 316
 auto x = getXPath(pDoc, "/metafile/push[2]/font[1]", "height");
-CPPUNIT_ASSERT_GREATER(sal_Int32(290), x.toInt32());
+CPPUNIT_ASSERT_GREATEREQUAL(sal_Int32(287), x.toInt32());
 CPPUNIT_ASSERT_LESS(sal_Int32(320), x.toInt32());
 
 // Fails without the fix: Expected: 1900, Actual: 19818


[Libreoffice-commits] core.git: emfio/qa

2022-01-09 Thread Stephan Bergmann (via logerrit)
 emfio/qa/cppunit/wmf/wmfimporttest.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 6e527140e8a75a999db2a35208fb85ab3bb552a8
Author: Stephan Bergmann 
AuthorDate: Fri Jan 7 15:03:56 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Jan 9 18:24:49 2022 +0100

Improve some CPPUNIT_ASSERT checks

(In each case, the name of the file is obvious from the surrounding
code, so there's no loss in not having CPPUNIT_ASSERT_LESS/GREATER_MESSAGE
available here.)

Change-Id: I5e4e1a30f6389f8b2801648a6179b574727f0859
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128116
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx 
b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index b7a4dc1badb7..a967930ae5ab 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -123,8 +123,8 @@ void WmfTest::testTdf88163NonPlaceableWmf()
 // Mac: With fix: 3230, without fix: ~ 8000
 // Windows: With fix: 3303, without fix: ~ 8000
 auto x = getXPath(pDoc, "/metafile/push[2]/font[1]", "height");
-CPPUNIT_ASSERT_MESSAGE(fileName.toUtf8().getStr(), x.toInt32() > 3000);
-CPPUNIT_ASSERT_MESSAGE(fileName.toUtf8().getStr(), x.toInt32() < 3500);
+CPPUNIT_ASSERT_GREATER(sal_Int32(3000), x.toInt32());
+CPPUNIT_ASSERT_LESS(sal_Int32(3500), x.toInt32());
 
 // Fails without the fix: Expected: 7359, Actual: 7336
 assertXPath(pDoc, "/metafile/push[2]/textarray[1]", "x", "7359");
@@ -161,8 +161,8 @@ void WmfTest::testTdf88163PlaceableWmf()
 // The fix does not affect the font size
 // Linux: 300 - Mac: 309 - Windows: 316
 auto x = getXPath(pDoc, "/metafile/push[2]/font[1]", "height");
-CPPUNIT_ASSERT_MESSAGE(fileName.toUtf8().getStr(), x.toInt32() > 290);
-CPPUNIT_ASSERT_MESSAGE(fileName.toUtf8().getStr(), x.toInt32() < 320);
+CPPUNIT_ASSERT_GREATER(sal_Int32(290), x.toInt32());
+CPPUNIT_ASSERT_LESS(sal_Int32(320), x.toInt32());
 
 // Fails without the fix: Expected: 1900, Actual: 19818
 assertXPath(pDoc, "/metafile", "height", "1900");
@@ -368,7 +368,7 @@ void WmfTest::testTdf39894()
 // The x position of the second text must take into account
 // the previous text's last Dx (previously was ~300)
 auto x = getXPath(pDoc, "/metafile/push[2]/textarray[2]", "x");
-CPPUNIT_ASSERT_MESSAGE(file.toUtf8().getStr(), x.toInt32() > 2700);
+CPPUNIT_ASSERT_GREATER(sal_Int32(2700), x.toInt32());
 }
 }
 


[Libreoffice-commits] core.git: emfio/qa

2021-10-19 Thread Xisco Fauli (via logerrit)
 dev/null |binary
 1 file changed

New commits:
commit ba43b65c4b414152c4663426f0e19beff3f84d12
Author: Xisco Fauli 
AuthorDate: Tue Oct 19 17:05:39 2021 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 19 21:20:29 2021 +0200

emfio: remove unused file

Added in e179e53e3c703153bb0bb3155c1c6e2d25577fe0


Change-Id: I4f326c95f279e4e1925f3e4324f904f81a361fcf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123823
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 

diff --git a/emfio/qa/cppunit/emf/data/test_mm_himetric_ref.emf 
b/emfio/qa/cppunit/emf/data/test_mm_himetric_ref.emf
deleted file mode 100644
index 86c568fc17e7..
Binary files a/emfio/qa/cppunit/emf/data/test_mm_himetric_ref.emf and /dev/null 
differ


[Libreoffice-commits] core.git: emfio/qa

2021-10-15 Thread Ilmari Lauhakangas (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 463d261e3509cc857e248d8bd5787a45d385a646
Author: Ilmari Lauhakangas 
AuthorDate: Fri Oct 15 11:53:03 2021 +0300
Commit: Miklos Vajna 
CommitDate: Fri Oct 15 16:22:14 2021 +0200

CppunitTest_emfio_emf: add some tolerance in TestPdfInEmf

Change-Id: I1fc1b3863fd5b5472e700a5432fb4f9d353a054f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123650
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index c24b3d8e5856..6b16770d8d71 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -1263,7 +1263,8 @@ void Test::TestPdfInEmf()
 // - Actual  : 0
 // i.e. there was no size hint, the shape with 14cm height had a 
bitmap-from-PDF fill, the PDF
 // height was only 5cm, so it looked blurry.
-CPPUNIT_ASSERT_EQUAL(14321.0, pVectorGraphicData->getSizeHint().getY());
+// Tolerance was added later based on results on different systems.
+CPPUNIT_ASSERT_LESSEQUAL(1.0, abs(14321.0 - 
pVectorGraphicData->getSizeHint().getY()));
 
 // Without the accompanying fix in place, this test would have failed with:
 // - Expected: 0


[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-09-27 Thread Hossein (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |  100 -
 emfio/qa/cppunit/wmf/data/tdf88163-wrong-font-size.wmf |binary
 emfio/qa/cppunit/wmf/wmfimporttest.cxx |   43 +++
 emfio/source/reader/wmfreader.cxx  |8 +
 4 files changed, 101 insertions(+), 50 deletions(-)

New commits:
commit 5e4e1cdb1e14354b42838e1dfcf82873b3071896
Author: Hossein 
AuthorDate: Mon Sep 27 06:53:47 2021 +0200
Commit: Hossein 
CommitDate: Mon Sep 27 22:08:15 2021 +0200

tdf#88163 Fix font size for placeable wmf files

The problems in tdf#88163 can be categorized into two parts, as
described in d25906087918c085239aac30fd72cb65aa7b9eb4:

First, the problem with the wmf files without the placeable header.
Second, the problem with the wmf files with the placeable header.

The above mentioned patch fixed the first part, and this patch fixes
the second part.

The problem was that upon seeing 22-byte placeable header, the
records related to the size of the wmf like META_SETWINDOWORG (0x20b)
and META_SETWINDOWEXT (0x20c) and others were ignored. These records
were read in WmfReader::GetPlaceableBound() for the wmf files without
placeable header. Adding this method for the wmf files with placeable
header fixed the wrong calculation of bounds, which previously lead
to wrong size of text.

It should be noted that the scale in the placeable header is used,
but the bounds are ignored for now.

A new test named testTdf88163PlaceableWmf() is added that can be
checked with:

make CPPUNIT_TEST_NAME="testTdf88163PlaceableWmf" -sr \
CppunitTest_emfio_wmf

Change-Id: I820c2e5922972cb5d555d98ef70c7581cd9f02d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122095
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 7fc03e2262a2..c24b3d8e5856 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -866,43 +866,43 @@ void Test::TestBitBltStretchBltWMF()
 = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
 CPPUNIT_ASSERT(pDocument);
 
-assertXPath(pDocument, aXPathPrefix + "bitmap", 2);
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]", "xy11", "508");
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]", "xy12", "0");
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]", "xy13", "711");
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]", "xy21", "0");
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]", "xy22", "508");
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]", "xy23", "508");
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]", "height", "10");
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]", "width", "10");
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap", 2);
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "xy11", "508");
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "xy12", "0");
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "xy13", "0");
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "xy21", "0");
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "xy22", "508");
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "xy23", "406");
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "height", "10");
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "width", "10");
 #if !defined(MACOSX)   
\
 && !defined(_WIN32) // TODO Bitmap display needs to be aligned for macOS 
and Windows
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]", "checksum", 
"747141214295528493");
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]", "checksum", 
"747141214295528493");
 #endif
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]/data", 10);
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]/data[1]", "row",
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]/data", 10);
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]/data[1]", "row",
 
"00,00,00,00,00,00,00,00,00,00");
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]/data[4]", "row",
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]/data[4]", "row",
 
"00,ff,00,ff,00,ff,00,ff,00,ff");
-assertXPath(pDocument, aXPathPrefix + "bitmap[1]/data[5]", "row",
+assertXPath(pDocument, aXPathPrefix + "mask/bitmap[1]/data[5]", "row",
 
"ff,00,ff,ff,00,00,00,ff,ff,00");
 
-assertXPath(pDocument, aXPathPrefix + "bitmap[2]", "xy11", "1524");
-assertXPath(pDocument, aXPathPrefix + "bitmap[2]", "xy12", 

[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-09-03 Thread Hossein (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx   |   10 +--
 emfio/qa/cppunit/wmf/data/tdf88163-non-placeable.wmf |binary
 emfio/qa/cppunit/wmf/wmfimporttest.cxx   |   63 +++
 emfio/source/reader/wmfreader.cxx|7 --
 4 files changed, 61 insertions(+), 19 deletions(-)

New commits:
commit d25906087918c085239aac30fd72cb65aa7b9eb4
Author: Hossein 
AuthorDate: Thu Sep 2 18:29:08 2021 +0200
Commit: Miklos Vajna 
CommitDate: Fri Sep 3 09:37:37 2021 +0200

tdf#88163 Fix WMF font size

The problems in tdf#88163 can be categorized into two parts:

1. A regression which is caused by the commit
a9020e461803964a206d5551884b70717eed165c. The font size for text is
wrongly calculated for wmf files WITHOUT the placeable header.

2. A long-lasting bug that has existed from LO 3.5 (tested with
various LibreOffice versions from 3.5 to master). The font size for
text is wrongly calculated for wmf files WITH the placeable header.

This patch solves the first part. In this patch the way wmf is scaled
is changed using mnUnitsPerInch as a variable that controls the scale.
The previous method was dividing the left/right/top/bottom fields of
aPlaceableBound which caused the bad scaling of text.

The second problem still remains, and possibly can be solved by usign
the old scaling method that was previously used here (dividing pos
values of aPlaceableBound), but the scaling factor should be
calculated, which varies in different wmf files. More study should be
done to solve this part.

Values used for the example "visio_import_source.wmf" used in the test
WmfTest::testNonPlaceableWmf() are slightly changed, but the rendering
should not noticeably change, except the fix for the text font size.

A new test WmfTest::testTdf88163NonPlaceableWmf() is added which
checks for both font height and text boxes' positions. Font height
can depend on the exact font that is used for Roman in the platform,
so it vary between Linux, Windows and macOS. Thus, a range is used
for ensuring that the font height is correct.

By visual inspection, it is confirmed that this fix does not affect
fdo#74336 and the fix for it still works for attachment 93188.

Change-Id: I55bf38ba4345a0aa48c3e522976a2a5c32f7ec8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121272
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 1d5d68cf28f8..7fc03e2262a2 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -921,17 +921,19 @@ void Test::TestExtTextOutOpaqueAndClipWMF()
 // On some operating systems (Linux on LO Jenkins CI), the `/mask/` string 
is not added to XPath
 // As a result tests are failing. On my Ubuntu 20.04 the `/mask/` string 
was added
 // I would leave this test case for macOS to make sure there is no 
regression at least on one platform.
+
+// These values come from the fix for tdf#88163
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor", 5);
 assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[1]/polypolygon", "path",
-"m7219 1825h319v3608h-319z");
+"m7257 1836h320v3628h-320z");
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[1]", "color", 
"#ff");
 
 assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[2]/polypolygon", "path",
-"m7219 5942h319v318h-319z");
+"m7257 5976h320v321h-320z");
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[2]", "color", 
"#00ff00");
 
 assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[3]/polypolygon", "path",
-"m10149 5942h319v318h-319z");
+"m10203 5976h320v321h-320z");
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[3]", "color", 
"#8080ff");
 
 assertXPath(pDocument, aXPathPrefix + "mask/group", 5);
@@ -948,7 +950,7 @@ void Test::TestExtTextOutOpaqueAndClipWMF()
 assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/polypolygoncolor", "color",
 "#ff8000");
 assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/polypolygoncolor/polypolygon",
-"path", "m1062 1061h1270v473h-1270z");
+"path", "m1067 1067h1270v473h-1270z");
 assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/textsimpleportion", "text",
 "");
 assertXPath(pDocument, aXPathPrefix + 
"mask/group[3]/mask/group/textsimpleportion", "fontcolor",
diff --git a/emfio/qa/cppunit/wmf/data/tdf88163-non-placeable.wmf 
b/emfio/qa/cppunit/wmf/data/tdf88163-non-placeable.wmf
new file mode 100644
index ..b39514bd1b5c
Binary files /dev/null and 

[Libreoffice-commits] core.git: emfio/qa solenv/clang-format

2021-07-13 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx | 1026 ++---
 solenv/clang-format/excludelist|1 
 2 files changed, 577 insertions(+), 450 deletions(-)

New commits:
commit 91082e711db486069313260707954ea6da931634
Author: Bartosz Kosiorek 
AuthorDate: Tue Jul 13 20:01:53 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Tue Jul 13 22:49:04 2021 +0200

Enable automatic code style formatting for EmfImportTest.cxx

As EmfImportTest.cxx code style is follow the recommended
code style (except too long lines), the code
is used only for testing and it is rarely modified,
I decided to enable automatic code formatting.

It is one step closed to migrate to common code style.

Change-Id: I1b7f980b9e68e121ba981b8a8222daa31424ac53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118864
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 8aa1a9dc9b55..1d5d68cf28f8 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -33,7 +33,6 @@
 
 namespace
 {
-
 using namespace css;
 using namespace css::uno;
 using namespace css::io;
@@ -142,7 +141,7 @@ Primitive2DSequence Test::parseEmf(std::u16string_view 
aSource)
 {
 const Reference xEmfParser = EmfTools::create(m_xContext);
 
-OUString aUrl  = m_directories.getURLFromSrc(aSource);
+OUString aUrl = m_directories.getURLFromSrc(aSource);
 OUString aPath = m_directories.getPathFromSrc(aSource);
 
 SvFileStream aFileStream(aUrl, StreamMode::READ);
@@ -153,7 +152,7 @@ Primitive2DSequence Test::parseEmf(std::u16string_view 
aSource)
 
 Sequence aData(pBuffer.get(), nSize + 1);
 Reference aInputStream(new 
comphelper::SequenceInputStream(aData));
-css::uno::Sequence< css::beans::PropertyValue > aEmptyValues;
+css::uno::Sequence aEmptyValues;
 
 return xEmfParser->getDecomposition(aInputStream, aPath, aEmptyValues);
 }
@@ -163,22 +162,27 @@ void Test::testPolyPolygon()
 Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/fdo79679-2.emf");
 CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
 drawinglayer::Primitive2dXmlDump dumper;
-xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
+xmlDocUniquePtr pDocument
+= 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
 
-CPPUNIT_ASSERT (pDocument);
+CPPUNIT_ASSERT(pDocument);
 
 // Chart axis
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 
0h19746v14817h-19746z");
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor", 2);
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[1]", "color", 
"#ff");
-assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[1]/polypolygon", "path", "m0 0h19781v14852h-19781z");
-assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[2]/polypolygon", "path", "m2574 
13194v-12065h15303v12065z");
+assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[1]/polypolygon", "path",
+"m0 0h19781v14852h-19781z");
+assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[2]/polypolygon", "path",
+"m2574 13194v-12065h15303v12065z");
 
 assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke", 116);
-assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[1]/polygon", "2574,13194 2574,1129 17877,1129 17877,13194");
+assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[1]/polygon",
+   "2574,13194 2574,1129 17877,1129 17877,13194");
 assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"color", "#ff");
 
-assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[10]/polygon", "8674,13194 8674,1129");
+assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[10]/polygon",
+   "8674,13194 8674,1129");
 assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[10]/line", 
"color", "#00");
 
 assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion", 28);
@@ -190,7 +194,6 @@ void Test::testPolyPolygon()
 assertXPath(pDocument, aXPathPrefix + "mask/pointarray[1]", "color", 
"#00");
 assertXPath(pDocument, aXPathPrefix + "mask/pointarray[1]/point", "x", 
"2574");
 assertXPath(pDocument, aXPathPrefix + "mask/pointarray[1]/point", "y", 
"1129");
-
 }
 
 void Test::TestDrawImagePointsTypeBitmap()
@@ -234,8 +237,9 @@ void Test::TestDrawString()
 Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestDrawString.emf");
 CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
 drawinglayer::Primitive2dXmlDump dumper;
-xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
-

[Libreoffice-commits] core.git: emfio/qa

2021-07-13 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |  699 -
 1 file changed, 350 insertions(+), 349 deletions(-)

New commits:
commit c6447960ce86e9c57eaff79ab44a5c442abe5448
Author: Bartosz Kosiorek 
AuthorDate: Tue Jul 13 19:59:35 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Tue Jul 13 21:41:55 2021 +0200

Decrease line length of EmfImportTest.cxx by introducing const string

Change-Id: Ie30d0246d6ca54821f00fe516ab67f803ef0d804
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118863
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index f894c2d9a666..8aa1a9dc9b55 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -44,6 +44,7 @@ using drawinglayer::primitive2d::Primitive2DContainer;
 class Test : public test::BootstrapFixture, public XmlTestTools, public 
unotest::MacrosTest
 {
 uno::Reference mxComponent;
+const OString aXPathPrefix = "/primitive2D/metafile/transform/";
 
 void testPolyPolygon();
 void TestDrawImagePointsTypeBitmap();
@@ -167,28 +168,28 @@ void Test::testPolyPolygon()
 CPPUNIT_ASSERT (pDocument);
 
 // Chart axis
-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", "#ff");
-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);
-assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/polygon", "2574,13194 
2574,1129 17877,1129 17877,13194");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/line", "color", 
"#ff");
-
-assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[10]/polygon", "8674,13194 
8674,1129");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[10]/line", "color", 
"#00");
-
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion", 28);
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion[6]", "width", "459");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion[6]", "x", "9908");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion[6]", "text", "0.5");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion[6]", "fontcolor", 
"#00");
-assertXPath(pDocument, "/primitive2D/metafile/transform/mask/pointarray", 
98);
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/pointarray[1]", "color", "#00");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/pointarray[1]/point", "x", "2574");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/pointarray[1]/point", "y", "1129");
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 
0h19746v14817h-19746z");
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor", 2);
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor[1]", "color", 
"#ff");
+assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[1]/polypolygon", "path", "m0 0h19781v14852h-19781z");
+assertXPath(pDocument, aXPathPrefix + 
"mask/polypolygoncolor[2]/polypolygon", "path", "m2574 
13194v-12065h15303v12065z");
+
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke", 116);
+assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[1]/polygon", "2574,13194 2574,1129 17877,1129 17877,13194");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[1]/line", 
"color", "#ff");
+
+assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstroke[10]/polygon", "8674,13194 8674,1129");
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstroke[10]/line", 
"color", "#00");
+
+assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion", 28);
+assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", 
"width", "459");
+assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", "x", 
"9908");
+assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", "text", 
"0.5");
+assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[6]", 
"fontcolor", "#00");
+assertXPath(pDocument, aXPathPrefix + "mask/pointarray", 98);
+assertXPath(pDocument, aXPathPrefix + "mask/pointarray[1]", 

[Libreoffice-commits] core.git: emfio/qa

2021-07-06 Thread Miklos Vajna (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 4f33e723900c280c17c75898fb7a59e2e749f93e
Author: Miklos Vajna 
AuthorDate: Tue Jul 6 11:32:01 2021 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jul 6 12:22:12 2021 +0200

CppunitTest_emfio_emf: add some tolerance in TestDrawStringAlign

Commit 574dc1e8ff6ea4214fefd91216fca5146a4ff13e (EMF+ tdf#142995
tdf#142997 tdf#143076 Add alignment support for DrawString, 2021-06-24)
added this test, it seems the result depends on what fonts are
installed, so add some tolerance.

Probably it fails for me (and not on Jenkins) as I have lots of
additional fonts installed, e.g. Arial (and not only Liberation Sans).

Change-Id: Ie93d1f1efe1fbbf1851ad46f33f5f83c8812e6d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118470
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index c60a4870f6f1..f894c2d9a666 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -285,8 +285,11 @@ void Test::TestDrawStringAlign()
 "text", "HCVT");
 
 // TODO Make the position of the text the same across the platforms (Arial 
vs Liberation Sans).
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[3]/textsimpleportion",
-"x", "276");
+// This is usually 276, but can be 275 as well; depends on what fonts are 
installed?
+sal_Int32 nX = getXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[3]/textsimpleportion",
+"x").toInt32();
+CPPUNIT_ASSERT(nX >= 275);
+CPPUNIT_ASSERT(nX <= 276);
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[3]/textsimpleportion",
 "y", "22");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[3]/textsimpleportion",
@@ -306,8 +309,11 @@ void Test::TestDrawStringAlign()
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[5]/textsimpleportion",
 "text", "HCVC");
 
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[6]/textsimpleportion",
-"x", "274");
+// This is usually 274, but can be 273 as well; depends on what fonts are 
installed?
+nX = getXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[6]/textsimpleportion",
+"x").toInt32();
+CPPUNIT_ASSERT(nX >= 273);
+CPPUNIT_ASSERT(nX <= 274);
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[6]/textsimpleportion",
 "y", "66");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[6]/textsimpleportion",
@@ -327,8 +333,11 @@ void Test::TestDrawStringAlign()
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[8]/textsimpleportion",
 "text", "HCVB");
 
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[9]/textsimpleportion",
-"x", "275");
+// This is usually 275, but can be 274 as well; depends on what fonts are 
installed?
+nX = getXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[9]/textsimpleportion",
+"x").toInt32();
+CPPUNIT_ASSERT(nX >= 274);
+CPPUNIT_ASSERT(nX <= 275);
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[9]/textsimpleportion",
 "y", "110");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform[9]/textsimpleportion",
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-06-08 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   22 -
 emfio/source/reader/wmfreader.cxx  |   73 +++--
 2 files changed, 45 insertions(+), 50 deletions(-)

New commits:
commit b6a30a9db00f92eec7387a577321d65d47ff4af5
Author: Bartosz Kosiorek 
AuthorDate: Tue Jun 8 12:28:48 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Tue Jun 8 22:40:01 2021 +0200

WMF tdf#142625 Refactor Bitmap records, to better handle missing features

Change-Id: If3334158e6e0ef9bc3aa33656ad0ee45cf460dbb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116827
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 2ad512d0bac1..d949240a40b5 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -696,25 +696,25 @@ void Test::TestStretchDIBWMF()
 xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
 CPPUNIT_ASSERT (pDocument);
 
-assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap",
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/bitmap",
 "xy11", "12065");
-assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap",
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/bitmap",
 "xy12", "0");
-assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap",
-"xy13", "3598");
-assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap",
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/bitmap",
+"xy13", "0");
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/bitmap",
 "xy21", "0");
-assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap",
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/bitmap",
 "xy22", "12065");
-assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap",
-"xy23", "3598");
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/bitmap",
+"xy23", "0");
 
-assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap",
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/bitmap",
 "height", "10");
-assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap",
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/bitmap",
 "width", "10");
 #if !defined(MACOSX) // TODO DIB display needs to be fixed for macOS
-assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap",
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/bitmap",
 "checksum", "275245357");
 #endif
 }
diff --git a/emfio/source/reader/wmfreader.cxx 
b/emfio/source/reader/wmfreader.cxx
index 73d059aa5df3..65c2cff1f465 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -803,14 +803,14 @@ namespace emfio
 
 case W_META_BITBLT:
 {
-// 0-3   : nRasterOperation  #93454#
+// 0-3   : nRasterOperation#93454#
 // 4-5   : y offset of source bitmap
 // 6-7   : x offset of source bitmap
-// 8-9   : used height of source bitmap
-// 10-11 : used width  of source bitmap
+// 8-9   : height of source and destination bitmap
+// 10-11 : width  of source and destination bitmap
 // 12-13 : destination position y (in pixel)
 // 14-15 : destination position x (in pixel)
-// 16-17 : don't know
+// 16-17 : bitmap type
 // 18-19 : Width Bitmap in Pixel
 // 20-21 : Height Bitmap in Pixel
 // 22-23 : bytes per scanline
@@ -818,26 +818,31 @@ namespace emfio
 // 25: bitcount
 
 sal_uInt32  nRasterOperation = 0;
-sal_uInt16  nYSrc = 0, nXSrc = 0, nSye = 0, nSxe = 0, 
nBitmapType = 0, nWidth = 0, nHeight = 0, nBytesPerScan = 0;
+sal_Int16   nYSrc = 0, nXSrc = 0, nSye = 0, nSxe = 0, 
nBitmapType = 0, nWidth = 0, nHeight = 0, nBytesPerScan = 0;
 sal_uInt8   nPlanes, nBitCount;
+const bool bNoSourceBitmap = ( nRecordSize == ( static_cast< 
sal_uInt32 >( nFunc ) >> 8 ) + 3 );
 
 mpInputStream->ReadUInt32( nRasterOperation );
-SAL_WARN("emfio", "\t\t Raster operation: 0x" << std::hex << 
nRasterOperation << std::dec);
-if ( nRecordSize == ( ( static_cast< sal_uInt32 >( nFunc ) >> 
8 ) + 3 ) )
+SAL_INFO("emfio", "\t\t Raster operation: 0x" << std::hex << 
nRasterOperation << std::dec << ", No source bitmap: " << bNoSourceBitmap);
+
+mpInputStream->ReadInt16( nYSrc 

[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-05-30 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   18 
--
 emfio/qa/cppunit/emf/data/TestExtTextOutOpaqueAndClipTransform.emf |binary
 emfio/source/reader/emfreader.cxx  |4 +-
 emfio/source/reader/mtftools.cxx   |3 +
 4 files changed, 20 insertions(+), 5 deletions(-)

New commits:
commit f275c4b31f095193b80cb756f8610c16282fb8f4
Author: Bartosz Kosiorek 
AuthorDate: Sat May 29 21:11:55 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Mon May 31 07:32:44 2021 +0200

tdf#53004 tdf#142495 WMF EMF Always display Text rectangle

In previous implementation if BKMode was set to Transparent,
then both Background of Text and Rectangle was not drawn.

It was wrong, and Rectangle should be always drawn.

This commit fix that issue and allows EMF images
exported by LTspice to be rendered correctly under LibreOffice.

Change-Id: I03801d35d92eb2a3fdc175ca1d5b348a2aa30842
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116394
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 1b134551c7ff..1613fe943e6f 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -519,12 +519,19 @@ void Test::TestExtTextOutOpaqueAndClipTransform()
 xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
 CPPUNIT_ASSERT (pDocument);
 
-assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion",
+
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion", 2);
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion[1]",
 "text", "No_rect- DLP-");
-assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion",
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion[1]",
 "fontcolor", "#00");
 
-assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygoncolor", 
2);
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion[2]",
+"text", "OpaqueTranspa");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion[2]",
+"fontcolor", "#00");
+
+assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygoncolor", 
3);
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor[1]/polypolygon",
 "path", "m966 490-477-275-84 147 476 275z");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor[1]",
@@ -535,6 +542,11 @@ void Test::TestExtTextOutOpaqueAndClipTransform()
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor[2]",
 "color", "#0080ff");
 
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor[3]/polypolygon",
+"path", "m972 1326-476-275-148 257 476 276z");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor[3]",
+"color", "#800080");
+
 assertXPath(pDocument, "/primitive2D/metafile/transform/group", 3);
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/group[1]/polypolygoncolor",
 "color", "#ff");
diff --git a/emfio/qa/cppunit/emf/data/TestExtTextOutOpaqueAndClipTransform.emf 
b/emfio/qa/cppunit/emf/data/TestExtTextOutOpaqueAndClipTransform.emf
index 7d59ac3e5bd2..0b7be5ab39ec 100644
Binary files 
a/emfio/qa/cppunit/emf/data/TestExtTextOutOpaqueAndClipTransform.emf and 
b/emfio/qa/cppunit/emf/data/TestExtTextOutOpaqueAndClipTransform.emf differ
diff --git a/emfio/source/reader/emfreader.cxx 
b/emfio/source/reader/emfreader.cxx
index e6a758175fb5..79ff9cf04200 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1817,9 +1817,9 @@ namespace emfio
 mpInputStream->ReadInt32( nLeftRect ).ReadInt32( 
nTopRect ).ReadInt32( nRightRect ).ReadInt32( nBottomRect );
 const tools::Rectangle aRect( nLeftRect, nTopRect, 
nRightRect, nBottomRect );
 BkMode mnBkModeBackup = mnBkMode;
-if ( nOptions & ETO_NO_RECT ) // Don't draw the 
background rectangle
+if ( nOptions & ETO_NO_RECT ) // Don't draw the 
background rectangle and text background
 mnBkMode = BkMode::Transparent;
-if ( nOptions & ETO_OPAQUE )
+else if ( nOptions & ETO_OPAQUE )
 DrawRectWithBGColor( aRect );
 mpInputStream->ReadUInt32( offDx );
 
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 6bf0d98a3e76..866f6996d9e3 100644
--- a/emfio/source/reader/mtftools.cxx
+++ 

[Libreoffice-commits] core.git: emfio/qa

2021-05-28 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx|4 ++--
 emfio/qa/cppunit/wmf/data/TestPalette.wmf |binary
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9864fbc9d5f532d9aa4742968886b3f94bc44dbc
Author: Bartosz Kosiorek 
AuthorDate: Thu May 27 19:38:50 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri May 28 09:33:21 2021 +0200

tdf#117957 WMF Replace ellipses with rects to fix tests on arm64

The issue is caused by floating numbers,
On x86_64 it is:

  338.499728160392-445.269903703769

on arm it is:

  338.499728160392-445.26990370377

As in test files, we have two ellipses (which are made from small lines),
which points rounds differently on different architectures

Change-Id: I44dd5c7b3b13f3b1680d5a3a8348d6f467cb2f7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116270
Tested-by: Jenkins
Tested-by: René Engelhard 
Reviewed-by: Xisco Fauli 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index e825dce810da..5de9faa36714 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -520,7 +520,7 @@ void Test::TestPaletteWMF()
 "color", "#00");
 
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor[2]/polypolygon",
-"path", "m4920 3571c0 236.798958993862-62.332250797861 
469.426085921606-180.731730294792 674.5s-288.694355626813 
375.368790208277-493.768269705208 493.768269705208-437.701041006137 
180.731730294792-674.5 
180.731730294792-469.426085921606-62.332250797861-674.5-180.731730294792-375.368790208277-288.694355626812-493.768269705208-493.768269705207-180.731730294792-437.701041006138-180.731730294792-674.5c-4.54747350886464E-013-236.798958993862
 62.332250797861-469.426085921606 180.731730294792-674.5 
118.399479496931-205.073914078395 288.694355626812-375.368790208277 
493.768269705207-493.768269705208s437.701041006138-180.731730294793 
674.5-180.731730294793c236.798958993862-4.54747350886464E-013 469.426085921606 
62.3322507978601 674.5 180.731730294791s375.368790208277 288.694355626813 
493.768269705208 493.768269705207c118.399479496932 205.073914078394 
180.731730294793 437.701041006138 180.731730294793 674.5z");
+"path", "m h2698v2698h-2698z");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor[2]",
 "color", "#0080ff");
 
@@ -533,7 +533,7 @@ void Test::TestPaletteWMF()
 "width", "132");
 
 assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/polygon",
-   "4894,3545 4892,3477 4887,3409 4878,3341 4866,3273 
4851,3207 4832,3141 4810,3076 4785,3013 4756,2951 4724,2890 4690,2831 4652,2774 
4612,2719 4569,2666 4523,2616 4474,2567 4424,2521 4371,2478 4316,2438 4259,2400 
4200,2366 4139,2334 4077,2305 4014,2280 3949,2258 3883,2239 3817,2224 3749,2212 
3681,2203 3613,2198 3545,2196 3545,2196 3477,2198 3409,2203 3341,2212 3273,2224 
3207,2239 3141,2258 3076,2280 3013,2305 2951,2334 2890,2366 2831,2400 2774,2438 
2719,2478 2666,2521 2616,2567 2567,2616 2521,2666 2478,2719 2438,2774 2400,2831 
2366,2890 2334,2951 2305,3013 2280,3076 2258,3141 2239,3207 2224,3273 2212,3341 
2203,3409 2198,3477 2196,3545 2196,3545 2198,3613 2203,3681 2212,3749 2224,3817 
2239,3883 2258,3949 2280,4014 2305,4077 2334,4139 2366,4200 2400,4259 2438,4316 
2478,4371 2521,4424 2567,4474 2616,4523 2666,4569 2719,4612 2774,4652 2831,4690 
2890,4724 2951,4756 3013,4785 3076,4810 3141,4832 3207,4851 3273,4866 3341,4878 
3409,4887 3477,4892 3545,4894 3545,4894 361
 3,4892 3681,4887 3749,4878 3817,4866 3883,4851 3949,4832 4014,4810 4077,4785 
4139,4756 4200,4724 4259,4690 4316,4652 4371,4612 4424,4569 4474,4523 4523,4474 
4569,4424 4612,4371 4652,4316 4690,4259 4724,4200 4756,4139 4785,4077 4810,4014 
4832,3949 4851,3883 4866,3817 4878,3749 4887,3681 4892,3613");
+   ", 4920, 4920,4920 ,4920");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/line",
 "color", "#ff");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/line",
diff --git a/emfio/qa/cppunit/wmf/data/TestPalette.wmf 
b/emfio/qa/cppunit/wmf/data/TestPalette.wmf
index 013adeb16de7..079a7f64f496 100644
Binary files a/emfio/qa/cppunit/wmf/data/TestPalette.wmf and 
b/emfio/qa/cppunit/wmf/data/TestPalette.wmf differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: emfio/qa

2021-05-27 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx|8 
 emfio/qa/cppunit/wmf/data/TestPalette.wmf |binary
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 9cc47eda70025c6bccfad1cfc45d30b7ecd2fc19
Author: Bartosz Kosiorek 
AuthorDate: Thu May 27 10:45:47 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Thu May 27 13:09:33 2021 +0200

tdf#117957 WMF Fix failing tests on arm64

So the issue is caused by floating numbers,
On x86_64 it is:

  338.499728160392-445.269903703769

on arm it is:

  338.499728160392-445.26990370377

As in test files, we have two ellipses (which are made from small lines),
which points rounds differently on different architectures

Change-Id: I10efe80fea0944cf957e949c8c209c94fd588702
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116234
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index b28985a3b165..e825dce810da 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -515,25 +515,25 @@ void Test::TestPaletteWMF()
 
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor", 2);
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor[1]/polypolygon",
-"path", "m2433 1216.5c0 213.540351086756-56.2099207528522 
423.318631225821-162.98009629623 608.25s-260.338534929591 
338.499728160392-445.269903703769 445.26990370377-394.709648913244 
162.98009629623-608.25 
162.98009629623-423.318631225821-56.2099207528518-608.25-162.98009629623-338.499728160392-260.338534929591-445.26990370377-445.26990370377-162.980096296231-394.709648913244-162.980096296231-608.25c-2.70117261891301E-013-213.540351086756
 56.2099207528519-423.318631225821 162.98009629623-608.25 
106.770175543378-184.931368774179 260.338534929591-338.499728160392 
445.269903703769-445.26990370377s394.709648913244-162.980096296231 
608.25-162.980096296231c213.540351086756-5.40234523782601E-013 423.318631225821 
56.2099207528518 608.25 162.98009629623s338.499728160392 260.338534929591 
445.26990370377 445.269903703769c106.770175543379 184.931368774179 
162.980096296231 394.709648913244 162.980096296231 608.25z");
+"path", "m0 0h3015v3015h-3015z");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor[1]",
 "color", "#00");
 
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor[2]/polypolygon",
-"path", "m5079 3862.5c0 213.540351086756-56.2099207528527 
423.318631225821-162.980096296231 608.25s-260.33853492959 
338.499728160391-445.269903703769 445.269903703769-394.709648913244 
162.980096296231-608.25 
162.980096296231-423.318631225821-56.2099207528518-608.25-162.98009629623-338.499728160391-260.33853492959-445.26990370377-445.269903703769-162.980096296231-394.709648913245-162.980096296231-608.2501c-4.54747350886464E-013-213.540351086756
 56.2099207528518-423.318631225821 162.98009629623-608.25 
106.770175543378-184.931368774179 260.33853492959-338.499728160392 
445.269903703769-445.26990370377s394.709648913244-162.980096296231 
608.25-162.980096296231c213.540351086756-4.54747350886464E-013 423.318631225821 
56.2099207528522 608.25 162.98009629623s338.499728160392 260.33853492959 
445.26990370377 445.269903703769c106.770175543378 184.931368774178 
162.980096296231 394.709648913244 162.980096296231 608.25z");
+"path", "m4920 3571c0 236.798958993862-62.332250797861 
469.426085921606-180.731730294792 674.5s-288.694355626813 
375.368790208277-493.768269705208 493.768269705208-437.701041006137 
180.731730294792-674.5 
180.731730294792-469.426085921606-62.332250797861-674.5-180.731730294792-375.368790208277-288.694355626812-493.768269705208-493.768269705207-180.731730294792-437.701041006138-180.731730294792-674.5c-4.54747350886464E-013-236.798958993862
 62.332250797861-469.426085921606 180.731730294792-674.5 
118.399479496931-205.073914078395 288.694355626812-375.368790208277 
493.768269705207-493.768269705208s437.701041006138-180.731730294793 
674.5-180.731730294793c236.798958993862-4.54747350886464E-013 469.426085921606 
62.3322507978601 674.5 180.731730294791s375.368790208277 288.694355626813 
493.768269705208 493.768269705207c118.399479496932 205.073914078394 
180.731730294793 437.701041006138 180.731730294793 674.5z");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor[2]",
 "color", "#0080ff");
 
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke", 2);
 assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/polygon",
-   "2408,1191 2406,1129 2402,1068 2394,1007 2383,946 
2369,886 2352,827 2332,768 2309,711 2284,655 2255,600 2224,547 2190,496 

[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-05-22 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx  |   29 
 emfio/qa/cppunit/wmf/data/TestRoundRect.wmf |binary
 emfio/source/reader/mtftools.cxx|1 
 3 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit b7c9ce6c86a11c6cacfa190b99052da37c49
Author: Bartosz Kosiorek 
AuthorDate: Sat May 22 08:04:18 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Sat May 22 10:02:56 2021 +0200

tdf#127145 WMF Fix displaying line width in ROUNDRECT record

The EDGE optimization shouldn't be used for curves,
otherwise strange issues appearing.

Change-Id: Id677fc9002f0f79913ae756f0e456af7c9f7e507
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115984
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index bca5cbc161e3..b28985a3b165 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -60,7 +60,8 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools, public unotest:
 void TestEllipseXformIntersectClipRect();
 void TestDrawPolyLine16WithClip();
 void TestFillRegion();
-void TestPalette();
+void TestPaletteWMF();
+void TestRoundrectWMF();
 void TestPolylinetoCloseStroke();
 void TestPolyLineWidth();
 void TestRoundRect();
@@ -90,7 +91,8 @@ public:
 CPPUNIT_TEST(TestEllipseXformIntersectClipRect);
 CPPUNIT_TEST(TestDrawPolyLine16WithClip);
 CPPUNIT_TEST(TestFillRegion);
-CPPUNIT_TEST(TestPalette);
+CPPUNIT_TEST(TestPaletteWMF);
+CPPUNIT_TEST(TestRoundrectWMF);
 CPPUNIT_TEST(TestPolylinetoCloseStroke);
 CPPUNIT_TEST(TestPolyLineWidth);
 CPPUNIT_TEST(TestRoundRect);
@@ -502,8 +504,7 @@ void Test::TestPolylinetoCloseStroke()
 "color", "#00");
 }
 
-
-void Test::TestPalette()
+void Test::TestPaletteWMF()
 {
 // WMF import with records: CREATEPALETTE, SELECTOBJECT, 
CREATEPENINDIRECT, CREATEBRUSHINDIRECT, ELLIPSE.
 Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/wmf/data/TestPalette.wmf");
@@ -539,6 +540,26 @@ void Test::TestPalette()
 "width", "132");
 }
 
+void Test::TestRoundrectWMF()
+{
+// WMF records: ROUNDRECT, SETBKCOLOR, CREATEBRUSHINDIRECT
+Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/wmf/data/TestRoundRect.wmf");
+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/polypolygoncolor",
+"color", "#ff");
+
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/polygonstroke/polygon",
+   "2865,661 2865,653 2865,645 2865,637 2865,621 2865,613 
2865,605 2857,597 2857,589 2857,582 2857,566 2857,558 2849,550 2849,542 
2849,534 2841,526 2841,518 2841,510 2833,502 2833,494 2825,486 2825,478 
2817,470 2817,462 2809,454 2809,446 2801,438 2801,430 2793,422 2793,422 
2785,414 2777,406 2777,398 2769,390 2761,390 2761,382 2753,374 2745,374 
2737,366 2737,366 2729,358 2721,350 2714,350 2714,343 2706,343 2698,343 
2690,335 2682,335 2682,335 2674,327 2666,327 2658,327 2650,327 2642,319 
2634,319 2634,319 2626,319 2618,319 2610,319 573,319 565,319 557,319 549,319 
549,319 541,319 533,327 525,327 517,327 509,327 501,335 501,335 493,335 485,343 
477,343 469,343 469,350 462,350 454,358 446,366 446,366 438,374 430,374 422,382 
422,390 414,390 406,398 406,406 398,414 390,422 390,422 382,430 382,438 374,446 
374,454 366,462 366,470 358,478 358,486 350,494 350,502 342,510 342,518 342,526 
334,534 334,542 334,550 326,558 326,566 326,582 326,589 326,597 318,605 318,613 
318,621 31
 8,637 318,645 318,653 318,661 318,1673 318,1681 318,1689 318,1697 318,1713 
318,1721 318,1729 326,1737 326,1745 326,1752 326,1768 326,1776 334,1784 
334,1792 334,1800 342,1808 342,1816 342,1824 350,1832 350,1840 358,1848 
358,1856 366,1864 366,1872 374,1880 374,1888 382,1896 382,1904 390,1912 
390,1912 398,1920 406,1928 406,1936 414,1944 422,1944 422,1952 430,1960 
438,1960 446,1968 446,1968 454,1976 462,1984 469,1984 469,1991 477,1991 
485,1991 493,1999 501,1999 501,1999 509,2007 517,2007 525,2007 533,2007 
541,2015 549,2015 549,2015 557,2015 565,2015 573,2015 2610,2015 2618,2015 
2626,2015 2634,2015 2634,2015 2642,2015 2650,2007 2658,2007 2666,2007 2674,2007 
2682,1999 2682,1999 2690,1999 2698,1991 2706,1991 2714,1991 2714,1984 2721,1984 
2729,1976 2737,1968 2737,1968 2745,1960 2753,1960 2761,1952 2761,1944 2769,1944 
2777,1936 2777,1928 2785,1920 2793,1912 2793,1912 2801,1904 2801,1896 2809,1888 
2809,1880 2817,1872 2817,1864 2825,1856 2825,1848 2833,1840 2833,1832 2841,1824 
2841,1816 2841,1
 808 2849,1800 2849,1792 2849,1784 2857,1776 2857,1768 2857,1752 

[Libreoffice-commits] core.git: emfio/qa emfio/source tools/source

2021-05-20 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx   |   47 ---
 emfio/qa/cppunit/emf/data/TestArcStartPointEqualEndPoint.emf |binary
 emfio/source/reader/emfreader.cxx|   19 
 tools/source/generic/poly.cxx|6 -
 4 files changed, 40 insertions(+), 32 deletions(-)

New commits:
commit fb5247bf587518eaa01cf5d54dceddf73827d740
Author: Bartosz Kosiorek 
AuthorDate: Thu May 20 23:27:45 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Fri May 21 07:30:28 2021 +0200

tdf#55007 tdf#142263 tdf#142268 EMF ARC, PIE, CHORD allow to draw circle

In Metafile specification, if Start Point is the same as End Point,
then the full circle should be drawn.

Unfortunately with previous implementation, if Start Point is the same
as End Point, nothing is drawn.

This patch fixes that and removed EDGES optimizations, which causes
display issues.

Change-Id: I16a1b98f10378d57bed59696db6cc9f228044292
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115891
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 64c7effa1baa..bca5cbc161e3 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 TestArcStartPointEqualEndPoint();
 void TestArcInsideWronglyDefinedRectangle();
 void TestChordWithModifyWorldTransform();
 void TestEllipseWithSelectClipPath();
@@ -82,6 +83,7 @@ public:
 CPPUNIT_TEST(TestTextMapMode);
 CPPUNIT_TEST(TestEnglishMapMode);
 CPPUNIT_TEST(TestRectangleWithModifyWorldTransform);
+CPPUNIT_TEST(TestArcStartPointEqualEndPoint);
 CPPUNIT_TEST(TestArcInsideWronglyDefinedRectangle);
 CPPUNIT_TEST(TestChordWithModifyWorldTransform);
 CPPUNIT_TEST(TestEllipseWithSelectClipPath);
@@ -357,9 +359,28 @@ void Test::TestChordWithModifyWorldTransform()
 xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
 CPPUNIT_ASSERT (pDocument);
 
-assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygoncolor", 
"color", "#ff");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor/polypolygon", "path", "m590 
448-154 93-54 57-21 45 24 67 45 21 224-6 265-97z");
-assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/polygonstroke/polygon", "590,448 436,541 
382,598 361,643 385,710 430,731 654,725 919,628");
+assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygoncolor",
+"color", "#ff");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor/polypolygon",
+"path", "m590 448-21 45-66 24-34 12-33 12-21 45-33 12 12 33-33 
12 12 33 12 34 33-12 12 33 34-12 33-12 45 21 33-12 33-12 46 21 66-25 33-12 
66-24 34-12 66-24z");
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/polygonstroke/polygon",
+   "590,448 569,493 503,517 469,529 436,541 415,586 
382,598 394,631 361,643 361,643 373,676 373,676 385,710 418,698 430,731 464,719 
497,707 542,728 575,716 608,704 654,725 720,700 753,688 819,664 853,652 
919,628");
+}
+
+void Test::TestArcStartPointEqualEndPoint()
+{
+// i73608 EMF import test where StartPoint == EndPoint. It should draw 
full circle
+// Records: SETMAPMODE, SETWINDOWEXTEX, SETWINDOWORGEX, EXTSELECTCLIPRGN, 
INTERSECTCLIPRECT, MOVETOEX, ARC
+Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestArcStartPointEqualEndPoint.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/mask/group/mask/polygonhairline",
+"color", "#00");
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/group/mask/polygonhairline/polygon",
+   "11886,23133 11970,23223 12051,23316 12131,23410 
12208,23506 12282,23604 12354,23704 12424,23805 12491,23909 12556,24014 
12618,24120 12677,24228 12734,24337 12788,24448 12839,24560 12888,24673 
12933,24788 12976,24903 13016,25020 13053,25137 13087,25256 13119,25375 
13147,25495 13172,25615 13195,25736 13214,25858 13230,25980 13244,26103 
13254,26225 13261,26348 13266,26472 13267,26595 13265,26718 13260,26841 
13253,26964 13242,27087 13228,27209 13211,27331 13191,27453 13168,27574 
13142,27694 13113,27814 13082,27933 13047,28051 13009,28169 12969,28285 
12926,28400 12879,28514 12830,28628 12779,28739 12724,28850 

[Libreoffice-commits] core.git: emfio/qa tools/source

2021-05-18 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   15 
++
 emfio/qa/cppunit/emf/data/TestArcInsideWronglyDefinedRectangle.emf |binary
 tools/source/generic/poly.cxx  |9 
--
 3 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit 39369c6e67dffe04acc4abb678c1a94526237fd8
Author: Bartosz Kosiorek 
AuthorDate: Tue May 18 17:36:21 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Tue May 18 20:42:27 2021 +0200

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 

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", "#00");
+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 ..3a785fba6cac
Binary files /dev/null and 
b/emfio/qa/cppunit/emf/data/TestArcInsideWronglyDefinedRectangle.emf differ
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 292247478aac..88a534660894 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -230,11 +230,14 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rBound, 
const Point& rStart, c
 const auto nWidth = rBound.GetWidth();
 const auto nHeight = rBound.GetHeight();
 
-if( ( nWidth > 1 ) && ( nHeight > 1 ) )
+if( ( nWidth != 0 ) && ( nHeight != 0 ) )
 {
 const Point aCenter( rBound.Center() );
-const auto nRadX = o3tl::saturating_sub(aCenter.X(), rBound.Left());
-const auto nRadY = o3tl::saturating_sub(aCenter.Y(), rBound.Top());
+// tdf#142268 Get Top Left corner of rectangle (the rectangle is not 
always correctly created)
+const auto aBoundLeft = rBound.Left() < aCenter.X() ? rBound.Left() : 
rBound.Right();
+const auto aBoundTop = rBound.Top() < aCenter.Y() ? rBound.Top() : 
rBound.Bottom();
+const auto nRadX = o3tl::saturating_sub(aCenter.X(), aBoundLeft);
+const auto nRadY = o3tl::saturating_sub(aCenter.Y(), aBoundTop);
 sal_uInt16  nPoints;
 
 tools::Long nRadXY;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-05-13 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx  |   22 
 emfio/qa/cppunit/emf/data/TestPolylinetoCloseStroke.emf |binary
 emfio/source/reader/mtftools.cxx|   12 +---
 3 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 699295ca7cab3a4f4e801a14496f202c05d18899
Author: Bartosz Kosiorek 
AuthorDate: Thu May 13 20:11:19 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Thu May 13 22:00:05 2021 +0200

tdf#142014 Fix displaying strokes when line width is 0

Change-Id: I80e05ff2f24f5da2f5c124c0ee1b302a1c8226ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115570
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 9e53b261a544..be9a8a741fb2 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -58,6 +58,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools, public unotest:
 void TestEllipseXformIntersectClipRect();
 void TestDrawPolyLine16WithClip();
 void TestFillRegion();
+void TestPolylinetoCloseStroke();
 void TestPolyLineWidth();
 void TestRoundRect();
 void TestCreatePen();
@@ -84,6 +85,7 @@ public:
 CPPUNIT_TEST(TestEllipseXformIntersectClipRect);
 CPPUNIT_TEST(TestDrawPolyLine16WithClip);
 CPPUNIT_TEST(TestFillRegion);
+CPPUNIT_TEST(TestPolylinetoCloseStroke);
 CPPUNIT_TEST(TestPolyLineWidth);
 CPPUNIT_TEST(TestRoundRect);
 CPPUNIT_TEST(TestCreatePen);
@@ -440,6 +442,26 @@ void Test::TestFillRegion()
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[1]", "color", "#00");
 }
 
+void Test::TestPolylinetoCloseStroke()
+{
+// EMF import with records: BEGINPATH, ARC, ENDPATH, STROKEPATH, 
EXTCREATEPEN.
+Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestPolylinetoCloseStroke.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", 
2);
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/polygonhairline[1]/polygon",
+   "1080,150 810,230 570,340 370,490 290,570 170,750 
130,840 100,980 100,1080 140,1270 160,1320 210,1410 400,1620 500,1690");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polygonhairline[1]",
+"color", "#00");
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/polygonhairline[2]/polygon",
+   "1760,1120 1500,1180 1350,1240 1230,1310 1210,1330 
1120,1440 1110,1460 1100,1510 1100,1580 1140,1670 1170,1710 1190,1730");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polygonhairline[2]",
+"color", "#00");
+}
+
 void Test::TestPolyLineWidth()
 {
 // EMF import with records: CREATEPEN, ROUNDRECT.
diff --git a/emfio/qa/cppunit/emf/data/TestPolylinetoCloseStroke.emf 
b/emfio/qa/cppunit/emf/data/TestPolylinetoCloseStroke.emf
new file mode 100644
index ..e89e92272943
Binary files /dev/null and 
b/emfio/qa/cppunit/emf/data/TestPolylinetoCloseStroke.emf differ
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 2d9fe3601ebd..011ff4647a11 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1323,11 +1323,15 @@ namespace emfio
 mpGDIMetaFile->AddAction( new MetaPopAction() );
 }
 // tdf#142014 By default the stroke is made with hairline. If width is 
bigger, we need to use PolyLineAction
-if ( bStroke && ( maLineStyle.aLineInfo.GetWidth() || ( 
maLineStyle.aLineInfo.GetStyle() == LineStyle::Dash ) ) )
+if ( bStroke )
 {
-sal_uInt16 i, nCount = maPathObj.Count();
-for ( i = 0; i < nCount; i++ )
-mpGDIMetaFile->AddAction( new MetaPolyLineAction( maPathObj[ i 
], maLineStyle.aLineInfo ) );
+// bFill is drawing hairstyle line. So we need to to draw it only 
when the width is different than 0
+if ( !bFill || maLineStyle.aLineInfo.GetWidth() || ( 
maLineStyle.aLineInfo.GetStyle() == LineStyle::Dash ) )
+{
+sal_uInt16 i, nCount = maPathObj.Count();
+for ( i = 0; i < nCount; i++ )
+mpGDIMetaFile->AddAction( new MetaPolyLineAction( 
maPathObj[ i ], maLineStyle.aLineInfo ) );
+}
 }
 ClearPath();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-05-12 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx  |   24 
 emfio/qa/cppunit/emf/data/TestPolyLineWidth.emf |binary
 emfio/source/reader/mtftools.cxx|   10 +-
 3 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit b5ece3fbc7f878846298fd9196e5a30ba50e0dc2
Author: Bartosz Kosiorek 
AuthorDate: Wed May 12 19:03:59 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Wed May 12 20:32:27 2021 +0200

tdf#112603 tdf#142014 tdf#142139 WMF/EMF Fix line width

Previosly line width was always 1, and changing width do not affect
line.

Change-Id: I462096b915e053fa089e85860f124466b650558a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115497
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 78e613e2eafa..9e53b261a544 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -58,6 +58,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools, public unotest:
 void TestEllipseXformIntersectClipRect();
 void TestDrawPolyLine16WithClip();
 void TestFillRegion();
+void TestPolyLineWidth();
 void TestRoundRect();
 void TestCreatePen();
 void TestPdfInEmf();
@@ -83,6 +84,7 @@ public:
 CPPUNIT_TEST(TestEllipseXformIntersectClipRect);
 CPPUNIT_TEST(TestDrawPolyLine16WithClip);
 CPPUNIT_TEST(TestFillRegion);
+CPPUNIT_TEST(TestPolyLineWidth);
 CPPUNIT_TEST(TestRoundRect);
 CPPUNIT_TEST(TestCreatePen);
 CPPUNIT_TEST(TestPdfInEmf);
@@ -438,6 +440,28 @@ void Test::TestFillRegion()
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[1]", "color", "#00");
 }
 
+void Test::TestPolyLineWidth()
+{
+// EMF import with records: CREATEPEN, ROUNDRECT.
+Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestPolyLineWidth.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/polypolygoncolor/polypolygon",
+"path", "m530 529 1236-176-707 352z");
+assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygoncolor",
+"color", "#00");
+
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/polygonstroke/polygon",
+   "530,529 530,529 1766,353 1059,705");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polygonstroke/line",
+"color", "#00");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polygonstroke/line",
+"width", "71");
+}
+
 void Test::TestRoundRect()
 {
 // EMF import with records: CREATEPEN, ROUNDRECT.
diff --git a/emfio/qa/cppunit/emf/data/TestPolyLineWidth.emf 
b/emfio/qa/cppunit/emf/data/TestPolyLineWidth.emf
new file mode 100644
index ..792694fa8c99
Binary files /dev/null and b/emfio/qa/cppunit/emf/data/TestPolyLineWidth.emf 
differ
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 2b1c1d406d1b..2d9fe3601ebd 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1322,7 +1322,8 @@ namespace emfio
 if ( !bStroke )
 mpGDIMetaFile->AddAction( new MetaPopAction() );
 }
-else
+// tdf#142014 By default the stroke is made with hairline. If width is 
bigger, we need to use PolyLineAction
+if ( bStroke && ( maLineStyle.aLineInfo.GetWidth() || ( 
maLineStyle.aLineInfo.GetStyle() == LineStyle::Dash ) ) )
 {
 sal_uInt16 i, nCount = maPathObj.Count();
 for ( i = 0; i < nCount; i++ )
@@ -1408,6 +1409,13 @@ namespace emfio
 UpdateLineStyle();
 UpdateFillStyle();
 mpGDIMetaFile->AddAction( new MetaRoundRectAction( ImplMap( rRect ), 
std::abs( ImplMap( rSize ).Width() ), std::abs( ImplMap( rSize ).Height() ) ) );
+// tdf#142139 Wrong line width during WMF import
+if ( maLineStyle.aLineInfo.GetWidth() || ( 
maLineStyle.aLineInfo.GetStyle() == LineStyle::Dash ) )
+{
+tools::Polygon aRoundRectPoly( rRect, rSize.Width(), 
rSize.Height() );
+aRoundRectPoly.Optimize( PolyOptimizeFlags::EDGES );
+mpGDIMetaFile->AddAction( new MetaPolyLineAction( ImplMap( 
aRoundRectPoly ), maLineStyle.aLineInfo ) );
+}
 }
 
 void MtfTools::DrawEllipse( const tools::Rectangle& rRect )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-05-11 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx  |   36 +++-
 emfio/qa/cppunit/emf/data/TestRoundRect.emf |binary
 emfio/source/reader/emfreader.cxx   |5 ++-
 3 files changed, 38 insertions(+), 3 deletions(-)

New commits:
commit f11ed681df15728abe6a0b6b7b1612f190aa1707
Author: Bartosz Kosiorek 
AuthorDate: Tue May 11 17:24:20 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Tue May 11 18:38:08 2021 +0200

tdf#141982 tdf#142139 Add rotation and line width support to ROUNDRECT

With this commit the ROUNDRECT is able to change line width and
transformation (including rotation) is supported.

Change-Id: Ic303a74adf0fd0dd452353f250a13140603d492e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115429
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index e5b1f3f54114..78e613e2eafa 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -58,6 +58,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools, public unotest:
 void TestEllipseXformIntersectClipRect();
 void TestDrawPolyLine16WithClip();
 void TestFillRegion();
+void TestRoundRect();
 void TestCreatePen();
 void TestPdfInEmf();
 
@@ -82,6 +83,7 @@ public:
 CPPUNIT_TEST(TestEllipseXformIntersectClipRect);
 CPPUNIT_TEST(TestDrawPolyLine16WithClip);
 CPPUNIT_TEST(TestFillRegion);
+CPPUNIT_TEST(TestRoundRect);
 CPPUNIT_TEST(TestCreatePen);
 CPPUNIT_TEST(TestPdfInEmf);
 CPPUNIT_TEST_SUITE_END();
@@ -416,7 +418,7 @@ void Test::TestDrawPolyLine16WithClip()
 
 void Test::TestFillRegion()
 {
-// Check import of EMF image with records: CREATEBRUSHINDIRECT, FILLRGN. 
The SETICMMODE is also used.
+// EMF import with records: CREATEBRUSHINDIRECT, FILLRGN. The SETICMMODE 
is also used.
 Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestFillRegion.emf");
 CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
 drawinglayer::Primitive2dXmlDump dumper;
@@ -436,6 +438,38 @@ void Test::TestFillRegion()
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[1]", "color", "#00");
 }
 
+void Test::TestRoundRect()
+{
+// EMF import with records: CREATEPEN, ROUNDRECT.
+Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestRoundRect.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/polypolygoncolor", 
2);
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor[1]/polypolygon",
+"path", "m100 100h4000v2000h-4000z");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor[1]",
+"color", "#ff");
+
+assertXPath(pDocument, "/primitive2D/metafile/transform/polygonstroke", 2);
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/polygonstroke[1]/polygon",
+   "100,100 4100,100 4100,2100 100,2100");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polygonstroke[1]/line",
+"color", "#ff");
+
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor[2]/polypolygon",
+"path", "m4090 
2650-10-50-10-30-50-90-100-110-20-10-30-20-20-20-30-20-90-40-100-30-170-30h-2730l-140
 20-130 40-90 40-30 20-20 20-30 20-20 10-100 110-50 90-10 30-10 50v1090l10 50 
10 30 50 90 100 110 20 10 30 20 20 20 30 20 90 40 100 30 170 30h2730l140-20 
130-40 90-40 30-20 20-20 30-20 20-10 100-110 50-90 10-30 10-50z");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygoncolor[2]",
+"color", "#ff");
+
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/polygonstroke[2]/polygon",
+   "4090,2650 4080,2600 4070,2570 4020,2480 3920,2370 
3900,2360 3870,2340 3850,2320 3820,2300 3730,2260 3630,2230 3460,2200 730,2200 
590,2220 460,2260 370,2300 340,2320 320,2340 290,2360 270,2370 170,2480 
120,2570 110,2600 100,2650 100,3740 110,3790 120,3820 170,3910 270,4020 
290,4030 320,4050 340,4070 370,4090 460,4130 560,4160 730,4190 3460,4190 
3600,4170 3730,4130 3820,4090 3850,4070 3870,4050 3900,4030 3920,4020 4020,3910 
4070,3820 4080,3790 4090,3740");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polygonstroke[2]/line",
+"color", "#ff");
+}
+
 void Test::TestCreatePen()
 {
 // Check import of EMF image with records: RESTOREDC, SAVEDC, MOVETOEX, 
LINETO, POLYLINE16, EXTTEXTOUTW with DxBuffer
diff --git a/emfio/qa/cppunit/emf/data/TestRoundRect.emf 

[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-05-06 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx  |   24 +++-
 emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.emf |binary
 emfio/source/reader/emfreader.cxx   |8 +++-
 3 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 761fdaf26dc9ed7cd0d25a7630576e7800813e2f
Author: Bartosz Kosiorek 
AuthorDate: Tue May 4 13:37:40 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Thu May 6 12:12:40 2021 +0200

tdf#142004 tdf#141982 EMF Import: Add rotation and path support for 
EMR_ELLIPSE

Previous implementation of EMR_ELLIPSE, doesn't support rotation
and EMR_ELLIPSE was not work with EMR_BEGINPATH, EMR_ENDPATH and 
EMR_ABORTPATH

The EMR_BEGINPATH opens path bracket construction.

Once path bracket construction is open, an application can begin specifying 
records to
define the points that lie in the path. Path bracket construction MUST be 
closed by an
EMR_ABORTPATH or EMR_ENDPATH record.

With this patch all these issue was resolved for EMR_ELLIPSE

Change-Id: I6d352e0ff0326dd788d43272bf1330fa6c777df4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115101
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index aa62dcd4b00b..3b08f7fe7d21 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 TestEllipseWithSelectClipPath();
 void TestDrawPolyLine16WithClip();
 void TestFillRegion();
 void TestCreatePen();
@@ -74,6 +75,7 @@ public:
 CPPUNIT_TEST(TestTextMapMode);
 CPPUNIT_TEST(TestEnglishMapMode);
 CPPUNIT_TEST(TestRectangleWithModifyWorldTransform);
+CPPUNIT_TEST(TestEllipseWithSelectClipPath);
 CPPUNIT_TEST(TestDrawPolyLine16WithClip);
 CPPUNIT_TEST(TestFillRegion);
 CPPUNIT_TEST(TestCreatePen);
@@ -314,7 +316,6 @@ void Test::TestEnglishMapMode()
 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
@@ -333,6 +334,26 @@ void Test::TestRectangleWithModifyWorldTransform()
 assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/polygonstroke[1]/polygon", "1042,417 1960,946 
2313,1556 1395,1028");
 }
 
+void Test::TestEllipseWithSelectClipPath()
+{
+// EMF import test with records: RECTANGLE, BEGINPATH, ENDPATH, ELLIPSE
+Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.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/group/mask/polypolygon", 1);
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/group/mask/polypolygon[1]", "path", "m2790 
705-106-106-106-70-318-106-424-70h-706l-35 35-247 35h-142l-318 106-105 70-106 
106v141l106 106 105 70 318 106 424 71h706l424-71 318-106 106-70 106-106");
+
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/group/mask/polypolygoncolor", 1);
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/group/mask/polypolygoncolor[1]", "color", 
"#00");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/group/mask/polypolygoncolor[1]/polypolygon[1]",
 "path", "m353 353h2472v1057h-2472z");
+
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/group/mask/polygonstroke", 1);
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/group/mask/polygonstroke[1]/polygon", "353,353 
2825,353 2825,1410 353,1410");
+}
+
 void Test::TestDrawPolyLine16WithClip()
 {
 // Check import of EMF image with records:
@@ -358,7 +379,6 @@ void Test::TestDrawPolyLine16WithClip()
 
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/group[1]/mask/polypolygon", "path", 
"m2646 0v1322h1323v1322h-1323v1322h-1323v-1322h-1323v-1322h1323v-1322");
 assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/group[1]/mask/polygonstroke/polygon", 
"0,793 3969,4230");
-
 }
 
 void Test::TestFillRegion()
diff --git a/emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.emf 
b/emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.emf
new file mode 100644
index ..ed0d52401238
Binary files /dev/null and 

[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-05-05 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx  |   25 
--
 emfio/qa/cppunit/emf/data/TestRectangleWithModifyWorldTransform.emf |binary
 emfio/source/reader/emfreader.cxx   |9 +++
 3 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 24e71494d7d1a68b2cb5f5d34083ab02009e0982
Author: Bartosz Kosiorek 
AuthorDate: Tue May 4 16:49:25 2021 +0200
Commit: Bartosz Kosiorek 
CommitDate: Wed May 5 10:24:01 2021 +0200

tdf#55058 tdf#141982 EMF: Add rotation and path support for RECTANGLE record

Previous implementation of EMR_RECTANGLE, doesn't support rotation
and EMR_RECTANGLE was not work with EMR_BEGINPATH, EMR_ENDPATH and 
EMR_ABORTPATH

The EMR_BEGINPATH opens path bracket construction.

Once path bracket construction is open, an application can begin specifying 
records to
define the points that lie in the path. Path bracket construction MUST be 
closed by an
EMR_ABORTPATH or EMR_ENDPATH record.

With this patch all these issue was resolved for EMR_RECTANGLE
Change-Id: Ic51442df8905e47c92eed811cc776762c9752af2

Change-Id: I111f183e509f03c0b276a038680f61156b37b235
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115065
Tested-by: Jenkins
Tested-by: Xisco Fauli 
Reviewed-by: Bartosz Kosiorek 
Reviewed-by: Xisco Fauli 

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", "#ff");
-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", "#ad");
-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()
+{
+

[Libreoffice-commits] core.git: emfio/qa

2021-04-23 Thread Miklos Vajna (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 700fe95fac2e2f592159f189ed3ac9e633bf749d
Author: Miklos Vajna 
AuthorDate: Thu Apr 22 20:59:42 2021 +0200
Commit: Miklos Vajna 
CommitDate: Fri Apr 23 09:13:11 2021 +0200

CppunitTest_emfio_emf: avoid --disable-pdfium failure

'make check' now passes for me without pdfium, all relevant tests are
annotated to skip asserts when there is no pdfium anyway.

Change-Id: Ie22a2b3b42d16e72f9d34ada85dee264d79d5155
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114523
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 9ab862f6cd69..590b0e6beac1 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -26,6 +26,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -415,6 +416,11 @@ void Test::TestCreatePen()
 
 void Test::TestPdfInEmf()
 {
+if (!vcl::pdf::PDFiumLibrary::get())
+{
+return;
+}
+
 // Load a PPTX file, which has a shape, with a bitmap fill, which is an 
EMF, containing a PDF.
 OUString aURL = 
m_directories.getURLFromSrc(u"emfio/qa/cppunit/emf/data/pdf-in-emf.pptx");
 getComponent() = loadFromDesktop(aURL);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: emfio/qa emfio/source

2021-03-19 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   30 +++---
 emfio/source/reader/emfreader.cxx  |   17 ++---
 2 files changed, 21 insertions(+), 26 deletions(-)

New commits:
commit 54a8aefa3372dce3da7cf0ad846d55d1b7b92467
Author: Bartosz Kosiorek 
AuthorDate: Wed Mar 17 18:16:04 2021 +0100
Commit: Bartosz Kosiorek 
CommitDate: Fri Mar 19 09:00:11 2021 +0100

tdf#35986 tdf#140271 EMF Fix line width of CREATEPEN record

According to [MS-EMF] documentation:
"If the pen type in the PenStyle field is
PS_COSMETIC, this value MUST be 0x0001."

Unfortunately based on observation of EMF import,
it seems that it is not true. As a result the implementation
must be partially reversed.

Change-Id: I0c2ec5e26b710e1a12d5196b6c8be4709f26dc4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112651
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 85450a2e67a3..f587135e1b1e 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -312,7 +312,7 @@ void Test::TestEnglishMapMode()
 void Test::TestCreatePen()
 {
 // Check import of EMF image with records: RESTOREDC, SAVEDC, MOVETOEX, 
LINETO, POLYLINE16, EXTTEXTOUTW with DxBuffer
-// The CREATEPEN record is used with PS_COSMETIC line style, which will be 
displayed as solid hairline
+// The CREATEPEN record is used with PS_COSMETIC line style, which 
sometimes will be displayed as solid hairline
 Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestCreatePen.emf");
 CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
 drawinglayer::Primitive2dXmlDump dumper;
@@ -321,24 +321,24 @@ void Test::TestCreatePen()
 
 assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygon", 
"path", "m0 0h31250v18192h-31250z");
 
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke", 3);
-assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/polygon", "17898,5693 
20172,5693");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/line", "color", 
"#008000");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/line", "width", "3");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke", 748);
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/polygon", "27875,16523 
27875,1453");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/line", "color", 
"#ff");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/line", "width", "6");
 
-assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/polygon", "17898,6959 
20172,6959");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/line", "color", 
"#80");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/line", "width", "3");
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/polygon", "27975,16453 
27875,16453");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/line", "color", 
"#ff");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/line", "width", "6");
 
-assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[3]/polygon", "17898,7381 
20172,7381");
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[3]/polygon", "27925,16078 
27875,16078");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[3]/line", "color", 
"#ff");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[3]/line", "width", "3");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[3]/line", "width", "6");
 
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline", 755);
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[10]", "color", "#ff");
-assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[10]/polygon", 
"27925,14180 27875,14180");
-assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[100]", "color", 
"#008000");
-assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[100]/polygon", 
"26100,14414 26050,14414");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline", 10);
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[5]", "color", "#008000");
+assertXPathContent(pDocument, 

[Libreoffice-commits] core.git: emfio/qa

2021-02-12 Thread Luboš Luňák (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

New commits:
commit f52c5bea7775ac07cfacc232f0979a03bbdf9aa7
Author: Luboš Luňák 
AuthorDate: Thu Feb 11 16:24:18 2021 +0100
Commit: Miklos Vajna 
CommitDate: Fri Feb 12 11:01:52 2021 +0100

fix test for tdf#137413

The test tested for the topleft corner to be transparent and not black,
but the bitmap has a black outline, so the corner actually should be
black, unlike the rest of the bitmap. I have no idea how the test
could have possibly passed (and those #if tests indicate that it
correctly failed with most drawing backends). What apparently enabled
this to pass was commit 828504974d70111e, which made the drawing
use DrawTransformedBitmap() implementation in the VCL backends,
and the Cairo one apparently mishandles it. Reverting 828504974d70111e
made the test fail.
This commit fixes (and simplifies) the test.

Change-Id: I1560849d683558abbe0cde816c4505b9824a0692
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110769
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 20e84ca86c4a..85450a2e67a3 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -26,7 +26,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -384,19 +383,13 @@ void Test::TestPdfInEmf()
 // height was only 5cm, so it looked blurry.
 CPPUNIT_ASSERT_EQUAL(14321.0, pVectorGraphicData->getSizeHint().getY());
 
-#if !defined(WNT) && !defined(MACOSX)
-// Hmm, manual testing on Windows looks OK.
-BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
-AlphaMask aMask = aBitmapEx.GetAlpha();
-Bitmap::ScopedReadAccess pAccess(aMask);
-Color aColor(pAccess->GetPixel(0, 0));
 // Without the accompanying fix in place, this test would have failed with:
-// - Expected: 220
-// - Actual  : 0
-// i.e. the pixel at the top left corner was entirely opaque, while it 
should be mostly
-// transparent.
-CPPUNIT_ASSERT_EQUAL(static_cast(220), aColor.GetBlue());
-#endif
+// - Expected: 0
+// - Actual  : 255
+// i.e. the pixel in the center was entirely opaque, while it should be 
transparent.
+BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
+Size size = aBitmapEx.GetSizePixel();
+CPPUNIT_ASSERT_EQUAL(static_cast(0), 
aBitmapEx.GetAlpha(size.Width() / 2, size.Height() / 2));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: emfio/qa emfio/source

2020-12-03 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx  |   36 
 emfio/qa/cppunit/emf/data/test_mm_hienglish_ref.emf |binary
 emfio/qa/cppunit/emf/data/test_mm_himetric_ref.emf  |binary
 emfio/source/reader/mtftools.cxx|   28 +++
 4 files changed, 50 insertions(+), 14 deletions(-)

New commits:
commit e179e53e3c703153bb0bb3155c1c6e2d25577fe0
Author: Bartosz Kosiorek 
AuthorDate: Tue Nov 24 18:53:06 2020 +0100
Commit: Bartosz Kosiorek 
CommitDate: Thu Dec 3 10:36:42 2020 +0100

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 
Reviewed-by: Xisco Fauli 
Reviewed-by: Bartosz Kosiorek 

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(aSequence.getLength()));
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(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", "#ad");
+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", 
"#00");
+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
new file mode 100644
index 

[Libreoffice-commits] core.git: emfio/qa emfio/source

2020-11-14 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx  |   53 
 emfio/qa/cppunit/emf/data/TestCreatePen.emf |binary
 emfio/source/reader/emfreader.cxx   |   29 +--
 3 files changed, 71 insertions(+), 11 deletions(-)

New commits:
commit eb2fdd9bc6696732fa472f6883993334898cef7a
Author: Bartosz Kosiorek 
AuthorDate: Fri Nov 13 13:24:36 2020 +0100
Commit: Tomaž Vajngerl 
CommitDate: Sat Nov 14 18:12:42 2020 +0100

tdf#35986 EMF import: Add support for PS_COSMETIC line style in CREATEPEN

When the PS_COSMETIC line style is set in CREATEPEN,
line width should be set to one logical unit and a style that is a solid 
color

This patch is fixing that, allowing to properly import EMF file.
The corresponding unit tests were added

Change-Id: I1a0caf6382d9c313d9725d0b94e2fcd37122a099
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105790
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 94914da60f8a..29c084874b6d 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 TestCreatePen();
 void TestPdfInEmf();
 
 Primitive2DSequence parseEmf(const OUString& aSource);
@@ -66,6 +67,7 @@ public:
 CPPUNIT_TEST(TestDrawLine);
 CPPUNIT_TEST(TestLinearGradient);
 CPPUNIT_TEST(TestTextMapMode);
+CPPUNIT_TEST(TestCreatePen);
 CPPUNIT_TEST(TestPdfInEmf);
 CPPUNIT_TEST_SUITE_END();
 };
@@ -270,6 +272,57 @@ void Test::TestTextMapMode()
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/polygonstroke[20]/line", "width", "11");
 }
 
+
+void Test::TestCreatePen()
+{
+// Check import of EMF image with records: RESTOREDC, SAVEDC, MOVETOEX, 
LINETO, POLYLINE16, EXTTEXTOUTW with DxBuffer
+// The CREATEPEN record is used with PS_COSMETIC line style, which will be 
displayed as solid hairline
+Primitive2DSequence aSequence = 
parseEmf("/emfio/qa/cppunit/emf/data/TestCreatePen.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/mask/polypolygon", 
"path", "m0 0h31250v18192h-31250z");
+
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke", 3);
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/polygon", "17898,5693 
20172,5693");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/line", "color", 
"#008000");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[1]/line", "width", "3");
+
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/polygon", "17898,6959 
20172,6959");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/line", "color", 
"#80");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[2]/line", "width", "3");
+
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[3]/polygon", "17898,7381 
20172,7381");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[3]/line", "color", 
"#ff");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonstroke[3]/line", "width", "3");
+
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline", 755);
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[10]", "color", "#ff");
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[10]/polygon", 
"27925,14180 27875,14180");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[100]", "color", 
"#008000");
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/polygonhairline[100]/polygon", 
"26100,14414 26050,14414");
+
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion", 69);
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion[1]", "width", "374");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion[1]", "x", "28124");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion[1]", "y", "16581");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion[1]", "text", "0.0");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/textsimpleportion[1]", "fontcolor", 
"#00");
+
+

[Libreoffice-commits] core.git: emfio/qa

2020-03-15 Thread Bartosz Kosiorek (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx   |   26 +++
 emfio/qa/cppunit/emf/data/TestLinearGradient.emf |binary
 2 files changed, 26 insertions(+)

New commits:
commit 1f540cc7613cdbc0048f4013efe43886d256f86b
Author: Bartosz Kosiorek 
AuthorDate: Sun Mar 15 18:09:47 2020 +0100
Commit: Bartosz Kosiorek 
CommitDate: Sun Mar 15 19:20:33 2020 +0100

tdf#124424 EMF+ Add tests for LinearGradient

Change-Id: I85dadb067c4e77b47504dee8bb11b4c15b6ead8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90536
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 2601e0e69f8f..9ce4e15f4965 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -40,6 +40,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void TestDrawString();
 void TestDrawStringTransparent();
 void TestDrawLine();
+void TestLinearGradient();
 
 Primitive2DSequence parseEmf(const OUString& aSource);
 
@@ -49,6 +50,7 @@ public:
 CPPUNIT_TEST(TestDrawString);
 CPPUNIT_TEST(TestDrawStringTransparent);
 CPPUNIT_TEST(TestDrawLine);
+CPPUNIT_TEST(TestLinearGradient);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -155,6 +157,30 @@ void Test::TestDrawLine()
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygonstroke/line", "width", "33");
 }
 
+void Test::TestLinearGradient()
+{
+// This unit checks for a correct import of an EMF+ file with 
LinearGradient brush
+Primitive2DSequence aSequence = 
parseEmf("/emfio/qa/cppunit/emf/data/TestLinearGradient.emf");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+drawinglayer::tools::Primitive2dXmlDump dumper;
+xmlDocPtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/metafile/transform", "xy11", 
"1.656512605");
+assertXPath(pDocument, "/primitive2D/metafile/transform", "xy12", "0");
+assertXPath(pDocument, "/primitive2D/metafile/transform", "xy13", "0");
+assertXPath(pDocument, "/primitive2D/metafile/transform", "xy21", "0");
+assertXPath(pDocument, "/primitive2D/metafile/transform", "xy22", 
"1.00013140604468");
+assertXPath(pDocument, "/primitive2D/metafile/transform", "xy23", "0");
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygon", 
"height", "7610");
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygon", 
"width", "15232");
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygon", 
"path", "m0 0h15232v7610h-15232z");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/svglineargradient[1]", "endx", "0");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/svglineargradient[1]", "endy", "-1");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/svglineargradient[2]", "endx", "0");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/svglineargradient[2]", "endy", "-1");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
diff --git a/emfio/qa/cppunit/emf/data/TestLinearGradient.emf 
b/emfio/qa/cppunit/emf/data/TestLinearGradient.emf
new file mode 100644
index ..fb6e953dc55d
Binary files /dev/null and b/emfio/qa/cppunit/emf/data/TestLinearGradient.emf 
differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: emfio/qa sc/qa sw/qa vcl/qa

2019-07-05 Thread Jan-Marek Glogowski (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx|5 +
 sc/qa/extras/macros-test.cxx  |   11 ---
 sc/qa/unit/subsequent_export-test.cxx |   17 +---
 sw/qa/core/macros-test.cxx|   90 --
 sw/qa/extras/layout/layout.cxx|2 
 sw/qa/extras/odfexport/odfexport.cxx  |4 -
 sw/qa/extras/odfimport/odfimport.cxx  |5 -
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx|3 
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx |4 -
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |   10 --
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx |2 
 sw/qa/extras/rtfexport/rtfexport2.cxx |4 -
 sw/qa/extras/uiwriter/uiwriter.cxx|   62 ++---
 sw/qa/extras/ww8export/ww8export.cxx  |2 
 vcl/qa/cppunit/FontFeatureTest.cxx|8 --
 vcl/qa/cppunit/app/test_IconThemeSelector.cxx |   45 +++--
 vcl/qa/cppunit/complextext.cxx|   37 +++---
 vcl/qa/cppunit/pdfexport/pdfexport.cxx|   45 +
 vcl/qa/cppunit/timer.cxx  |7 --
 19 files changed, 118 insertions(+), 245 deletions(-)

New commits:
commit 3f7e8ddea89f6340cd18b5b34f5a7c5f503962be
Author: Jan-Marek Glogowski 
AuthorDate: Tue Jun 25 19:56:13 2019 +
Commit: Jan-Marek Glogowski 
CommitDate: Fri Jul 5 20:05:59 2019 +0200

Enable many more unit tests on all archs

This depends on commit "Make font-based unit test depend on instdir
fonts, not that it's sure that this really fixes the problem, as its
origin is really unknown.

It especially enables all the font-based tests I could find on all
archs. Same for many more test where I couldn't see any reason they
don't work generally. To get rid of even more ifdefs, it moves these
from the class to the functions, so there is actually just one needed
for any test. As a result some few tests run but do nothing.

There is still some problem with embedded fonts on MacOS and with
delayed graphics loading on Windows, so these ifdefs are kept.

Change-Id: I63f8424e9debda6cbf3e5777c93245e09f8eb0f2
Reviewed-on: https://gerrit.libreoffice.org/74719
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 30add1aec73f..94b4f6acd11f 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -8,6 +8,7 @@
  */
 
 #include 
+#include 
 
 #include 
 #include 
@@ -95,6 +96,7 @@ void Test::testWorking()
 
 void Test::TestDrawString()
 {
+#if HAVE_MORE_FONTS
 // This unit checks for a correct import of an EMF+ file with only one 
DrawString Record
 // Since the text is undecorated the optimal choice is a simpletextportion 
primitive
 
@@ -112,10 +114,12 @@ void Test::TestDrawString()
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/transform/textsimpleportion", "text", "TEST");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/transform/textsimpleportion", "fontcolor", 
"#00");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/transform/textsimpleportion", "familyname", 
"CALIBRI");
+#endif
 }
 
 void Test::TestDrawStringTransparent()
 {
+#if HAVE_MORE_FONTS
 // This unit checks for a correct import of an EMF+ file with one 
DrawString Record with transparency
 
 // first, get the sequence of primitives and dump it
@@ -133,6 +137,7 @@ void Test::TestDrawStringTransparent()
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform/unifiedtransparence/textsimpleportion",
 "text", "Transparent Text");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform/unifiedtransparence/textsimpleportion",
 "fontcolor", "#ff");
 assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/transform/unifiedtransparence/textsimpleportion",
 "familyname", "ARIAL");
+#endif
 }
 
 void Test::TestDrawLine()
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index de71456f1b79..475320d470f9 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -38,29 +38,22 @@ class ScMacrosTest : public UnoApiTest
 public:
 ScMacrosTest();
 
-#if !defined MACOSX
 void testStarBasic();
 void testVba();
 void testMSP();
 void testPasswordProtectedStarBasic();
 void testRowColumn();
-#endif
+
 CPPUNIT_TEST_SUITE(ScMacrosTest);
-#if !defined(MACOSX)
-//enable this test if you want to play with star basic macros in unit tests
-//works but does nothing useful yet
 CPPUNIT_TEST(testStarBasic);
 CPPUNIT_TEST(testMSP);
 CPPUNIT_TEST(testVba);
 CPPUNIT_TEST(testPasswordProtectedStarBasic);
 CPPUNIT_TEST(testRowColumn);
-#endif
 
 CPPUNIT_TEST_SUITE_END();
 };
 
-#if !defined MACOSX
-
 // I suppose you could say this test doesn't really 

[Libreoffice-commits] core.git: emfio/qa filter/qa include/test include/vcl solenv/clang-format sw/qa test/Library_test.mk test/source vcl/Library_vcl.mk vcl/qa vcl/README vcl/source

2019-01-03 Thread Libreoffice Gerrit user
 emfio/qa/cppunit/wmf/wmfimporttest.cxx   |   17 -
 filter/qa/cppunit/filters-pict-test.cxx  |3 +--
 include/test/xmltesttools.hxx|3 +++
 include/vcl/mtfxmldump.hxx   |   16 +---
 solenv/clang-format/blacklist|4 ++--
 sw/qa/extras/layout/layout.cxx   |   17 -
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |3 +--
 sw/qa/extras/uiwriter/uiwriter.cxx   |3 +--
 test/Library_test.mk |1 -
 test/source/xmltesttools.cxx |   10 ++
 vcl/Library_vcl.mk   |1 +
 vcl/README   |6 +-
 vcl/qa/cppunit/svm/svmtest.cxx   |7 +++
 vcl/source/gdi/mtfxmldump.cxx|   23 +--
 14 files changed, 49 insertions(+), 65 deletions(-)

New commits:
commit 66b919c8674066871a06e7cdf5595dc6951524e0
Author: Miklos Vajna 
AuthorDate: Thu Jan 3 11:41:53 2019 +0100
Commit: Miklos Vajna 
CommitDate: Thu Jan 3 15:08:06 2019 +0100

svm xml dumper: move this from test to vcl

This is very useful functionality, this way it can be invoked from the
debugger and/or nested into an outer xml dump (sw/sd doc model dump)
more easily.

Change-Id: If6c83b11d0f3e65fcce71e8d820c6bc354f64d68
Reviewed-on: https://gerrit.libreoffice.org/65834
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx 
b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index 318f6a70826a..5f9de170c595 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -18,7 +18,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -74,7 +73,7 @@ void WmfTest::testNonPlaceableWmf()
 MetafileXmlDump dumper;
 dumper.filterAllActionTypes();
 dumper.filterActionType(MetaActionType::POLYLINE, false);
-xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
 CPPUNIT_ASSERT (pDoc);
 
@@ -103,7 +102,7 @@ void WmfTest::testSine()
 MetafileXmlDump dumper;
 dumper.filterAllActionTypes();
 dumper.filterActionType(MetaActionType::ISECTRECTCLIPREGION, false);
-xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
 CPPUNIT_ASSERT (pDoc);
 
@@ -119,7 +118,7 @@ void WmfTest::testEmfProblem()
 MetafileXmlDump dumper;
 dumper.filterAllActionTypes();
 dumper.filterActionType(MetaActionType::ISECTRECTCLIPREGION, false);
-xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
 CPPUNIT_ASSERT (pDoc);
 
@@ -139,7 +138,7 @@ void WmfTest::testEmfLineStyles()
 dumper.filterAllActionTypes();
 dumper.filterActionType(MetaActionType::LINE, false);
 dumper.filterActionType(MetaActionType::LINECOLOR, false);
-xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
 CPPUNIT_ASSERT (pDoc);
 
@@ -198,7 +197,7 @@ void WmfTest::testWorldTransformFontSize()
 MetafileXmlDump dumper;
 dumper.filterAllActionTypes();
 dumper.filterActionType(MetaActionType::FONT, false);
-xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
 CPPUNIT_ASSERT (pDoc);
 
@@ -226,7 +225,7 @@ void WmfTest::testTdf93750()
 ReadWindowMetafile(aFileStream, aGDIMetaFile);
 
 MetafileXmlDump dumper;
-xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
 CPPUNIT_ASSERT (pDoc);
 
@@ -265,7 +264,7 @@ void WmfTest::testTdf39894()
 ReadWindowMetafile(aFileStream, aGDIMetaFile);
 
 MetafileXmlDump dumper;
-xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
 CPPUNIT_ASSERT(pDoc);
 
@@ -286,7 +285,7 @@ void WmfTest::testETO_PDY()
 ReadWindowMetafile(aFileStream, aGDIMetaFile);
 
 MetafileXmlDump dumper;
-xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
 CPPUNIT_ASSERT(pDoc);
 
diff --git a/filter/qa/cppunit/filters-pict-test.cxx 
b/filter/qa/cppunit/filters-pict-test.cxx
index 9ca3ba5a7e15..4605cf6983f8 100644
--- a/filter/qa/cppunit/filters-pict-test.cxx
+++ b/filter/qa/cppunit/filters-pict-test.cxx
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -86,7 +85,7 @@ void PictFilterTest::testDontClipTooMuch()
 MetafileXmlDump dumper;
 dumper.filterAllActionTypes();
 dumper.filterActionType(MetaActionType::CLIPREGION, false);
-xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
 CPPUNIT_ASSERT (pDoc);
 
diff --git 

[Libreoffice-commits] core.git: emfio/qa test/source

2017-08-24 Thread Patrick Jaap
 emfio/qa/cppunit/emf/EmfImportTest.cxx   |   42 +++
 emfio/qa/cppunit/emf/data/TestDrawLine.emf   |binary
 emfio/qa/cppunit/emf/data/TestDrawString.emf |binary
 test/source/primitive2dxmldump.cxx   |   18 +++
 4 files changed, 60 insertions(+)

New commits:
commit 8d1dc9a662d2e1bc833d5488f3f0013f98e7f3fd
Author: Patrick Jaap 
Date:   Tue Aug 22 12:31:15 2017 +0200

emfio: unit test for the EMF+ renderer

Two unit tests, which test the EMF+ records DrawString and DrawLine
independently.
To this end, a fixed view decomposition of metafiles is implemented.

The chosen primitives should be optimal, even for future extensions
of the EMF+ parser.

Change-Id: I12672d3b294ff0fdae63c7a5ce211517ef8f763c
Reviewed-on: https://gerrit.libreoffice.org/41425
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index ca766b8b67f3..bc14c4bd3062 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -39,12 +39,16 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void checkRectPrimitive(Primitive2DSequence const & rPrimitive);
 
 void testWorking();
+void TestDrawString();
+void TestDrawLine();
 
 Primitive2DSequence parseEmf(const OUString& aSource);
 
 public:
 CPPUNIT_TEST_SUITE(Test);
 CPPUNIT_TEST(testWorking);
+CPPUNIT_TEST(TestDrawString);
+CPPUNIT_TEST(TestDrawLine);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -88,6 +92,44 @@ void Test::testWorking()
 checkRectPrimitive(aSequenceRect);
 }
 
+void Test::TestDrawString()
+{
+// This unit checks for a correct import of an EMF+ file with only one 
DrawString Record
+// Since the text is undecorated the optimal choice is a simpletextportion 
primitive
+
+// first, get the sequence of primitives and dump it
+Primitive2DSequence aSequence = 
parseEmf("/emfio/qa/cppunit/emf/data/TestDrawString.emf");
+CPPUNIT_ASSERT_EQUAL(1, (int) aSequence.getLength());
+Primitive2dXmlDump dumper;
+xmlDocPtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
+CPPUNIT_ASSERT (pDocument);
+
+// check correct import of the DrawString: height, position, text, color 
and font
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion", "height", "276");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion", "x", "25");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion", "y", "323");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion", "text", "TEST");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion", "fontcolor", "#00");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/textsimpleportion", "familyname", "CALIBRI");
+}
+
+void Test::TestDrawLine()
+{
+// This unit checks for a correct import of an EMF+ file with only one 
DrawLine Record
+// The line is colored and has a specified width, therefore a 
polypolygonstroke primitive is the optimal choice
+
+// first, get the sequence of primitives and dump it
+Primitive2DSequence aSequence = 
parseEmf("/emfio/qa/cppunit/emf/data/TestDrawLine.emf");
+CPPUNIT_ASSERT_EQUAL(1, (int) aSequence.getLength());
+Primitive2dXmlDump dumper;
+xmlDocPtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
+CPPUNIT_ASSERT (pDocument);
+
+// check correct import of the DrawLine: color and width of the line
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygonstroke/line", "color", "#00");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/polypolygonstroke/line", "width", "33");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
diff --git a/emfio/qa/cppunit/emf/data/TestDrawLine.emf 
b/emfio/qa/cppunit/emf/data/TestDrawLine.emf
new file mode 100644
index ..89946c523f98
Binary files /dev/null and b/emfio/qa/cppunit/emf/data/TestDrawLine.emf differ
diff --git a/emfio/qa/cppunit/emf/data/TestDrawString.emf 
b/emfio/qa/cppunit/emf/data/TestDrawString.emf
new file mode 100644
index ..c7976f53b3c0
Binary files /dev/null and b/emfio/qa/cppunit/emf/data/TestDrawString.emf differ
diff --git a/test/source/primitive2dxmldump.cxx 
b/test/source/primitive2dxmldump.cxx
index 6523c4c0c971..563fb75acc19 100644
--- a/test/source/primitive2dxmldump.cxx
+++ b/test/source/primitive2dxmldump.cxx
@@ -26,6 +26,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
 
 #include 
 #include 
@@ -190,6 +193,8 @@ void Primitive2dXmlDump::decomposeAndWrite(
 {
 rWriter.attribute("height", aScale.getY());
 }
+