diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-10-03 11:40:13 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-10-05 10:06:44 +0200 |
commit | a6a69211230226ac8b6c17d016fc19eb8ee11261 (patch) | |
tree | 321a5c4a7657baa966185d3757595ff6107d820a /oox | |
parent | 95e2bdf97d987c845927bd44210547fd3c2f2387 (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 'oox')
-rw-r--r-- | oox/qa/unit/export.cxx | 709 | ||||
-rw-r--r-- | oox/qa/unit/mcgr.cxx | 48 | ||||
-rw-r--r-- | oox/qa/unit/testscene3d.cxx | 18 |
3 files changed, 374 insertions, 401 deletions
diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 36ab2a4acfa5..aff4a634bcda 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -40,16 +40,14 @@ CPPUNIT_TEST_FIXTURE(Test, testPolylineConnectorPosition) // to group instead of being relative to anchor. That was missing for polyline and // connector. // Polyline: Without fix it would have failed with expected: 0, actual: 1800360 - assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off"_ostr, "x"_ostr, u"0"_ustr); + assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off", "x", u"0"); // ... failed with expected: 509400, actual: 1229400 - assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off"_ostr, "y"_ostr, - u"509400"_ustr); + assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off", "y", u"509400"); // Connector: Without fix it would have failed with expected: 763200, actual: 2563560 - assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[3]/wps:spPr/a:xfrm/a:off"_ostr, "x"_ostr, - u"763200"_ustr); + assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[3]/wps:spPr/a:xfrm/a:off", "x", u"763200"); // ... failed with expected: 0, actual: 720000 - assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[3]/wps:spPr/a:xfrm/a:off"_ostr, "y"_ostr, u"0"_ustr); + assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[3]/wps:spPr/a:xfrm/a:off", "y", u"0"); // Polyline and connector were shifted 1800360EMU right, 720000EMU down. } @@ -72,8 +70,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRotatedShapePosition) // DrawingML::WriteShapeTransformation(), but was missing. // Without fix it would have failed with expected: 469440, actual: 92160 // The shape was about 1cm shifted up and partly outside its group. - assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off"_ostr, "y"_ostr, - u"469440"_ustr); + assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off", "y", u"469440"); } CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControlOdt) @@ -145,11 +142,11 @@ CPPUNIT_TEST_FIXTURE(Test, testDmlGroupshapePolygon) // Then make sure that the group shape, the group shape's child size and the child shape's size // match: xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); - assertXPath(pXmlDoc, "//wpg:grpSpPr/a:xfrm/a:ext"_ostr, "cx"_ostr, u"5328360"_ustr); + assertXPath(pXmlDoc, "//wpg:grpSpPr/a:xfrm/a:ext", "cx", u"5328360"); // Without the accompanying fix in place, this test would have failed, the <a:chExt> element was // not written. - assertXPath(pXmlDoc, "//wpg:grpSpPr/a:xfrm/a:chExt"_ostr, "cx"_ostr, u"5328360"_ustr); - assertXPath(pXmlDoc, "//wps:spPr/a:xfrm/a:ext"_ostr, "cx"_ostr, u"5328360"_ustr); + assertXPath(pXmlDoc, "//wpg:grpSpPr/a:xfrm/a:chExt", "cx", u"5328360"); + assertXPath(pXmlDoc, "//wps:spPr/a:xfrm/a:ext", "cx", u"5328360"); } CPPUNIT_TEST_FIXTURE(Test, testCustomShapeArrowExport) @@ -171,174 +168,174 @@ CPPUNIT_TEST_FIXTURE(Test, testCustomShapeArrowExport) // Right arrow assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom"_ostr, - "prst"_ostr, u"rightArrow"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom", + "prst", u"rightArrow"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]"_ostr, - "fmla"_ostr, u"val 50000"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", + "fmla", u"val 50000"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]"_ostr, - "fmla"_ostr, u"val 46321"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", + "fmla", u"val 46321"); // Left arrow assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom"_ostr, - "prst"_ostr, u"leftArrow"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom", + "prst", u"leftArrow"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]"_ostr, - "fmla"_ostr, u"val 50000"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", + "fmla", u"val 50000"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]"_ostr, - "fmla"_ostr, u"val 52939"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", + "fmla", u"val 52939"); // Down arrow assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom"_ostr, - "prst"_ostr, u"downArrow"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom", + "prst", u"downArrow"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]"_ostr, - "fmla"_ostr, u"val 50000"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", + "fmla", u"val 50000"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]"_ostr, - "fmla"_ostr, u"val 59399"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", + "fmla", u"val 59399"); // Up arrow assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom"_ostr, - "prst"_ostr, u"upArrow"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom", + "prst", u"upArrow"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]"_ostr, - "fmla"_ostr, u"val 50000"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", + "fmla", u"val 50000"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]"_ostr, - "fmla"_ostr, u"val 63885"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", + "fmla", u"val 63885"); // Left-right arrow assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[5]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom"_ostr, - "prst"_ostr, u"leftRightArrow"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom", + "prst", u"leftRightArrow"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[5]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]"_ostr, - "fmla"_ostr, u"val 50000"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", + "fmla", u"val 50000"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[5]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]"_ostr, - "fmla"_ostr, u"val 53522"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", + "fmla", u"val 53522"); // Up-down arrow assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[6]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom"_ostr, - "prst"_ostr, u"upDownArrow"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom", + "prst", u"upDownArrow"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[6]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]"_ostr, - "fmla"_ostr, u"val 50000"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", + "fmla", u"val 50000"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[6]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]"_ostr, - "fmla"_ostr, u"val 62743"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", + "fmla", u"val 62743"); // Right arrow callout assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[7]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom"_ostr, - "prst"_ostr, u"rightArrowCallout"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom", + "prst", u"rightArrowCallout"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[7]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]"_ostr, - "fmla"_ostr, u"val 25002"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", + "fmla", u"val 25002"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[7]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]"_ostr, - "fmla"_ostr, u"val 25000"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", + "fmla", u"val 25000"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[7]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[3]"_ostr, - "fmla"_ostr, u"val 25052"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[3]", + "fmla", u"val 25052"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[7]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[4]"_ostr, - "fmla"_ostr, u"val 66667"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[4]", + "fmla", u"val 66667"); // Left arrow callout assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[8]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom"_ostr, - "prst"_ostr, u"leftArrowCallout"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom", + "prst", u"leftArrowCallout"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[8]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]"_ostr, - "fmla"_ostr, u"val 25002"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", + "fmla", u"val 25002"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[8]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]"_ostr, - "fmla"_ostr, u"val 25000"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", + "fmla", u"val 25000"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[8]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[3]"_ostr, - "fmla"_ostr, u"val 25057"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[3]", + "fmla", u"val 25057"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[8]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[4]"_ostr, - "fmla"_ostr, u"val 66673"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[4]", + "fmla", u"val 66673"); // Down arrow callout assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[9]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom"_ostr, - "prst"_ostr, u"downArrowCallout"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom", + "prst", u"downArrowCallout"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[9]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]"_ostr, - "fmla"_ostr, u"val 29415"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", + "fmla", u"val 29415"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[9]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]"_ostr, - "fmla"_ostr, u"val 29413"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", + "fmla", u"val 29413"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[9]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[3]"_ostr, - "fmla"_ostr, u"val 16667"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[3]", + "fmla", u"val 16667"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[9]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[4]"_ostr, - "fmla"_ostr, u"val 66667"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[4]", + "fmla", u"val 66667"); // Up arrow callout assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[10]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom"_ostr, - "prst"_ostr, u"upArrowCallout"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom", + "prst", u"upArrowCallout"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[10]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]"_ostr, - "fmla"_ostr, u"val 31033"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", + "fmla", u"val 31033"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[10]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]"_ostr, - "fmla"_ostr, u"val 31030"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", + "fmla", u"val 31030"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[10]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[3]"_ostr, - "fmla"_ostr, u"val 16667"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[3]", + "fmla", u"val 16667"); assertXPath(pXmlDoc, "//w:r/mc:AlternateContent[10]/mc:Choice/w:drawing/wp:anchor/a:graphic/" - "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[4]"_ostr, - "fmla"_ostr, u"val 66660"_ustr); + "a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[4]", + "fmla", u"val 66660"); } CPPUNIT_TEST_FIXTURE(Test, testCameraRevolutionGrabBag) @@ -352,20 +349,18 @@ CPPUNIT_TEST_FIXTURE(Test, testCameraRevolutionGrabBag) xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); // Then make sure the revolution is exported without a problem: // First shape textbox: - assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:scene3d/a:camera/a:rot"_ostr, "rev"_ostr, - u"5400000"_ustr); + assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:scene3d/a:camera/a:rot", "rev", u"5400000"); // Second shape rectangle: - assertXPath(pXmlDoc, "//p:sp[2]/p:spPr/a:scene3d/a:camera/a:rot"_ostr, "rev"_ostr, - u"18300000"_ustr); + assertXPath(pXmlDoc, "//p:sp[2]/p:spPr/a:scene3d/a:camera/a:rot", "rev", u"18300000"); // Make sure Shape3DProperties don't leak under txBody // Without the accompanying fix in place, this test would have failed with: // - Expected: 0 // - Actual : 1 // - In <>, XPath '//p:sp[1]/p:txBody/a:bodyPr/a:scene3d/a:camera/a:rot' number of nodes is incorrect - assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:bodyPr/a:scene3d/a:camera/a:rot"_ostr, 0); - assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:bodyPr/a:scene3d/a:camera/a:rot"_ostr, 0); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:bodyPr/a:scene3d/a:camera/a:rot", 0); + assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:bodyPr/a:scene3d/a:camera/a:rot", 0); } CPPUNIT_TEST_FIXTURE(Test, testReferToTheme) @@ -383,12 +378,10 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToTheme) // - Actual : 0 // - XPath '//p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr' number of nodes is incorrect // i.e. the <a:schemeClr> element was not written. - assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr"_ostr, - "val"_ostr, u"accent1"_ustr); - assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod"_ostr, - 0); - assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff"_ostr, - 0); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", + u"accent1"); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod", 0); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", 0); // Second shape: lighter color: // Without the accompanying fix in place, this test would have failed with: @@ -396,20 +389,19 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToTheme) // - Actual : 0 // - XPath '//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr' number of nodes is incorrect // i.e. the effects case did not write scheme colors. - assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr"_ostr, - "val"_ostr, u"accent1"_ustr); - assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod"_ostr, - "val"_ostr, u"40000"_ustr); - assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff"_ostr, - "val"_ostr, u"60000"_ustr); + assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", + u"accent1"); + assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod", "val", + u"40000"); + assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", "val", + u"60000"); // Third shape, darker color: - assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr"_ostr, - "val"_ostr, u"accent1"_ustr); - assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod"_ostr, - "val"_ostr, u"75000"_ustr); - assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff"_ostr, - 0); + assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", + u"accent1"); + assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod", "val", + u"75000"); + assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", 0); } CPPUNIT_TEST_FIXTURE(Test, testThemeColor_ShapeFill) @@ -424,10 +416,8 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeColor_ShapeFill) // Note that this was already working from PPTX files via grab-bags, //so this test intentionally uses an ODP file as input. xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr"_ostr, "val"_ostr, - u"accent6"_ustr); - assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr/a:lumMod"_ostr, "val"_ostr, - u"75000"_ustr); + assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr", "val", u"accent6"); + assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr/a:lumMod", "val", u"75000"); } CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSize) @@ -444,9 +434,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSi // - Expected: 500 // - Actual : 1800 // i.e. the endParaRPr 'size' wasn't exported correctly - assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[1]/a:endParaRPr"_ostr, "sz"_ostr, u"500"_ustr); - assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[2]/a:endParaRPr"_ostr, "sz"_ostr, u"500"_ustr); - assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[3]/a:endParaRPr"_ostr, "sz"_ostr, u"500"_ustr); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[1]/a:endParaRPr", "sz", u"500"); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[2]/a:endParaRPr", "sz", u"500"); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[3]/a:endParaRPr", "sz", u"500"); } CPPUNIT_TEST_FIXTURE(Test, testTdf147978_endsubpath) @@ -460,10 +450,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_endsubpath) xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); // Then make sure the pathLst has two child elements, // Without the accompanying fix in place, only one element a:path was exported. - assertXPathChildren(pXmlDoc, "//a:pathLst"_ostr, 2); + assertXPathChildren(pXmlDoc, "//a:pathLst", 2); // and make sure first path with no stroke, second with no fill - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]"_ostr, "stroke"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]"_ostr, "fill"_ostr, u"none"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "stroke", u"0"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]", "fill", u"none"); } CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandA) @@ -478,13 +468,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandA) // Then make sure the path has a child element arcTo. Prior to the fix that part of the curve was // not exported at all. In odp it is a command A. Such does not exist in OOXML and is therefore // exported as a:lnTo followed by a:arcTo - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:lnTo"_ostr, 2); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo"_ostr, 1); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:lnTo", 2); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo", 1); // And assert its attribute values - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo"_ostr, "wR"_ostr, u"7200"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo"_ostr, "hR"_ostr, u"5400"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo"_ostr, "stAng"_ostr, u"7719588"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo"_ostr, "swAng"_ostr, u"-5799266"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo", "wR", u"7200"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo", "hR", u"5400"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo", "stAng", u"7719588"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo", "swAng", u"-5799266"); } CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandT) @@ -498,22 +488,22 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandT) // Verify the markup: xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); // File has draw:viewBox="0 0 216 216" - assertXPath(pXmlDoc, "//a:pathLst/a:path"_ostr, "w"_ostr, u"216"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path"_ostr, "h"_ostr, u"216"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path", "w", u"216"); + assertXPath(pXmlDoc, "//a:pathLst/a:path", "h", u"216"); // Command T is exported as lnTo followed by arcTo. - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:moveTo"_ostr, 1); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:lnTo"_ostr, 1); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo"_ostr, 1); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:close"_ostr, 1); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:moveTo", 1); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:lnTo", 1); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo", 1); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:close", 1); // And assert its values - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:moveTo/a:pt"_ostr, "x"_ostr, u"108"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:moveTo/a:pt"_ostr, "y"_ostr, u"162"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:lnTo/a:pt"_ostr, "x"_ostr, u"138"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:lnTo/a:pt"_ostr, "y"_ostr, u"110"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo"_ostr, "wR"_ostr, u"108"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo"_ostr, "hR"_ostr, u"54"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo"_ostr, "stAng"_ostr, u"18000000"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo"_ostr, "swAng"_ostr, u"18000000"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:moveTo/a:pt", "x", u"108"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:moveTo/a:pt", "y", u"162"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:lnTo/a:pt", "x", u"138"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:lnTo/a:pt", "y", u"110"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo", "wR", u"108"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo", "hR", u"54"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo", "stAng", u"18000000"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo", "swAng", u"18000000"); } CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandXY) @@ -527,27 +517,27 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandXY) // Verify the markup: xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); // File has draw:viewBox="0 0 10 10" - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]"_ostr, "w"_ostr, u"10"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]"_ostr, "h"_ostr, u"10"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "w", u"10"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "h", u"10"); // Shape has M 0 5 Y 5 0 10 5 5 10 F Y 0 5 N M 10 10 X 0 0 - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:moveTo/a:pt"_ostr, "x"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:moveTo/a:pt"_ostr, "y"_ostr, u"5"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[1]"_ostr, "wR"_ostr, u"5"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[1]"_ostr, "hR"_ostr, u"5"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[1]"_ostr, "stAng"_ostr, u"10800000"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[1]"_ostr, "swAng"_ostr, u"5400000"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[2]"_ostr, "stAng"_ostr, u"16200000"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[2]"_ostr, "swAng"_ostr, u"5400000"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[3]"_ostr, "stAng"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[3]"_ostr, "swAng"_ostr, u"5400000"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[4]"_ostr, "stAng"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[4]"_ostr, "swAng"_ostr, u"-5400000"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:moveTo/a:pt"_ostr, "x"_ostr, u"10"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:moveTo/a:pt"_ostr, "y"_ostr, u"10"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:arcTo"_ostr, "wR"_ostr, u"10"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:arcTo"_ostr, "hR"_ostr, u"10"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:arcTo"_ostr, "stAng"_ostr, u"5400000"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:arcTo"_ostr, "swAng"_ostr, u"5400000"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:moveTo/a:pt", "x", u"0"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:moveTo/a:pt", "y", u"5"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[1]", "wR", u"5"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[1]", "hR", u"5"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[1]", "stAng", u"10800000"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[1]", "swAng", u"5400000"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[2]", "stAng", u"16200000"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[2]", "swAng", u"5400000"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[3]", "stAng", u"0"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[3]", "swAng", u"5400000"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[4]", "stAng", u"0"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]/a:arcTo[4]", "swAng", u"-5400000"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:moveTo/a:pt", "x", u"10"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:moveTo/a:pt", "y", u"10"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:arcTo", "wR", u"10"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:arcTo", "hR", u"10"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:arcTo", "stAng", u"5400000"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]/a:arcTo", "swAng", u"5400000"); } CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandHIJK) @@ -561,15 +551,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandHIJK) // Verify the markup: xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); // File has draw:viewBox="0 0 80 80" - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]"_ostr, "w"_ostr, u"80"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]"_ostr, "h"_ostr, u"80"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "w", u"80"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "h", u"80"); // File uses from back to front J (lighten), I (lightenLess), normal fill, K (darkenLess), // H (darken). New feature, old versions did not export these at all. - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]"_ostr, "fill"_ostr, u"lighten"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]"_ostr, "fill"_ostr, u"lightenLess"_ustr); - assertXPathNoAttribute(pXmlDoc, "//a:pathLst/a:path[3]"_ostr, "fill"_ostr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[4]"_ostr, "fill"_ostr, u"darkenLess"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[5]"_ostr, "fill"_ostr, u"darken"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "fill", u"lighten"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]", "fill", u"lightenLess"); + assertXPathNoAttribute(pXmlDoc, "//a:pathLst/a:path[3]", "fill"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[4]", "fill", u"darkenLess"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[5]", "fill", u"darken"); } CPPUNIT_TEST_FIXTURE(Test, testTdf147978_subpath) @@ -583,14 +573,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_subpath) // Verify the markup: xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); // File should have four subpaths with increasing path size - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]"_ostr, "w"_ostr, u"10"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]"_ostr, "h"_ostr, u"10"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]"_ostr, "w"_ostr, u"20"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]"_ostr, "h"_ostr, u"20"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[3]"_ostr, "w"_ostr, u"40"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[3]"_ostr, "h"_ostr, u"40"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[4]"_ostr, "w"_ostr, u"80"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[4]"_ostr, "h"_ostr, u"80"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "w", u"10"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "h", u"10"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]", "w", u"20"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]", "h", u"20"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[3]", "w", u"40"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[3]", "h", u"40"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[4]", "w", u"80"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[4]", "h", u"80"); } CPPUNIT_TEST_FIXTURE(Test, testTdf100391TextAreaRect) @@ -602,14 +592,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf100391TextAreaRect) // Verify the markup. Without fix the values were l="l", t="t", r="r", b="b" xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - assertXPath(pXmlDoc, "//a:custGeom/a:rect"_ostr, "l"_ostr, u"textAreaLeft"_ustr); - assertXPath(pXmlDoc, "//a:custGeom/a:rect"_ostr, "t"_ostr, u"textAreaTop"_ustr); - assertXPath(pXmlDoc, "//a:custGeom/a:rect"_ostr, "r"_ostr, u"textAreaRight"_ustr); - assertXPath(pXmlDoc, "//a:custGeom/a:rect"_ostr, "b"_ostr, u"textAreaBottom"_ustr); + assertXPath(pXmlDoc, "//a:custGeom/a:rect", "l", u"textAreaLeft"); + assertXPath(pXmlDoc, "//a:custGeom/a:rect", "t", u"textAreaTop"); + assertXPath(pXmlDoc, "//a:custGeom/a:rect", "r", u"textAreaRight"); + assertXPath(pXmlDoc, "//a:custGeom/a:rect", "b", u"textAreaBottom"); // The values are calculated in guides, for example - assertXPath(pXmlDoc, "//a:custGeom/a:gdLst/a:gd[1]"_ostr, "name"_ostr, u"textAreaLeft"_ustr); - assertXPath(pXmlDoc, "//a:custGeom/a:gdLst/a:gd[1]"_ostr, "fmla"_ostr, - u"*/ 1440000 w 2880000"_ustr); + assertXPath(pXmlDoc, "//a:custGeom/a:gdLst/a:gd[1]", "name", u"textAreaLeft"); + assertXPath(pXmlDoc, "//a:custGeom/a:gdLst/a:gd[1]", "fmla", u"*/ 1440000 w 2880000"); // The test reflects the state of Apr 2022. It needs to be adapted when export of handles and // guides is implemented. } @@ -629,12 +618,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109169_OctagonBevel) // Verify the markup: xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // File should have six subpaths, one with stroke and five with fill - assertXPath(pXmlDoc, "//a:pathLst/a:path[1]"_ostr, "stroke"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[2]"_ostr, "fill"_ostr, u"darkenLess"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[3]"_ostr, "fill"_ostr, u"darken"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[4]"_ostr, "fill"_ostr, u"darken"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[5]"_ostr, "fill"_ostr, u"lightenLess"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path[6]"_ostr, "fill"_ostr, u"lighten"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "stroke", u"0"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[2]", "fill", u"darkenLess"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[3]", "fill", u"darken"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[4]", "fill", u"darken"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[5]", "fill", u"lightenLess"); + assertXPath(pXmlDoc, "//a:pathLst/a:path[6]", "fill", u"lighten"); } CPPUNIT_TEST_FIXTURE(Test, testFaultyPathCommandsAWT) @@ -650,10 +639,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFaultyPathCommandsAWT) // Verify the markup: xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); // First child of a:path should be a moveTo in all four shapes. - assertXPath(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"_ostr); - assertXPath(pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"_ostr); - assertXPath(pXmlDoc, "//p:spTree/p:sp[3]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"_ostr); - assertXPath(pXmlDoc, "//p:spTree/p:sp[4]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"_ostr); + assertXPath(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); + assertXPath(pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); + assertXPath(pXmlDoc, "//p:spTree/p:sp[3]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); + assertXPath(pXmlDoc, "//p:spTree/p:sp[4]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); } CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchXY) @@ -670,23 +659,21 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchXY) // x-position of last segment should be same as path width. It was 21600 without fix. sal_Int32 nWidth - = getXPathContent(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/@w"_ostr) + = getXPathContent(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/@w") .toInt32(); sal_Int32 nPosX = getXPathContent( - pXmlDoc, - "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo[4]/a:pt/@x"_ostr) + pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo[4]/a:pt/@x") .toInt32(); CPPUNIT_ASSERT_EQUAL_MESSAGE("StretchX", nWidth, nPosX); // y-position of last segment should be same as path height. It was 21600 without fix. sal_Int32 nHeight - = getXPathContent(pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/@h"_ostr) + = getXPathContent(pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/@h") .toInt32(); sal_Int32 nPosY = getXPathContent( - pXmlDoc, - "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo[4]/a:pt/@y"_ostr) + pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo[4]/a:pt/@y") .toInt32(); CPPUNIT_ASSERT_EQUAL_MESSAGE("StretchY", nHeight, nPosY); @@ -708,23 +695,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchCommandQ) // x-position of second quadBezTo control should be same as path width. It was 21600 without fix. sal_Int32 nWidth - = getXPathContent(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/@w"_ostr) + = getXPathContent(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/@w") .toInt32(); sal_Int32 nPosX = getXPathContent( pXmlDoc, - "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:quadBezTo[2]/a:pt/@x"_ostr) + "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:quadBezTo[2]/a:pt/@x") .toInt32(); CPPUNIT_ASSERT_EQUAL_MESSAGE("StretchX", nWidth, nPosX); // y-position of third quadBezTo control should be same as path height. It was 21600 without fix. sal_Int32 nHeight - = getXPathContent(pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/@h"_ostr) + = getXPathContent(pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/@h") .toInt32(); sal_Int32 nPosY = getXPathContent( pXmlDoc, - "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:quadBezTo[3]/a:pt/@y"_ostr) + "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:quadBezTo[3]/a:pt/@y") .toInt32(); CPPUNIT_ASSERT_EQUAL_MESSAGE("StretchY", nHeight, nPosY); @@ -747,23 +734,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchCommandVW) // wR of first ArcTo in first shape should be same as path width/2. It was 10800 without fix. sal_Int32 nHalfWidth - = getXPathContent(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/@w"_ostr) + = getXPathContent(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/@w") .toInt32() / 2; sal_Int32 nWR - = getXPathContent( - pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:arcTo[1]/@wR"_ostr) + = getXPathContent(pXmlDoc, + "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:arcTo[1]/@wR") .toInt32(); CPPUNIT_ASSERT_EQUAL_MESSAGE("StretchX", nHalfWidth, nWR); // hR of first ArcTo in second shape should be same as path height /2. It was 10800 without fix. sal_Int32 nHalfHeight - = getXPathContent(pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/@h"_ostr) + = getXPathContent(pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/@h") .toInt32() / 2; sal_Int32 nHR - = getXPathContent( - pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:arcTo[1]/@hR"_ostr) + = getXPathContent(pXmlDoc, + "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:arcTo[1]/@hR") .toInt32(); CPPUNIT_ASSERT_EQUAL_MESSAGE("StretchY", nHalfHeight, nHR); } @@ -781,11 +768,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149551VertPadding) for (sal_Int32 i = 1; i <= 2; i++) { OString sElement = "//p:spTree/p:sp[" + OString::number(i) + "]/p:txBody/a:bodyPr"; - assertXPath(pXmlDoc, sElement, "lIns"_ostr, u"720000"_ustr); - assertXPath(pXmlDoc, sElement, "tIns"_ostr, u"360000"_ustr); - assertXPath(pXmlDoc, sElement, "rIns"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sElement, "bIns"_ostr, u"0"_ustr); - assertXPathNoAttribute(pXmlDoc, sElement, "rot"_ostr); + assertXPath(pXmlDoc, sElement, "lIns", u"720000"); + assertXPath(pXmlDoc, sElement, "tIns", u"360000"); + assertXPath(pXmlDoc, sElement, "rIns", u"0"); + assertXPath(pXmlDoc, sElement, "bIns", u"0"); + assertXPathNoAttribute(pXmlDoc, sElement, "rot"); } } @@ -800,8 +787,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149538upright) // Verify the markup. The values must be the same as in the original file. xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - assertXPath(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr"_ostr, "upright"_ostr, u"1"_ustr); - assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr"_ostr, "rot"_ostr); + assertXPath(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr", "upright", u"1"); + assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr", "rot"); } CPPUNIT_TEST_FIXTURE(Test, testTdf151008VertAnchor) @@ -814,23 +801,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf151008VertAnchor) // easier then. // As of Sep 2022 LibreOffice does not write the default anchorCtr="0" // Right - assertXPath(pXmlDoc, "//p:spTree/p:sp[1]/p:txBody/a:bodyPr"_ostr, "anchor"_ostr, u"t"_ustr); - assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp[1]/p:txBody/a:bodyPr"_ostr, "anchorCtr"_ostr); + assertXPath(pXmlDoc, "//p:spTree/p:sp[1]/p:txBody/a:bodyPr", "anchor", u"t"); + assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp[1]/p:txBody/a:bodyPr", "anchorCtr"); // Center - assertXPath(pXmlDoc, "//p:spTree/p:sp[2]/p:txBody/a:bodyPr"_ostr, "anchor"_ostr, u"ctr"_ustr); - assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp[2]/p:txBody/a:bodyPr"_ostr, "anchorCtr"_ostr); + assertXPath(pXmlDoc, "//p:spTree/p:sp[2]/p:txBody/a:bodyPr", "anchor", u"ctr"); + assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp[2]/p:txBody/a:bodyPr", "anchorCtr"); // Left - assertXPath(pXmlDoc, "//p:spTree/p:sp[3]/p:txBody/a:bodyPr"_ostr, "anchor"_ostr, u"b"_ustr); - assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp[3]/p:txBody/a:bodyPr"_ostr, "anchorCtr"_ostr); + assertXPath(pXmlDoc, "//p:spTree/p:sp[3]/p:txBody/a:bodyPr", "anchor", u"b"); + assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp[3]/p:txBody/a:bodyPr", "anchorCtr"); // RightMiddle - assertXPath(pXmlDoc, "//p:spTree/p:sp[4]/p:txBody/a:bodyPr"_ostr, "anchor"_ostr, u"t"_ustr); - assertXPath(pXmlDoc, "//p:spTree/p:sp[4]/p:txBody/a:bodyPr"_ostr, "anchorCtr"_ostr, u"1"_ustr); + assertXPath(pXmlDoc, "//p:spTree/p:sp[4]/p:txBody/a:bodyPr", "anchor", u"t"); + assertXPath(pXmlDoc, "//p:spTree/p:sp[4]/p:txBody/a:bodyPr", "anchorCtr", u"1"); // CenterMiddle - assertXPath(pXmlDoc, "//p:spTree/p:sp[5]/p:txBody/a:bodyPr"_ostr, "anchor"_ostr, u"ctr"_ustr); - assertXPath(pXmlDoc, "//p:spTree/p:sp[5]/p:txBody/a:bodyPr"_ostr, "anchorCtr"_ostr, u"1"_ustr); + assertXPath(pXmlDoc, "//p:spTree/p:sp[5]/p:txBody/a:bodyPr", "anchor", u"ctr"); + assertXPath(pXmlDoc, "//p:spTree/p:sp[5]/p:txBody/a:bodyPr", "anchorCtr", u"1"); // LeftMiddle - assertXPath(pXmlDoc, "//p:spTree/p:sp[6]/p:txBody/a:bodyPr"_ostr, "anchor"_ostr, u"b"_ustr); - assertXPath(pXmlDoc, "//p:spTree/p:sp[6]/p:txBody/a:bodyPr"_ostr, "anchorCtr"_ostr, u"1"_ustr); + assertXPath(pXmlDoc, "//p:spTree/p:sp[6]/p:txBody/a:bodyPr", "anchor", u"b"); + assertXPath(pXmlDoc, "//p:spTree/p:sp[6]/p:txBody/a:bodyPr", "anchorCtr", u"1"); } CPPUNIT_TEST_FIXTURE(Test, testFontworkBitmapFill) @@ -848,19 +835,19 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkBitmapFill) // Make sure it is exported to VML and has no txbxContent but a textpath element. Without fix it // was exported as DML 'abc transform', but that is not able to use bitmap fill in Word. xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); - assertXPath(pXmlDoc, "//mc:alternateContent"_ostr, 0); - assertXPath(pXmlDoc, "//v:shape/v:textbox/v:txbxContent"_ostr, 0); - assertXPath(pXmlDoc, "//v:shape/v:textpath"_ostr, 1); + assertXPath(pXmlDoc, "//mc:alternateContent", 0); + assertXPath(pXmlDoc, "//v:shape/v:textbox/v:txbxContent", 0); + assertXPath(pXmlDoc, "//v:shape/v:textpath", 1); // Without fix the bitmap was referenced by v:imagedata element. But that produces a picture // in Word not a WordArt shape. Instead a v:fill has to be used. - assertXPath(pXmlDoc, "//v:shape/v:imagedata"_ostr, 0); - assertXPath(pXmlDoc, "//v:shape/v:fill"_ostr, 1); - assertXPath(pXmlDoc, "//v:shape/v:fill[@r:id]"_ostr, 1); + assertXPath(pXmlDoc, "//v:shape/v:imagedata", 0); + assertXPath(pXmlDoc, "//v:shape/v:fill", 1); + assertXPath(pXmlDoc, "//v:shape/v:fill[@r:id]", 1); // The fill is set to 'stretched' in LO, that is type="frame" in VML. That was not implemented // in VML export. - assertXPath(pXmlDoc, "//v:shape/v:fill"_ostr, "type"_ostr, u"frame"_ustr); + assertXPath(pXmlDoc, "//v:shape/v:fill", "type", u"frame"); } CPPUNIT_TEST_FIXTURE(Test, testFontworkFontProperties) @@ -881,19 +868,19 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkFontProperties) xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); OUString sStyle; // bold - sStyle = getXPath(pXmlDoc, "(//v:shape)[1]/v:textpath"_ostr, "style"_ostr); + sStyle = getXPath(pXmlDoc, "(//v:shape)[1]/v:textpath", "style"); CPPUNIT_ASSERT(sStyle.indexOf("font-weight:bold") > -1); // italic - sStyle = getXPath(pXmlDoc, "(//v:shape)[2]/v:textpath"_ostr, "style"_ostr); + sStyle = getXPath(pXmlDoc, "(//v:shape)[2]/v:textpath", "style"); CPPUNIT_ASSERT(sStyle.indexOf("font-style:italic") > -1); // character spacing 'very loose', 150 * 655, see escherex.cxx - sStyle = getXPath(pXmlDoc, "(//v:shape)[3]/v:textpath"_ostr, "style"_ostr); + sStyle = getXPath(pXmlDoc, "(//v:shape)[3]/v:textpath", "style"); CPPUNIT_ASSERT(sStyle.indexOf("v-text-spacing:98250f") > -1); // character spacing 'tight', 90 * 655, see escherex.cxx - sStyle = getXPath(pXmlDoc, "(//v:shape)[4]/v:textpath"_ostr, "style"_ostr); + sStyle = getXPath(pXmlDoc, "(//v:shape)[4]/v:textpath", "style"); CPPUNIT_ASSERT(sStyle.indexOf("v-text-spacing:58950f") > -1); // same letter heights - sStyle = getXPath(pXmlDoc, "(//v:shape)[5]/v:textpath"_ostr, "style"_ostr); + sStyle = getXPath(pXmlDoc, "(//v:shape)[5]/v:textpath", "style"); CPPUNIT_ASSERT(sStyle.indexOf("v-same-letter-heights:t") > -1); } @@ -917,11 +904,11 @@ CPPUNIT_TEST_FIXTURE(Test, testVMLFontworkSlantUp) xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Make sure a <v:path> element exists and has an o:connecttype attribute - assertXPath(pXmlDoc, "//v:shapetype/v:path"_ostr, 1); - assertXPath(pXmlDoc, "//v:shapetype/v:path[@o:connecttype]"_ostr, 1); + assertXPath(pXmlDoc, "//v:shapetype/v:path", 1); + assertXPath(pXmlDoc, "//v:shapetype/v:path[@o:connecttype]", 1); // Make sure the handle position is written without reference to a formula - OUString sPosition = getXPath(pXmlDoc, "//v:h"_ostr, "position"_ostr); + OUString sPosition = getXPath(pXmlDoc, "//v:h", "position"); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), sPosition.indexOf("@")); CPPUNIT_ASSERT_EQUAL(u"topLeft,#0"_ustr, sPosition); } @@ -943,9 +930,9 @@ CPPUNIT_TEST_FIXTURE(Test, testVMLFontworkArchUp) xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Make sure there is no <v:rect> element - assertXPath(pXmlDoc, "//v:rect"_ostr, 0); + assertXPath(pXmlDoc, "//v:rect", 0); // ..., but a <v:shapetype> element with <v:textpath> subelement - assertXPath(pXmlDoc, "//v:shapetype/v:textpath"_ostr, 1); + assertXPath(pXmlDoc, "//v:shapetype/v:textpath", 1); } CPPUNIT_TEST_FIXTURE(Test, testVMLAdjustmentExport) @@ -965,9 +952,9 @@ CPPUNIT_TEST_FIXTURE(Test, testVMLAdjustmentExport) xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Make sure an "adj" attribute exists - assertXPath(pXmlDoc, "//v:shape[@adj]"_ostr, 1); + assertXPath(pXmlDoc, "//v:shape[@adj]", 1); // ... and has the correct values - OUString sAdjustments = getXPath(pXmlDoc, "//v:shape"_ostr, "adj"_ostr); + OUString sAdjustments = getXPath(pXmlDoc, "//v:shape", "adj"); sal_Int32 nTokenStart = 0; OUString sAngle = sAdjustments.getToken(0, ',', nTokenStart); CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(-7341733), sAngle.toInt32(), 2); @@ -994,22 +981,20 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkDirectColor) static constexpr OString sElement = "//w:txbxContent/w:p/w:r/w:rPr/"_ostr; // Make sure the fallback in <w:color> has correct value. - assertXPath(pXmlDoc, sElement + "w:color", "val"_ostr, u"2E8B57"_ustr); + assertXPath(pXmlDoc, sElement + "w:color", "val", u"2E8B57"); // ... and <w14:textOutline> exists and has correct values. assertXPath(pXmlDoc, sElement + "w14:textOutline", 1); - assertXPath(pXmlDoc, sElement + "w14:textOutline/w14:solidFill/w14:srgbClr", "val"_ostr, - u"ff7f50"_ustr); - assertXPath(pXmlDoc, sElement + "w14:textOutline/w14:solidFill/w14:srgbClr/w14:alpha", - "val"_ostr, u"20000"_ustr); + assertXPath(pXmlDoc, sElement + "w14:textOutline/w14:solidFill/w14:srgbClr", "val", u"ff7f50"); + assertXPath(pXmlDoc, sElement + "w14:textOutline/w14:solidFill/w14:srgbClr/w14:alpha", "val", + u"20000"); assertXPath(pXmlDoc, sElement + "w14:textOutline/w14:round", 1); // ... and w14:textFill exists and has correct values. assertXPath(pXmlDoc, sElement + "w14:textFill", 1); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:srgbClr", "val"_ostr, - u"2e8b57"_ustr); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:srgbClr/w14:alpha", "val"_ostr, - u"60000"_ustr); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:srgbClr", "val", u"2e8b57"); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:srgbClr/w14:alpha", "val", + u"60000"); } CPPUNIT_TEST_FIXTURE(Test, testFontworkThemeColor) @@ -1035,32 +1020,30 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkThemeColor) "w:rPr/"_ostr; // Make sure the fallback in <w:color> has correct values - assertXPath(pXmlDoc, sElement + "w:color", "val"_ostr, u"948A54"_ustr); - assertXPath(pXmlDoc, sElement + "w:color", "themeColor"_ostr, u"light2"_ustr); - assertXPath(pXmlDoc, sElement + "w:color", "themeShade"_ostr, u"80"_ustr); + assertXPath(pXmlDoc, sElement + "w:color", "val", u"948A54"); + assertXPath(pXmlDoc, sElement + "w:color", "themeColor", u"light2"); + assertXPath(pXmlDoc, sElement + "w:color", "themeShade", u"80"); // ... and w14:textFill exists and has correct values. - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:schemeClr", "val"_ostr, - u"bg2"_ustr); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:schemeClr/w14:lumMod", - "val"_ostr, u"50000"_ustr); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:schemeClr", "val", u"bg2"); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:schemeClr/w14:lumMod", "val", + u"50000"); // shape with 'lighter' sElement = "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/" "a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/"_ostr; // Make sure the fallback in <w:color> has correct values - assertXPath(pXmlDoc, sElement + "w:color", "val"_ostr, u"558ED5"_ustr); - assertXPath(pXmlDoc, sElement + "w:color", "themeColor"_ostr, u"dark2"_ustr); - assertXPath(pXmlDoc, sElement + "w:color", "themeTint"_ostr, u"99"_ustr); + assertXPath(pXmlDoc, sElement + "w:color", "val", u"558ED5"); + assertXPath(pXmlDoc, sElement + "w:color", "themeColor", u"dark2"); + assertXPath(pXmlDoc, sElement + "w:color", "themeTint", u"99"); // ... and w14:textFill exists and has correct values. - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:schemeClr", "val"_ostr, - u"tx2"_ustr); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:schemeClr/w14:lumMod", - "val"_ostr, u"60000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:schemeClr/w14:lumOff", - "val"_ostr, u"40000"_ustr); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:schemeClr", "val", u"tx2"); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:schemeClr/w14:lumMod", "val", + u"60000"); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:solidFill/w14:schemeClr/w14:lumOff", "val", + u"40000"); } CPPUNIT_TEST_FIXTURE(Test, testFontworkDistance) @@ -1080,8 +1063,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkDistance) xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); assertXPathAttrs(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/" - "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:bodyPr"_ostr, - { { "lIns", "0" }, { "rIns", "0" }, { "tIns", "0" }, { "bIns", "0" } }); + "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:bodyPr", + { { "lIns", u"0" }, { "rIns", u"0" }, { "tIns", u"0" }, { "bIns", u"0" } }); } CPPUNIT_TEST_FIXTURE(Test, testFontworkLinGradientRGBColor) @@ -1111,25 +1094,24 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkLinGradientRGBColor) assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst", 1); assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst/w14:gs", 3); // 330deg gradient rotation = 120deg color transition direction - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:lin", "ang"_ostr, - u"7200000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:lin", "scaled"_ostr, u"0"_ustr); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:lin", "ang", u"7200000"); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:lin", "scaled", u"0"); // Make sure the color stops have correct position and color // The 'intensity' property in the UI has a different algorithm than the 'lumMod' attribute in // OOXML. Therefore it cannot be exported as 'lumMod' but need to be incorporated into the color. sElement += "w14:textFill/w14:gradFill/w14:gsLst/"; - assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:srgbClr", "val"_ostr, u"cccc00"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:srgbClr/w14:alpha", "val"_ostr, u"30000"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos", u"0"); + assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:srgbClr", "val", u"cccc00"); + assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:srgbClr/w14:alpha", "val", u"30000"); - assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos"_ostr, u"25000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:srgbClr", "val"_ostr, u"cccc00"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:srgbClr/w14:alpha", "val"_ostr, u"30000"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos", u"25000"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:srgbClr", "val", u"cccc00"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:srgbClr/w14:alpha", "val", u"30000"); - assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos"_ostr, u"100000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr", "val"_ostr, u"4682b4"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr/w14:alpha", "val"_ostr, u"30000"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos", u"100000"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr", "val", u"4682b4"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr/w14:alpha", "val", u"30000"); } CPPUNIT_TEST_FIXTURE(Test, testFontworkAxialGradientTransparency) @@ -1159,28 +1141,27 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkAxialGradientTransparency) assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst", 1); assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst/w14:gs", 3); // 160deg gradient rotation = 290deg (360deg-160deg+90deg) color transition direction - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:lin", "ang"_ostr, - u"17400000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:lin", "scaled"_ostr, u"0"_ustr); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:lin", "ang", u"17400000"); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:lin", "scaled", u"0"); // Make sure the color stops have correct position and color sElement += "w14:textFill/w14:gradFill/w14:gsLst/"; // gradient is in transparency, color is always the same. for (char ch = '1'; ch <= '3'; ++ch) { - assertXPath(pXmlDoc, sElement + "w14:gs[" + OStringChar(ch) + "]/w14:schemeClr", "val"_ostr, - u"accent3"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[" + OStringChar(ch) + "]/w14:schemeClr", "val", + u"accent3"); assertXPath(pXmlDoc, sElement + "w14:gs[" + OStringChar(ch) + "]/w14:schemeClr/w14:lumMod", - "val"_ostr, u"75000"_ustr); + "val", u"75000"); } // transparency values are not exactly like in UI because converting through rgb-color. // border 40% in UI means 20% on each side. - assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos"_ostr, u"20000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:schemeClr/w14:alpha", "val"_ostr, u"89800"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos"_ostr, u"50000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:schemeClr/w14:alpha", "val"_ostr, u"4710"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos"_ostr, u"80000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr/w14:alpha", "val"_ostr, u"89800"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos", u"20000"); + assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:schemeClr/w14:alpha", "val", u"89800"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos", u"50000"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:schemeClr/w14:alpha", "val", u"4710"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos", u"80000"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr/w14:alpha", "val", u"89800"); } CPPUNIT_TEST_FIXTURE(Test, testFontworkRadialGradient) @@ -1209,20 +1190,20 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkRadialGradient) // Make sure w14:textFill and w14:gradFill elements exist with child elements assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst", 1); assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst/w14:gs", 3); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path", "path"_ostr, - u"circle"_ustr); - assertXPathAttrs(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path/w14:fillToRect", - { { "l", "75000" }, { "t", "20000" }, { "r", "25000" }, { "b", "80000" } }); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path", "path", u"circle"); + assertXPathAttrs( + pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path/w14:fillToRect", + { { "l", u"75000" }, { "t", u"20000" }, { "r", u"25000" }, { "b", u"80000" } }); // Make sure the color stops have correct position and color // The first stop is duplicated to force Word to render the gradient same as LO. sElement += "w14:textFill/w14:gradFill/w14:gsLst/"; - assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:srgbClr", "val"_ostr, u"ff0000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:srgbClr", "val"_ostr, u"ff0000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos"_ostr, u"90000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr", "val"_ostr, u"40e0d0"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos", u"0"); + assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:srgbClr", "val", u"ff0000"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos", u"0"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:srgbClr", "val", u"ff0000"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos", u"90000"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr", "val", u"40e0d0"); } CPPUNIT_TEST_FIXTURE(Test, testFontworkEllipticalGradient) @@ -1251,22 +1232,22 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkEllipticalGradient) // Make sure w14:textFill and w14:gradFill elements exist with child elements assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst", 1); assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst/w14:gs", 3); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path", "path"_ostr, - u"circle"_ustr); - assertXPathAttrs(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path/w14:fillToRect", - { { "l", "50000" }, { "t", "50000" }, { "r", "50000" }, { "b", "50000" } }); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path", "path", u"circle"); + assertXPathAttrs( + pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path/w14:fillToRect", + { { "l", u"50000" }, { "t", u"50000" }, { "r", u"50000" }, { "b", u"50000" } }); // Make sure the color stops have correct position and color // transparency values are not exactly like in UI because converting through rgb-color. sElement += "w14:textFill/w14:gradFill/w14:gsLst/"; - assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:srgbClr", "val"_ostr, u"00008b"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos", u"0"); + assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:srgbClr", "val", u"00008b"); // stop is duplicated to force Word to same rendering as LO does. - assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:srgbClr", "val"_ostr, u"00008b"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos"_ostr, u"50000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr", "val"_ostr, u"00008b"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr/w14:alpha", "val"_ostr, u"69800"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos", u"0"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:srgbClr", "val", u"00008b"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos", u"50000"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr", "val", u"00008b"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr/w14:alpha", "val", u"69800"); } CPPUNIT_TEST_FIXTURE(Test, testFontworkSquareGradient) @@ -1295,21 +1276,20 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkSquareGradient) // Make sure w14:textFill and w14:gradFill elements exist with child elements assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst", 1); assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst/w14:gs", 3); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path", "path"_ostr, - u"rect"_ustr); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path", "path", u"rect"); assertXPathAttrs(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path/w14:fillToRect", - { { "l", "100000" }, { "t", "50000" }, { "r", "0" }, { "b", "50000" } }); + { { "l", u"100000" }, { "t", u"50000" }, { "r", u"0" }, { "b", u"50000" } }); // Make sure the color stops have correct position and color // The 'intensity' property in the UI has a different algorithm than the 'lumMod' attribute in // OOXML. Therefore it cannot be exported as 'lumMod' but need to be incorporated into the color. sElement += "w14:textFill/w14:gradFill/w14:gsLst/"; - assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:srgbClr", "val"_ostr, u"e6e663"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:srgbClr", "val"_ostr, u"e6e663"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos"_ostr, u"100000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr", "val"_ostr, u"1d4860"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos", u"0"); + assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:srgbClr", "val", u"e6e663"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos", u"0"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:srgbClr", "val", u"e6e663"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos", u"100000"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:srgbClr", "val", u"1d4860"); } CPPUNIT_TEST_FIXTURE(Test, testFontworkRectGradient) @@ -1338,36 +1318,30 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkRectGradient) // Make sure w14:textFill and w14:gradFill elements exist with child elements assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst", 1); assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:gsLst/w14:gs", 3); - assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path", "path"_ostr, - u"rect"_ustr); - assertXPathAttrs(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path/w14:fillToRect", - { { "l", "50000" }, { "t", "50000" }, { "r", "50000" }, { "b", "50000" } }); + assertXPath(pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path", "path", u"rect"); + assertXPathAttrs( + pXmlDoc, sElement + "w14:textFill/w14:gradFill/w14:path/w14:fillToRect", + { { "l", u"50000" }, { "t", u"50000" }, { "r", u"50000" }, { "b", u"50000" } }); // Make sure the color stops have correct position and color // transparency values are not exactly like in UI because converting through rgb-color. sElement += "w14:textFill/w14:gradFill/w14:gsLst/"; - assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:schemeClr", "val"_ostr, u"accent4"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:schemeClr/w14:lumMod", "val"_ostr, - u"40000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:schemeClr/w14:lumOff", "val"_ostr, - u"60000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:schemeClr/w14:alpha", "val"_ostr, u"4710"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[1]", "pos", u"0"); + assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:schemeClr", "val", u"accent4"); + assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:schemeClr/w14:lumMod", "val", u"40000"); + assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:schemeClr/w14:lumOff", "val", u"60000"); + assertXPath(pXmlDoc, sElement + "w14:gs[1]/w14:schemeClr/w14:alpha", "val", u"4710"); // The first stop is duplicated to force Word to render the gradient same as LO. - assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:schemeClr", "val"_ostr, u"accent4"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:schemeClr/w14:lumMod", "val"_ostr, - u"40000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:schemeClr/w14:lumOff", "val"_ostr, - u"60000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:schemeClr/w14:alpha", "val"_ostr, u"4710"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos"_ostr, u"90000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr", "val"_ostr, u"accent4"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr/w14:lumMod", "val"_ostr, - u"40000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr/w14:lumOff", "val"_ostr, - u"60000"_ustr); - assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr/w14:alpha", "val"_ostr, u"69800"_ustr); + assertXPath(pXmlDoc, sElement + "w14:gs[2]", "pos", u"0"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:schemeClr", "val", u"accent4"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:schemeClr/w14:lumMod", "val", u"40000"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:schemeClr/w14:lumOff", "val", u"60000"); + assertXPath(pXmlDoc, sElement + "w14:gs[2]/w14:schemeClr/w14:alpha", "val", u"4710"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]", "pos", u"90000"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr", "val", u"accent4"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr/w14:lumMod", "val", u"40000"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr/w14:lumOff", "val", u"60000"); + assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr/w14:alpha", "val", u"69800"); } CPPUNIT_TEST_FIXTURE(Test, testThemeColorTransparency) @@ -1383,18 +1357,17 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeColorTransparency) // Make sure a:alpha is written for line color and for fill color. // Make sure fill color is a schemeClr. OString sElement = "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p/a:r/a:rPr/"_ostr; - assertXPath(pXmlDoc, sElement + "a:ln/a:solidFill/a:srgbClr/a:alpha", "val"_ostr, - u"25000"_ustr); - assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr", "val"_ostr, u"accent1"_ustr); - assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumMod", "val"_ostr, u"60000"_ustr); - assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumOff", "val"_ostr, u"40000"_ustr); - assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:alpha", "val"_ostr, u"35000"_ustr); + assertXPath(pXmlDoc, sElement + "a:ln/a:solidFill/a:srgbClr/a:alpha", "val", u"25000"); + assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr", "val", u"accent1"); + assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumMod", "val", u"60000"); + assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumOff", "val", u"40000"); + assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:alpha", "val", u"35000"); // Make sure a:alpha is written for characters and fill color is a schemeClr. sElement = "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:r/a:rPr/"_ostr; - assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr", "val"_ostr, u"accent4"_ustr); - assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumMod", "val"_ostr, u"75000"_ustr); - assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:alpha", "val"_ostr, u"20000"_ustr); + assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr", "val", u"accent4"); + assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumMod", "val", u"75000"); + assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:alpha", "val", u"20000"); } CPPUNIT_TEST_FIXTURE(Test, testThemeFontTypeface) @@ -1409,8 +1382,8 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeFontTypeface) // Make sure typeface is written. OString sElement = "/a:theme/a:themeElements/a:fontScheme/"_ostr; - assertXPath(pXmlDoc, sElement + "a:majorFont/a:ea", "typeface"_ostr, u""_ustr); - assertXPath(pXmlDoc, sElement + "a:minorFont/a:ea", "typeface"_ostr, u""_ustr); + assertXPath(pXmlDoc, sElement + "a:majorFont/a:ea", "typeface", u""); + assertXPath(pXmlDoc, sElement + "a:minorFont/a:ea", "typeface", u""); } CPPUNIT_TEST_FIXTURE(Test, testTdf157289CircularArrowExport) @@ -1423,8 +1396,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf157289CircularArrowExport) // Verify the markup. Both wR and hR must be positive. xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo[1]"_ostr, "wR"_ostr, u"6750"_ustr); - assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo[1]"_ostr, "hR"_ostr, u"6750"_ustr); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo[1]", "wR", u"6750"); + assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo[1]", "hR", u"6750"); } CPPUNIT_TEST_FIXTURE(Test, testTdf134401_ExportAutoGrowToTextWordWrap) @@ -1440,8 +1413,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134401_ExportAutoGrowToTextWordWrap) // The 2. shape is with autoGrowWidth/Height. // Check if wrap="none" is exported for shape 2, but no wrap is exported for shape 1. xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - assertXPathNoAttribute(pXmlDoc, "//p:sp[1]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr); - assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr, u"none"_ustr); + assertXPathNoAttribute(pXmlDoc, "//p:sp[1]/p:txBody/a:bodyPr", "wrap"); + assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:bodyPr", "wrap", u"none"); } } diff --git a/oox/qa/unit/mcgr.cxx b/oox/qa/unit/mcgr.cxx index 6f950be723df..5cef50f06a8d 100644 --- a/oox/qa/unit/mcgr.cxx +++ b/oox/qa/unit/mcgr.cxx @@ -32,16 +32,16 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradient) // And make sure a multi-color gradient fill is exported. xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); // linear gradient with 30deg angle - assertXPath(pXmlDoc, "//a:r/a:rPr/a:gradFill/a:lin"_ostr, "ang"_ostr, u"3600000"_ustr); + assertXPath(pXmlDoc, "//a:r/a:rPr/a:gradFill/a:lin", "ang", u"3600000"); // three color stops, no transparency static constexpr OString sPath = "//a:r/a:rPr/a:gradFill/a:gsLst/"_ostr; assertXPath(pXmlDoc, sPath + "a:gs", 3); - assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val"_ostr, u"ff1493"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[2]", "pos"_ostr, u"30000"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val"_ostr, u"ffff00"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[3]", "pos"_ostr, u"100000"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val"_ostr, u"00ffff"_ustr); + assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos", u"0"); + assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", u"ff1493"); + assertXPath(pXmlDoc, sPath + "a:gs[2]", "pos", u"30000"); + assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val", u"ffff00"); + assertXPath(pXmlDoc, sPath + "a:gs[3]", "pos", u"100000"); + assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val", u"00ffff"); } CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradientWord) @@ -55,16 +55,16 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradientWord) // And make sure a multi-color gradient fill is exported. xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // linear gradient with 30deg angle - assertXPath(pXmlDoc, "//w14:lin"_ostr, "ang"_ostr, u"3600000"_ustr); + assertXPath(pXmlDoc, "//w14:lin", "ang", u"3600000"); // three color stops, no transparency static constexpr OString sPath = "//w14:gradFill/w14:gsLst/"_ostr; assertXPath(pXmlDoc, sPath + "w14:gs", 3); - assertXPath(pXmlDoc, sPath + "w14:gs[1]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sPath + "w14:gs[1]/w14:srgbClr", "val"_ostr, u"ff1493"_ustr); - assertXPath(pXmlDoc, sPath + "w14:gs[2]", "pos"_ostr, u"30000"_ustr); - assertXPath(pXmlDoc, sPath + "w14:gs[2]/w14:srgbClr", "val"_ostr, u"ffff00"_ustr); - assertXPath(pXmlDoc, sPath + "w14:gs[3]", "pos"_ostr, u"100000"_ustr); - assertXPath(pXmlDoc, sPath + "w14:gs[3]/w14:srgbClr", "val"_ostr, u"00ffff"_ustr); + assertXPath(pXmlDoc, sPath + "w14:gs[1]", "pos", u"0"); + assertXPath(pXmlDoc, sPath + "w14:gs[1]/w14:srgbClr", "val", u"ff1493"); + assertXPath(pXmlDoc, sPath + "w14:gs[2]", "pos", u"30000"); + assertXPath(pXmlDoc, sPath + "w14:gs[2]/w14:srgbClr", "val", u"ffff00"); + assertXPath(pXmlDoc, sPath + "w14:gs[3]", "pos", u"100000"); + assertXPath(pXmlDoc, sPath + "w14:gs[3]/w14:srgbClr", "val", u"00ffff"); } CPPUNIT_TEST_FIXTURE(TestMCGR, testTdf155825_SourcOffsetRangeDifferent) @@ -97,9 +97,9 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testStepCount) assertXPath(pXmlDoc, sPath + "a:gs[@pos='50000']", 2); assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000']", 2); // Without fix the color was 808080. - assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000'][1]/a:srgbClr", "val"_ostr, u"55aaaa"_ustr); + assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000'][1]/a:srgbClr", "val", u"55aaaa"); // Without fix the color was 40bfbf, producing a gradient in the last segment. - assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000'][2]/a:srgbClr", "val"_ostr, u"00ffff"_ustr); + assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000'][2]/a:srgbClr", "val", u"00ffff"); } CPPUNIT_TEST_FIXTURE(TestMCGR, testAxialColorLinearTrans) @@ -117,14 +117,14 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testAxialColorLinearTrans) xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); static constexpr OString sPath = "//a:gradFill/a:gsLst/"_ostr; assertXPath(pXmlDoc, sPath + "a:gs", 3); - assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos"_ostr, u"0"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val"_ostr, u"00ffff"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr/a:alpha", "val"_ostr, u"20000"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[2]", "pos"_ostr, u"50000"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val"_ostr, u"ff0000"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr/a:alpha", "val"_ostr, u"60396"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[3]", "pos"_ostr, u"100000"_ustr); - assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val"_ostr, u"00ffff"_ustr); + assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos", u"0"); + assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", u"00ffff"); + assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr/a:alpha", "val", u"20000"); + assertXPath(pXmlDoc, sPath + "a:gs[2]", "pos", u"50000"); + assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val", u"ff0000"); + assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr/a:alpha", "val", u"60396"); + assertXPath(pXmlDoc, sPath + "a:gs[3]", "pos", u"100000"); + assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val", u"00ffff"); // no <a:alpha> element for default val="100000" assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr/a:alpha", 0); } diff --git a/oox/qa/unit/testscene3d.cxx b/oox/qa/unit/testscene3d.cxx index 08d24ded2afc..247f447a24ec 100644 --- a/oox/qa/unit/testscene3d.cxx +++ b/oox/qa/unit/testscene3d.cxx @@ -540,20 +540,20 @@ CPPUNIT_TEST_FIXTURE(TestScene3d, test_material_wireframe) assertXPath(pXmlDoc, "/office:document-content/office:body/office:presentation/draw:page/" - "draw:custom-shape/draw:enhanced-geometry"_ostr, - "extrusion-origin"_ostr, u"-0.5 -0.5"_ustr); + "draw:custom-shape/draw:enhanced-geometry", + "extrusion-origin", u"-0.5 -0.5"); assertXPath(pXmlDoc, "/office:document-content/office:body/office:presentation/draw:page/" - "draw:custom-shape/draw:enhanced-geometry"_ostr, - "extrusion-skew"_ostr, u"30 -45"_ustr); + "draw:custom-shape/draw:enhanced-geometry", + "extrusion-skew", u"30 -45"); assertXPath(pXmlDoc, "/office:document-content/office:body/office:presentation/draw:page/" - "draw:custom-shape/draw:enhanced-geometry"_ostr, - "projection"_ostr, u"parallel"_ustr); + "draw:custom-shape/draw:enhanced-geometry", + "projection", u"parallel"); assertXPath(pXmlDoc, "/office:document-content/office:body/office:presentation/draw:page/" - "draw:custom-shape/draw:enhanced-geometry"_ostr, - "shade-mode"_ostr, u"draft"_ustr); + "draw:custom-shape/draw:enhanced-geometry", + "shade-mode", u"draft"); } CPPUNIT_TEST_FIXTURE(TestScene3d, test_cropped_image) @@ -633,7 +633,7 @@ CPPUNIT_TEST_FIXTURE(TestScene3d, test_shape_rotation) // Make sure that the immediate export to pptx has the same shape rotation save(u"Impress Office Open XML"_ustr); xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - assertXPath(pXmlDoc, "//p:spPr/a:xfrm"_ostr, "rot"_ostr, u"300000"_ustr); + assertXPath(pXmlDoc, "//p:spPr/a:xfrm", "rot", u"300000"); } CPPUNIT_PLUGIN_IMPLEMENT(); |