summaryrefslogtreecommitdiff
path: root/emfio/qa/cppunit/wmf
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-10-03 11:40:13 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-10-05 10:06:44 +0200
commita6a69211230226ac8b6c17d016fc19eb8ee11261 (patch)
tree321a5c4a7657baa966185d3757595ff6107d820a /emfio/qa/cppunit/wmf
parent95e2bdf97d987c845927bd44210547fd3c2f2387 (diff)
Use good old string literals in assertXPath and friends
These are only sent to an external API expecting char*-like strings, or for comparison. Having every assertXPath having three of _[ou]str is too much syntactic noise, making the unit tests almost unreadable. Change-Id: Ic004a36ea75e7bfe0b96f405c40f926a957b51cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174416 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'emfio/qa/cppunit/wmf')
-rw-r--r--emfio/qa/cppunit/wmf/wmfimporttest.cxx378
1 files changed, 182 insertions, 196 deletions
diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index 8a3b50d1424e..c7da2ed4ff90 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -96,17 +96,17 @@ void WmfTest::testEOFWmf()
xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/metafile/push"_ostr, 2);
- assertXPath(pDoc, "/metafile/push[2]"_ostr, "flags"_ostr, u"PushClipRegion"_ustr);
- assertXPath(pDoc, "/metafile/push[2]/fillcolor"_ostr, 2);
- assertXPath(pDoc, "/metafile/push[2]/fillcolor[1]"_ostr, "color"_ostr, u"#000000"_ustr);
- assertXPath(pDoc, "/metafile/push[2]/fillcolor[2]"_ostr, "color"_ostr, u"#d0d0d0"_ustr);
- assertXPath(pDoc, "/metafile/push[2]/linecolor"_ostr, 60);
- assertXPath(pDoc, "/metafile/push[2]/polyline"_ostr, 209);
- assertXPath(pDoc, "/metafile/push[2]/polyline[1]/point"_ostr, 5);
- assertXPath(pDoc, "/metafile/push[2]/polyline[1]/point[3]"_ostr, "x"_ostr, u"16906"_ustr);
- assertXPath(pDoc, "/metafile/push[2]/polyline[1]/point[3]"_ostr, "y"_ostr, u"12673"_ustr);
- assertXPath(pDoc, "/metafile/push[2]/textarray"_ostr, 307);
+ assertXPath(pDoc, "/metafile/push", 2);
+ assertXPath(pDoc, "/metafile/push[2]", "flags", u"PushClipRegion");
+ assertXPath(pDoc, "/metafile/push[2]/fillcolor", 2);
+ assertXPath(pDoc, "/metafile/push[2]/fillcolor[1]", "color", u"#000000");
+ assertXPath(pDoc, "/metafile/push[2]/fillcolor[2]", "color", u"#d0d0d0");
+ assertXPath(pDoc, "/metafile/push[2]/linecolor", 60);
+ assertXPath(pDoc, "/metafile/push[2]/polyline", 209);
+ assertXPath(pDoc, "/metafile/push[2]/polyline[1]/point", 5);
+ assertXPath(pDoc, "/metafile/push[2]/polyline[1]/point[3]", "x", u"16906");
+ assertXPath(pDoc, "/metafile/push[2]/polyline[1]/point[3]", "y", u"12673");
+ assertXPath(pDoc, "/metafile/push[2]/textarray", 307);
}
void WmfTest::testNonPlaceableWmf()
@@ -124,20 +124,20 @@ void WmfTest::testNonPlaceableWmf()
CPPUNIT_ASSERT(pDoc);
// These values come from changes done in tdf#88163
- assertXPath(pDoc, "/metafile/polyline[1]/point[1]"_ostr, "x"_ostr, u"16813"_ustr);
- assertXPath(pDoc, "/metafile/polyline[1]/point[1]"_ostr, "y"_ostr, u"1004"_ustr);
+ assertXPath(pDoc, "/metafile/polyline[1]/point[1]", "x", u"16813");
+ assertXPath(pDoc, "/metafile/polyline[1]/point[1]", "y", u"1004");
- assertXPath(pDoc, "/metafile/polyline[1]/point[2]"_ostr, "x"_ostr, u"16813"_ustr);
- assertXPath(pDoc, "/metafile/polyline[1]/point[2]"_ostr, "y"_ostr, u"7514"_ustr);
+ assertXPath(pDoc, "/metafile/polyline[1]/point[2]", "x", u"16813");
+ assertXPath(pDoc, "/metafile/polyline[1]/point[2]", "y", u"7514");
- assertXPath(pDoc, "/metafile/polyline[1]/point[3]"_ostr, "x"_ostr, u"26112"_ustr);
- assertXPath(pDoc, "/metafile/polyline[1]/point[3]"_ostr, "y"_ostr, u"7514"_ustr);
+ assertXPath(pDoc, "/metafile/polyline[1]/point[3]", "x", u"26112");
+ assertXPath(pDoc, "/metafile/polyline[1]/point[3]", "y", u"7514");
- assertXPath(pDoc, "/metafile/polyline[1]/point[4]"_ostr, "x"_ostr, u"26112"_ustr);
- assertXPath(pDoc, "/metafile/polyline[1]/point[4]"_ostr, "y"_ostr, u"1004"_ustr);
+ assertXPath(pDoc, "/metafile/polyline[1]/point[4]", "x", u"26112");
+ assertXPath(pDoc, "/metafile/polyline[1]/point[4]", "y", u"1004");
- assertXPath(pDoc, "/metafile/polyline[1]/point[5]"_ostr, "x"_ostr, u"16813"_ustr);
- assertXPath(pDoc, "/metafile/polyline[1]/point[5]"_ostr, "y"_ostr, u"1004"_ustr);
+ assertXPath(pDoc, "/metafile/polyline[1]/point[5]", "x", u"16813");
+ assertXPath(pDoc, "/metafile/polyline[1]/point[5]", "y", u"1004");
}
void WmfTest::testTdf88163NonPlaceableWmf()
@@ -156,23 +156,23 @@ void WmfTest::testTdf88163NonPlaceableWmf()
// Fails without the fix
// With fix: 3272, without fix: ~ 8000
- auto x = getXPath(pDoc, "/metafile/push[2]/font[1]"_ostr, "height"_ostr);
+ auto x = getXPath(pDoc, "/metafile/push[2]/font[1]", "height");
CPPUNIT_ASSERT_EQUAL(sal_Int32(3272), x.toInt32());
// Fails without the fix: Expected: 7359, Actual: 7336
- assertXPath(pDoc, "/metafile/push[2]/textarray[1]"_ostr, "x"_ostr, u"7359"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[1]", "x", u"7359");
// Fails without the fix: Expected: 4118, Actual: 4104
- assertXPath(pDoc, "/metafile/push[2]/textarray[1]"_ostr, "y"_ostr, u"4118"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[1]", "y", u"4118");
// Fails without the fix: Expected: 5989, Actual: 5971
- assertXPath(pDoc, "/metafile/push[2]/textarray[2]"_ostr, "x"_ostr, u"5989"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[2]", "x", u"5989");
// Fails without the fix: Expected: 16264, Actual: 16208
- assertXPath(pDoc, "/metafile/push[2]/textarray[2]"_ostr, "y"_ostr, u"16264"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[2]", "y", u"16264");
// Fails without the fix: Expected: 20769, Actual: 20705
- assertXPath(pDoc, "/metafile/push[2]/textarray[3]"_ostr, "x"_ostr, u"20769"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[3]", "x", u"20769");
// Fails without the fix: Expected: 4077, Actual: 4062
- assertXPath(pDoc, "/metafile/push[2]/textarray[3]"_ostr, "y"_ostr, u"4077"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[3]", "y", u"4077");
}
void WmfTest::testTdf88163PlaceableWmf()
@@ -191,26 +191,26 @@ void WmfTest::testTdf88163PlaceableWmf()
// These values come from the fix for tdf#88163
// The fix does not affect the font size
- auto x = getXPath(pDoc, "/metafile/push[2]/font[1]"_ostr, "height"_ostr);
+ auto x = getXPath(pDoc, "/metafile/push[2]/font[1]", "height");
CPPUNIT_ASSERT_EQUAL(sal_Int32(313), x.toInt32());
// Fails without the fix: Expected: 1900, Actual: 19818
- assertXPath(pDoc, "/metafile"_ostr, "height"_ostr, u"1900"_ustr);
+ assertXPath(pDoc, "/metafile", "height", u"1900");
// Fails without the fix: Expected: 704, Actual: 7336
- assertXPath(pDoc, "/metafile/push[2]/textarray[1]"_ostr, "x"_ostr, u"704"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[1]", "x", u"704");
// Fails without the fix: Expected: 394, Actual: 4110
- assertXPath(pDoc, "/metafile/push[2]/textarray[1]"_ostr, "y"_ostr, u"394"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[1]", "y", u"394");
// Fails without the fix: Expected: 573, Actual: 5971
- assertXPath(pDoc, "/metafile/push[2]/textarray[2]"_ostr, "x"_ostr, u"573"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[2]", "x", u"573");
// Fails without the fix: Expected: 1556, Actual: 16230
- assertXPath(pDoc, "/metafile/push[2]/textarray[2]"_ostr, "y"_ostr, u"1556"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[2]", "y", u"1556");
// Fails without the fix: Expected: 1987, Actual: 20706
- assertXPath(pDoc, "/metafile/push[2]/textarray[3]"_ostr, "x"_ostr, u"1987"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[3]", "x", u"1987");
// Fails without the fix: Expected: 390, Actual: 4068
- assertXPath(pDoc, "/metafile/push[2]/textarray[3]"_ostr, "y"_ostr, u"390"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[3]", "y", u"390");
}
void WmfTest::testSetTextAlignWmf()
@@ -226,94 +226,80 @@ void WmfTest::testSetTextAlignWmf()
CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/metafile"_ostr, "height"_ostr, u"20999"_ustr);
+ assertXPath(pDoc, "/metafile", "height", u"20999");
- assertXPath(pDoc, "/metafile/push[2]/textalign[2]"_ostr, "align"_ostr, u"top"_ustr);
- assertXPath(pDoc, "/metafile/push[2]/textarray[2]"_ostr, "x"_ostr, u"11642"_ustr);
- assertXPath(pDoc, "/metafile/push[2]/textarray[2]"_ostr, "y"_ostr, u"212"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[2]/text"_ostr,
- u"textalignment:default"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textalign[2]", "align", u"top");
+ assertXPath(pDoc, "/metafile/push[2]/textarray[2]", "x", u"11642");
+ assertXPath(pDoc, "/metafile/push[2]/textarray[2]", "y", u"212");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[2]/text", u"textalignment:default");
- assertXPath(pDoc, "/metafile/push[2]/textalign[3]"_ostr, "align"_ostr, u"top"_ustr);
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[3]"_ostr, "x"_ostr, 12700, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[3]"_ostr, "y"_ostr, u"212"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[3]/text"_ostr,
- u"textalignment:0x00"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textalign[3]", "align", u"top");
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[3]", "x", 12700, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[3]", "y", u"212");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[3]/text", u"textalignment:0x00");
- assertXPath(pDoc, "/metafile/push[2]/textalign[4]"_ostr, "align"_ostr, u"top"_ustr);
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[4]"_ostr, "x"_ostr, 12026, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[4]"_ostr, "y"_ostr, u"423"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[4]/text"_ostr,
- u"textalignment:0x02"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textalign[4]", "align", u"top");
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[4]", "x", 12026, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[4]", "y", u"423");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[4]/text", u"textalignment:0x02");
- assertXPath(pDoc, "/metafile/push[2]/textalign[5]"_ostr, "align"_ostr, u"top"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/textalign[5]", "align", u"top");
// Fails without the fix: Expected: 12026, Actual: 12350
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[5]"_ostr, "x"_ostr, 12026, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[5]"_ostr, "y"_ostr, u"635"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[5]/text"_ostr,
- u"textalignment:0x04"_ustr);
-
- assertXPath(pDoc, "/metafile/push[2]/textalign[6]"_ostr, "align"_ostr, u"top"_ustr);
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[6]"_ostr, "x"_ostr, 12363, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[6]"_ostr, "y"_ostr, u"847"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[6]/text"_ostr,
- u"textalignment:0x06"_ustr);
-
- assertXPath(pDoc, "/metafile/push[2]/textalign[7]"_ostr, "align"_ostr, u"top"_ustr);
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[7]"_ostr, "x"_ostr, 12700, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[7]"_ostr, "y"_ostr, u"1058"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[7]/text"_ostr,
- u"textalignment:0x08"_ustr);
-
- assertXPath(pDoc, "/metafile/push[2]/textalign[8]"_ostr, "align"_ostr, u"top"_ustr);
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[8]"_ostr, "x"_ostr, 12026, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[8]"_ostr, "y"_ostr, u"1270"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[8]/text"_ostr,
- u"textalignment:0x0A"_ustr);
-
- assertXPath(pDoc, "/metafile/push[2]/textalign[9]"_ostr, "align"_ostr, u"bottom"_ustr);
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[5]", "x", 12026, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[5]", "y", u"635");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[5]/text", u"textalignment:0x04");
+
+ assertXPath(pDoc, "/metafile/push[2]/textalign[6]", "align", u"top");
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[6]", "x", 12363, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[6]", "y", u"847");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[6]/text", u"textalignment:0x06");
+
+ assertXPath(pDoc, "/metafile/push[2]/textalign[7]", "align", u"top");
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[7]", "x", 12700, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[7]", "y", u"1058");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[7]/text", u"textalignment:0x08");
+
+ assertXPath(pDoc, "/metafile/push[2]/textalign[8]", "align", u"top");
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[8]", "x", 12026, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[8]", "y", u"1270");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[8]/text", u"textalignment:0x0A");
+
+ assertXPath(pDoc, "/metafile/push[2]/textalign[9]", "align", u"bottom");
// Fails without the fix: Expected: 12026, Actual: 12350
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[9]"_ostr, "x"_ostr, 12026, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[9]"_ostr, "y"_ostr, u"1482"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[9]/text"_ostr,
- u"textalignment:0x0C"_ustr);
-
- assertXPath(pDoc, "/metafile/push[2]/textalign[10]"_ostr, "align"_ostr, u"bottom"_ustr);
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[10]"_ostr, "x"_ostr, 12363, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[10]"_ostr, "y"_ostr, u"1693"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[10]/text"_ostr,
- u"textalignment:0x0E"_ustr);
-
- assertXPath(pDoc, "/metafile/push[2]/textalign[11]"_ostr, "align"_ostr, u"bottom"_ustr);
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[11]"_ostr, "x"_ostr, 12700, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[11]"_ostr, "y"_ostr, u"1905"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[11]/text"_ostr,
- u"textalignment:0x10"_ustr);
-
- assertXPath(pDoc, "/metafile/push[2]/textalign[12]"_ostr, "align"_ostr, u"bottom"_ustr);
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[12]"_ostr, "x"_ostr, 12026, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[12]"_ostr, "y"_ostr, u"2117"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[12]/text"_ostr,
- u"textalignment:0x12"_ustr);
-
- assertXPath(pDoc, "/metafile/push[2]/textalign[13]"_ostr, "align"_ostr, u"bottom"_ustr);
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[9]", "x", 12026, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[9]", "y", u"1482");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[9]/text", u"textalignment:0x0C");
+
+ assertXPath(pDoc, "/metafile/push[2]/textalign[10]", "align", u"bottom");
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[10]", "x", 12363, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[10]", "y", u"1693");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[10]/text", u"textalignment:0x0E");
+
+ assertXPath(pDoc, "/metafile/push[2]/textalign[11]", "align", u"bottom");
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[11]", "x", 12700, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[11]", "y", u"1905");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[11]/text", u"textalignment:0x10");
+
+ assertXPath(pDoc, "/metafile/push[2]/textalign[12]", "align", u"bottom");
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[12]", "x", 12026, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[12]", "y", u"2117");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[12]/text", u"textalignment:0x12");
+
+ assertXPath(pDoc, "/metafile/push[2]/textalign[13]", "align", u"bottom");
// Fails without the fix: Expected: 12026, Actual: 12350
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[13]"_ostr, "x"_ostr, 12026, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[13]"_ostr, "y"_ostr, u"2328"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[13]/text"_ostr,
- u"textalignment:0x14"_ustr);
-
- assertXPath(pDoc, "/metafile/push[2]/textalign[14]"_ostr, "align"_ostr, u"bottom"_ustr);
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[14]"_ostr, "x"_ostr, 12363, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[14]"_ostr, "y"_ostr, u"2540"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[14]/text"_ostr,
- u"textalignment:0x16"_ustr);
-
- assertXPath(pDoc, "/metafile/push[2]/textalign[15]"_ostr, "align"_ostr, u"bottom"_ustr);
- assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[15]"_ostr, "x"_ostr, 12700, 30);
- assertXPath(pDoc, "/metafile/push[2]/textarray[15]"_ostr, "y"_ostr, u"2752"_ustr);
- assertXPathContent(pDoc, "/metafile/push[2]/textarray[15]/text"_ostr,
- u"textalignment:0x18"_ustr);
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[13]", "x", 12026, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[13]", "y", u"2328");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[13]/text", u"textalignment:0x14");
+
+ assertXPath(pDoc, "/metafile/push[2]/textalign[14]", "align", u"bottom");
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[14]", "x", 12363, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[14]", "y", u"2540");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[14]/text", u"textalignment:0x16");
+
+ assertXPath(pDoc, "/metafile/push[2]/textalign[15]", "align", u"bottom");
+ assertXPathDoubleValue(pDoc, "/metafile/push[2]/textarray[15]", "x", 12700, 30);
+ assertXPath(pDoc, "/metafile/push[2]/textarray[15]", "y", u"2752");
+ assertXPathContent(pDoc, "/metafile/push[2]/textarray[15]/text", u"textalignment:0x18");
}
void WmfTest::testSine()
@@ -329,7 +315,7 @@ void WmfTest::testSine()
CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/metafile/sectrectclipregion"_ostr, 0);
+ assertXPath(pDoc, "/metafile/sectrectclipregion", 0);
}
void WmfTest::testEmfProblem()
@@ -345,11 +331,11 @@ void WmfTest::testEmfProblem()
CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/metafile/sectrectclipregion"_ostr, 2);
- assertXPath(pDoc, "/metafile/sectrectclipregion[1]"_ostr, "top"_ostr, u"2125"_ustr);
- assertXPath(pDoc, "/metafile/sectrectclipregion[1]"_ostr, "left"_ostr, u"1084"_ustr);
- assertXPath(pDoc, "/metafile/sectrectclipregion[1]"_ostr, "bottom"_ostr, u"2927"_ustr);
- assertXPath(pDoc, "/metafile/sectrectclipregion[1]"_ostr, "right"_ostr, u"2376"_ustr);
+ assertXPath(pDoc, "/metafile/sectrectclipregion", 2);
+ assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "top", u"2125");
+ assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "left", u"1084");
+ assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "bottom", u"2927");
+ assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "right", u"2376");
}
void WmfTest::testEmfLineStyles()
@@ -366,50 +352,50 @@ void WmfTest::testEmfLineStyles()
CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/metafile/line"_ostr, 4);
- assertXPath(pDoc, "/metafile/linecolor"_ostr, 5);
-
- assertXPath(pDoc, "/metafile/linecolor[1]"_ostr, "color"_ostr, u"#ffffff"_ustr);
- assertXPath(pDoc, "/metafile/linecolor[2]"_ostr, "color"_ostr, u"#00ff00"_ustr);
- assertXPath(pDoc, "/metafile/linecolor[3]"_ostr, "color"_ostr, u"#408080"_ustr);
- assertXPath(pDoc, "/metafile/linecolor[4]"_ostr, "color"_ostr, u"#ff0000"_ustr);
- assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, u"#0000ff"_ustr);
-
- assertXPath(pDoc, "/metafile/line[1]"_ostr, "style"_ostr, u"dash"_ustr);
- assertXPath(pDoc, "/metafile/line[1]"_ostr, "dashlen"_ostr, u"528"_ustr);
- assertXPath(pDoc, "/metafile/line[1]"_ostr, "dashcount"_ostr, u"1"_ustr);
- assertXPath(pDoc, "/metafile/line[1]"_ostr, "dotlen"_ostr, u"176"_ustr);
- assertXPath(pDoc, "/metafile/line[1]"_ostr, "dotcount"_ostr, u"0"_ustr);
- assertXPath(pDoc, "/metafile/line[1]"_ostr, "distance"_ostr, u"176"_ustr);
- assertXPath(pDoc, "/metafile/line[1]"_ostr, "join"_ostr, u"miter"_ustr);
- assertXPath(pDoc, "/metafile/line[1]"_ostr, "cap"_ostr, u"butt"_ustr);
-
- assertXPath(pDoc, "/metafile/line[2]"_ostr, "style"_ostr, u"dash"_ustr);
- assertXPath(pDoc, "/metafile/line[2]"_ostr, "dashlen"_ostr, u"528"_ustr);
- assertXPath(pDoc, "/metafile/line[2]"_ostr, "dashcount"_ostr, u"0"_ustr);
- assertXPath(pDoc, "/metafile/line[2]"_ostr, "dotlen"_ostr, u"176"_ustr);
- assertXPath(pDoc, "/metafile/line[2]"_ostr, "dotcount"_ostr, u"1"_ustr);
- assertXPath(pDoc, "/metafile/line[2]"_ostr, "distance"_ostr, u"176"_ustr);
- assertXPath(pDoc, "/metafile/line[2]"_ostr, "join"_ostr, u"miter"_ustr);
- assertXPath(pDoc, "/metafile/line[2]"_ostr, "cap"_ostr, u"butt"_ustr);
-
- assertXPath(pDoc, "/metafile/line[3]"_ostr, "style"_ostr, u"dash"_ustr);
- assertXPath(pDoc, "/metafile/line[3]"_ostr, "dashlen"_ostr, u"528"_ustr);
- assertXPath(pDoc, "/metafile/line[3]"_ostr, "dashcount"_ostr, u"1"_ustr);
- assertXPath(pDoc, "/metafile/line[3]"_ostr, "dotlen"_ostr, u"176"_ustr);
- assertXPath(pDoc, "/metafile/line[3]"_ostr, "dotcount"_ostr, u"1"_ustr);
- assertXPath(pDoc, "/metafile/line[3]"_ostr, "distance"_ostr, u"176"_ustr);
- assertXPath(pDoc, "/metafile/line[3]"_ostr, "join"_ostr, u"miter"_ustr);
- assertXPath(pDoc, "/metafile/line[3]"_ostr, "cap"_ostr, u"butt"_ustr);
-
- assertXPath(pDoc, "/metafile/line[4]"_ostr, "style"_ostr, u"dash"_ustr);
- assertXPath(pDoc, "/metafile/line[4]"_ostr, "dashlen"_ostr, u"528"_ustr);
- assertXPath(pDoc, "/metafile/line[4]"_ostr, "dashcount"_ostr, u"1"_ustr);
- assertXPath(pDoc, "/metafile/line[4]"_ostr, "dotlen"_ostr, u"176"_ustr);
- assertXPath(pDoc, "/metafile/line[4]"_ostr, "dotcount"_ostr, u"2"_ustr);
- assertXPath(pDoc, "/metafile/line[4]"_ostr, "distance"_ostr, u"176"_ustr);
- assertXPath(pDoc, "/metafile/line[4]"_ostr, "join"_ostr, u"miter"_ustr);
- assertXPath(pDoc, "/metafile/line[4]"_ostr, "cap"_ostr, u"butt"_ustr);
+ assertXPath(pDoc, "/metafile/line", 4);
+ assertXPath(pDoc, "/metafile/linecolor", 5);
+
+ assertXPath(pDoc, "/metafile/linecolor[1]", "color", u"#ffffff");
+ assertXPath(pDoc, "/metafile/linecolor[2]", "color", u"#00ff00");
+ assertXPath(pDoc, "/metafile/linecolor[3]", "color", u"#408080");
+ assertXPath(pDoc, "/metafile/linecolor[4]", "color", u"#ff0000");
+ assertXPath(pDoc, "/metafile/linecolor[5]", "color", u"#0000ff");
+
+ assertXPath(pDoc, "/metafile/line[1]", "style", u"dash");
+ assertXPath(pDoc, "/metafile/line[1]", "dashlen", u"528");
+ assertXPath(pDoc, "/metafile/line[1]", "dashcount", u"1");
+ assertXPath(pDoc, "/metafile/line[1]", "dotlen", u"176");
+ assertXPath(pDoc, "/metafile/line[1]", "dotcount", u"0");
+ assertXPath(pDoc, "/metafile/line[1]", "distance", u"176");
+ assertXPath(pDoc, "/metafile/line[1]", "join", u"miter");
+ assertXPath(pDoc, "/metafile/line[1]", "cap", u"butt");
+
+ assertXPath(pDoc, "/metafile/line[2]", "style", u"dash");
+ assertXPath(pDoc, "/metafile/line[2]", "dashlen", u"528");
+ assertXPath(pDoc, "/metafile/line[2]", "dashcount", u"0");
+ assertXPath(pDoc, "/metafile/line[2]", "dotlen", u"176");
+ assertXPath(pDoc, "/metafile/line[2]", "dotcount", u"1");
+ assertXPath(pDoc, "/metafile/line[2]", "distance", u"176");
+ assertXPath(pDoc, "/metafile/line[2]", "join", u"miter");
+ assertXPath(pDoc, "/metafile/line[2]", "cap", u"butt");
+
+ assertXPath(pDoc, "/metafile/line[3]", "style", u"dash");
+ assertXPath(pDoc, "/metafile/line[3]", "dashlen", u"528");
+ assertXPath(pDoc, "/metafile/line[3]", "dashcount", u"1");
+ assertXPath(pDoc, "/metafile/line[3]", "dotlen", u"176");
+ assertXPath(pDoc, "/metafile/line[3]", "dotcount", u"1");
+ assertXPath(pDoc, "/metafile/line[3]", "distance", u"176");
+ assertXPath(pDoc, "/metafile/line[3]", "join", u"miter");
+ assertXPath(pDoc, "/metafile/line[3]", "cap", u"butt");
+
+ assertXPath(pDoc, "/metafile/line[4]", "style", u"dash");
+ assertXPath(pDoc, "/metafile/line[4]", "dashlen", u"528");
+ assertXPath(pDoc, "/metafile/line[4]", "dashcount", u"1");
+ assertXPath(pDoc, "/metafile/line[4]", "dotlen", u"176");
+ assertXPath(pDoc, "/metafile/line[4]", "dotcount", u"2");
+ assertXPath(pDoc, "/metafile/line[4]", "distance", u"176");
+ assertXPath(pDoc, "/metafile/line[4]", "join", u"miter");
+ assertXPath(pDoc, "/metafile/line[4]", "cap", u"butt");
};
void WmfTest::testWorldTransformFontSize()
@@ -425,27 +411,27 @@ void WmfTest::testWorldTransformFontSize()
CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/metafile/font"_ostr, 9);
+ assertXPath(pDoc, "/metafile/font", 9);
- assertXPath(pDoc, "/metafile/font[1]"_ostr, "color"_ostr, u"#595959"_ustr);
- assertXPath(pDoc, "/metafile/font[1]"_ostr, "width"_ostr, u"0"_ustr);
- assertXPath(pDoc, "/metafile/font[1]"_ostr, "height"_ostr, u"389"_ustr);
- assertXPath(pDoc, "/metafile/font[1]"_ostr, "orientation"_ostr, u"0"_ustr);
- assertXPath(pDoc, "/metafile/font[1]"_ostr, "weight"_ostr, u"bold"_ustr);
+ assertXPath(pDoc, "/metafile/font[1]", "color", u"#595959");
+ assertXPath(pDoc, "/metafile/font[1]", "width", u"0");
+ assertXPath(pDoc, "/metafile/font[1]", "height", u"389");
+ assertXPath(pDoc, "/metafile/font[1]", "orientation", u"0");
+ assertXPath(pDoc, "/metafile/font[1]", "weight", u"bold");
- assertXPath(pDoc, "/metafile/font[3]"_ostr, "color"_ostr, u"#000000"_ustr);
- assertXPath(pDoc, "/metafile/font[3]"_ostr, "width"_ostr, u"0"_ustr);
- assertXPath(pDoc, "/metafile/font[3]"_ostr, "height"_ostr, u"389"_ustr);
- assertXPath(pDoc, "/metafile/font[3]"_ostr, "orientation"_ostr, u"0"_ustr);
- assertXPath(pDoc, "/metafile/font[3]"_ostr, "weight"_ostr, u"bold"_ustr);
+ assertXPath(pDoc, "/metafile/font[3]", "color", u"#000000");
+ assertXPath(pDoc, "/metafile/font[3]", "width", u"0");
+ assertXPath(pDoc, "/metafile/font[3]", "height", u"389");
+ assertXPath(pDoc, "/metafile/font[3]", "orientation", u"0");
+ assertXPath(pDoc, "/metafile/font[3]", "weight", u"bold");
// World transform should not affect font size. Rotating text for 90 degrees
// should not exchange font width and height.
- assertXPath(pDoc, "/metafile/font[4]"_ostr, "color"_ostr, u"#000000"_ustr);
- assertXPath(pDoc, "/metafile/font[4]"_ostr, "width"_ostr, u"0"_ustr);
- assertXPath(pDoc, "/metafile/font[4]"_ostr, "height"_ostr, u"530"_ustr);
- assertXPath(pDoc, "/metafile/font[4]"_ostr, "orientation"_ostr, u"900"_ustr);
- assertXPath(pDoc, "/metafile/font[4]"_ostr, "weight"_ostr, u"normal"_ustr);
+ assertXPath(pDoc, "/metafile/font[4]", "color", u"#000000");
+ assertXPath(pDoc, "/metafile/font[4]", "width", u"0");
+ assertXPath(pDoc, "/metafile/font[4]", "height", u"530");
+ assertXPath(pDoc, "/metafile/font[4]", "orientation", u"900");
+ assertXPath(pDoc, "/metafile/font[4]", "weight", u"normal");
}
void WmfTest::testBigPPI()
@@ -465,8 +451,8 @@ void WmfTest::testBigPPI()
// If the PPI was not reduced the width and height would be <100 which is too small
// Related: tdf#150888
- assertXPath(pDoc, "/metafile"_ostr, "width"_ostr, u"2540"_ustr);
- assertXPath(pDoc, "/metafile"_ostr, "height"_ostr, u"2143"_ustr);
+ assertXPath(pDoc, "/metafile", "width", u"2540");
+ assertXPath(pDoc, "/metafile", "height", u"2143");
}
void WmfTest::testTdf93750()
@@ -480,8 +466,8 @@ void WmfTest::testTdf93750()
CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/metafile/push[1]/comment[2]"_ostr, "datasize"_ostr, u"28"_ustr);
- assertXPath(pDoc, "/metafile/push[1]/comment[3]"_ostr, "datasize"_ostr, u"72"_ustr);
+ assertXPath(pDoc, "/metafile/push[1]/comment[2]", "datasize", u"28");
+ assertXPath(pDoc, "/metafile/push[1]/comment[3]", "datasize", u"72");
}
void WmfTest::testTdf99402()
@@ -518,7 +504,7 @@ void WmfTest::testTdf39894Wmf()
// 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]"_ostr, "x"_ostr);
+ auto x = getXPath(pDoc, "/metafile/push[2]/textarray[2]", "x");
CPPUNIT_ASSERT_GREATER(sal_Int32(2700), x.toInt32());
}
@@ -535,7 +521,7 @@ void WmfTest::testTdf39894Emf()
// 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]"_ostr, "x"_ostr);
+ auto x = getXPath(pDoc, "/metafile/push[2]/textarray[2]", "x");
CPPUNIT_ASSERT_GREATER(sal_Int32(2700), x.toInt32());
}
@@ -552,9 +538,9 @@ void WmfTest::testETO_PDYWmf()
// The y position of following text
// must be smaller than that of previous
- auto y1 = getXPath(pDoc, "/metafile/push[2]/textarray[1]"_ostr, "y"_ostr);
- auto y2 = getXPath(pDoc, "/metafile/push[2]/textarray[2]"_ostr, "y"_ostr);
- auto y3 = getXPath(pDoc, "/metafile/push[2]/textarray[3]"_ostr, "y"_ostr);
+ 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(y2.toInt32() < y1.toInt32());
CPPUNIT_ASSERT(y3.toInt32() < y2.toInt32());
}
@@ -572,9 +558,9 @@ void WmfTest::testETO_PDYEmf()
// The y position of following text
// must be smaller than that of previous
- auto y1 = getXPath(pDoc, "/metafile/push[2]/textarray[1]"_ostr, "y"_ostr);
- auto y2 = getXPath(pDoc, "/metafile/push[2]/textarray[2]"_ostr, "y"_ostr);
- auto y3 = getXPath(pDoc, "/metafile/push[2]/textarray[3]"_ostr, "y"_ostr);
+ 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(y2.toInt32() < y1.toInt32());
CPPUNIT_ASSERT(y3.toInt32() < y2.toInt32());
}
@@ -594,7 +580,7 @@ void WmfTest::testStockObject()
// - Expected: 1
// - Actual : 0
// - In <>, XPath '/metafile/push[2]/fillcolor[2]' number of nodes is incorrect
- assertXPath(pDoc, "/metafile/push[2]/fillcolor[2]"_ostr, "color"_ostr, u"#000000"_ustr);
+ assertXPath(pDoc, "/metafile/push[2]/fillcolor[2]", "color", u"#000000");
}
CPPUNIT_TEST_SUITE_REGISTRATION(WmfTest);