writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx | 8 xmloff/qa/unit/draw.cxx | 113 ++++++------- xmloff/qa/unit/style.cxx | 144 ++++++++--------- xmloff/qa/unit/text.cxx | 113 ++++++------- 4 files changed, 194 insertions(+), 184 deletions(-)
New commits: commit 694763542e32b1e6354f919526751677945f1cd9 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Nov 19 13:22:27 2023 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Nov 19 14:42:30 2023 +0100 Extended loplugin:ostr: writerfilter Change-Id: I83bdd43357d07bce18a2cf286e639c816846e7d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159665 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx b/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx index 5afad898f8e4..a62283c98388 100644 --- a/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx +++ b/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx @@ -75,9 +75,11 @@ CPPUNIT_TEST_FIXTURE(Test, testAddVerticalFrameOffsetsRTF) OString aDump = xDumper->dump("layout").toUtf8(); auto pCharBuffer = reinterpret_cast<const xmlChar*>(aDump.getStr()); xmlDocUniquePtr pXmlDoc(xmlParseDoc(pCharBuffer)); - sal_Int32 nFlyBottom = getXPath(pXmlDoc, "//fly/infos/bounds", "bottom").toInt32(); - sal_Int32 nTableFrameTop = getXPath(pXmlDoc, "//body/tab/infos/bounds", "top").toInt32(); - sal_Int32 nTableTopMargin = getXPath(pXmlDoc, "//body/tab/infos/prtBounds", "top").toInt32(); + sal_Int32 nFlyBottom = getXPath(pXmlDoc, "//fly/infos/bounds"_ostr, "bottom"_ostr).toInt32(); + sal_Int32 nTableFrameTop + = getXPath(pXmlDoc, "//body/tab/infos/bounds"_ostr, "top"_ostr).toInt32(); + sal_Int32 nTableTopMargin + = getXPath(pXmlDoc, "//body/tab/infos/prtBounds"_ostr, "top"_ostr).toInt32(); sal_Int32 nTableTop = nTableFrameTop + nTableTopMargin; // Without the accompanying fix in place, this test would have failed with: // - Expected greater than: 2747 commit 0ea539f0eacfc22f8c1745ff261cbce45f5418e8 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Nov 19 13:21:42 2023 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Nov 19 14:42:16 2023 +0100 Extended loplugin:ostr: xmloff Change-Id: I87e53216693f2d6489a1dd80e62141ca5621a87f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159662 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index c3a556f54967..13c77387b054 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -114,7 +114,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle) // Without fix draw:extrusion-skew="50 -135" was not written to file although "50 -135" is not // default in ODF, but only default inside LO. - assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-skew", "50 -135"); + assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-skew"_ostr, "50 -135"); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport) @@ -155,7 +155,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport) // - Actual : 0 // - XPath '//style:master-page/loext:theme/loext:color-table/loext:color' number of nodes is incorrect // i.e. the theme was lost on exporting to ODF. - assertXPath(pXmlDoc, "//style:master-page/loext:theme/loext:theme-colors/loext:color", 12); + assertXPath(pXmlDoc, "//style:master-page/loext:theme/loext:theme-colors/loext:color"_ostr, 12); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot) @@ -194,11 +194,11 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot) // - Actual : 0 // - XPath '//draw:frame[@draw:style-name='gr1']/draw:image' number of nodes is incorrect // i.e. the preview wasn't exported to ODP. - assertXPath(pXmlDoc, "//draw:frame[@draw:style-name='gr1']/draw:image", "href", + assertXPath(pXmlDoc, "//draw:frame[@draw:style-name='gr1']/draw:image"_ostr, "href"_ostr, "Pictures/MediaPreview1.png"); // Check that the crop was exported: - assertXPath(pXmlDoc, "//style:style[@style:name='gr1']/style:graphic-properties", "clip", - "rect(0cm, 1.356cm, 0cm, 1.356cm)"); + assertXPath(pXmlDoc, "//style:style[@style:name='gr1']/style:graphic-properties"_ostr, + "clip"_ostr, "rect(0cm, 1.356cm, 0cm, 1.356cm)"); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport) @@ -293,55 +293,55 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextAndFillThemeColorExportImport) // Text color OString aStyle1( - "//style:style[@style:name='T2']/style:text-properties/loext:char-complex-color"); - assertXPath(pXmlDoc, aStyle1, "color-type", "theme"); - assertXPath(pXmlDoc, aStyle1, "theme-type", "accent3"); - assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[1]", "type", "lummod"); - assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[1]", "value", "2000"); - assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[2]", "type", "lumoff"); - assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[2]", "value", "8000"); + "//style:style[@style:name='T2']/style:text-properties/loext:char-complex-color"_ostr); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); + assertXPath(pXmlDoc, aStyle1, "theme-type"_ostr, "accent3"); + assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[1]", "type"_ostr, "lummod"); + assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[1]", "value"_ostr, "2000"); + assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[2]", "type"_ostr, "lumoff"); + assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[2]", "value"_ostr, "8000"); OString aStyle2( - "//style:style[@style:name='T3']/style:text-properties/loext:char-complex-color"); - assertXPath(pXmlDoc, aStyle1, "color-type", "theme"); - assertXPath(pXmlDoc, aStyle2, "theme-type", "accent3"); - assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[1]", "type", "lummod"); - assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[1]", "value", "6000"); - assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[2]", "type", "lumoff"); - assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[2]", "value", "4000"); + "//style:style[@style:name='T3']/style:text-properties/loext:char-complex-color"_ostr); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); + assertXPath(pXmlDoc, aStyle2, "theme-type"_ostr, "accent3"); + assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[1]", "type"_ostr, "lummod"); + assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[1]", "value"_ostr, "6000"); + assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[2]", "type"_ostr, "lumoff"); + assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[2]", "value"_ostr, "4000"); OString aStyle3( - "//style:style[@style:name='T4']/style:text-properties/loext:char-complex-color"); - assertXPath(pXmlDoc, aStyle1, "color-type", "theme"); - assertXPath(pXmlDoc, aStyle3, "theme-type", "accent3"); - assertXPath(pXmlDoc, aStyle3 + "/loext:transformation[1]", "type", "lummod"); - assertXPath(pXmlDoc, aStyle3 + "/loext:transformation[1]", "value", "5000"); + "//style:style[@style:name='T4']/style:text-properties/loext:char-complex-color"_ostr); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); + assertXPath(pXmlDoc, aStyle3, "theme-type"_ostr, "accent3"); + assertXPath(pXmlDoc, aStyle3 + "/loext:transformation[1]", "type"_ostr, "lummod"); + assertXPath(pXmlDoc, aStyle3 + "/loext:transformation[1]", "value"_ostr, "5000"); // Shapes fill color OString aShape1("//style:style[@style:name='gr1']/style:graphic-properties/" - "loext:fill-complex-color"); - assertXPath(pXmlDoc, aStyle1, "color-type", "theme"); - assertXPath(pXmlDoc, aShape1, "theme-type", "accent2"); - assertXPath(pXmlDoc, aShape1 + "/loext:transformation[1]", "type", "lummod"); - assertXPath(pXmlDoc, aShape1 + "/loext:transformation[1]", "value", "2000"); - assertXPath(pXmlDoc, aShape1 + "/loext:transformation[2]", "type", "lumoff"); - assertXPath(pXmlDoc, aShape1 + "/loext:transformation[2]", "value", "8000"); + "loext:fill-complex-color"_ostr); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); + assertXPath(pXmlDoc, aShape1, "theme-type"_ostr, "accent2"); + assertXPath(pXmlDoc, aShape1 + "/loext:transformation[1]", "type"_ostr, "lummod"); + assertXPath(pXmlDoc, aShape1 + "/loext:transformation[1]", "value"_ostr, "2000"); + assertXPath(pXmlDoc, aShape1 + "/loext:transformation[2]", "type"_ostr, "lumoff"); + assertXPath(pXmlDoc, aShape1 + "/loext:transformation[2]", "value"_ostr, "8000"); OString aShape2("//style:style[@style:name='gr2']/style:graphic-properties/" - "loext:fill-complex-color"); - assertXPath(pXmlDoc, aStyle1, "color-type", "theme"); - assertXPath(pXmlDoc, aShape2, "theme-type", "accent2"); - assertXPath(pXmlDoc, aShape2 + "/loext:transformation[1]", "type", "lummod"); - assertXPath(pXmlDoc, aShape2 + "/loext:transformation[1]", "value", "6000"); - assertXPath(pXmlDoc, aShape2 + "/loext:transformation[2]", "type", "lumoff"); - assertXPath(pXmlDoc, aShape2 + "/loext:transformation[2]", "value", "4000"); + "loext:fill-complex-color"_ostr); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); + assertXPath(pXmlDoc, aShape2, "theme-type"_ostr, "accent2"); + assertXPath(pXmlDoc, aShape2 + "/loext:transformation[1]", "type"_ostr, "lummod"); + assertXPath(pXmlDoc, aShape2 + "/loext:transformation[1]", "value"_ostr, "6000"); + assertXPath(pXmlDoc, aShape2 + "/loext:transformation[2]", "type"_ostr, "lumoff"); + assertXPath(pXmlDoc, aShape2 + "/loext:transformation[2]", "value"_ostr, "4000"); OString aShape3("//style:style[@style:name='gr3']/style:graphic-properties/" - "loext:fill-complex-color"); - assertXPath(pXmlDoc, aStyle1, "color-type", "theme"); - assertXPath(pXmlDoc, aShape3, "theme-type", "accent2"); - assertXPath(pXmlDoc, aShape3 + "/loext:transformation[1]", "type", "lummod"); - assertXPath(pXmlDoc, aShape3 + "/loext:transformation[1]", "value", "5000"); + "loext:fill-complex-color"_ostr); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); + assertXPath(pXmlDoc, aShape3, "theme-type"_ostr, "accent2"); + assertXPath(pXmlDoc, aShape3 + "/loext:transformation[1]", "type"_ostr, "lummod"); + assertXPath(pXmlDoc, aShape3 + "/loext:transformation[1]", "value"_ostr, "5000"); // reload load(maTempFile.GetURL()); @@ -537,9 +537,10 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended) // assert XML. xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", "true"); - assertXPath(pXmlDoc, - "//draw:enhanced-geometry[@loext:extrusion-metal-type='loext:MetalMSCompatible']"); + assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-metal"_ostr, "true"); + assertXPath( + pXmlDoc, + "//draw:enhanced-geometry[@loext:extrusion-metal-type='loext:MetalMSCompatible']"_ostr); // reload mxComponent = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument"); @@ -560,8 +561,8 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict) // assert XML. xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", "true"); - assertXPath(pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-metal-type]", 0); + assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-metal"_ostr, "true"); + assertXPath(pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-metal-type]"_ostr, 0); SetODFDefaultVersion(nCurrentODFVersion); } @@ -598,9 +599,9 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended) // assert XML. xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='100%']"); + assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='100%']"_ostr); assertXPath(pXmlDoc, - "//draw:enhanced-geometry[@loext:extrusion-specularity-loext='122.0703125%']"); + "//draw:enhanced-geometry[@loext:extrusion-specularity-loext='122.0703125%']"_ostr); // reload and verify, that the loext value is used mxComponent = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument"); @@ -769,12 +770,12 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf156975_ThemeExport) const OString sThemeColorPath = sThemeColorsPath + "/loext:color"; assertXPath(pXmlDoc, sThemeColorPath, 12); - assertXPath(pXmlDoc, sThemeColorPath + "[3]", "name", "dark2"); - assertXPath(pXmlDoc, sThemeColorPath + "[3]", "color", "#002200"); - assertXPath(pXmlDoc, sThemeColorPath + "[9]", "name", "accent5"); - assertXPath(pXmlDoc, sThemeColorPath + "[9]", "color", "#880088"); - assertXPath(pXmlDoc, sThemeColorPath + "[12]", "name", "followed-hyperlink"); - assertXPath(pXmlDoc, sThemeColorPath + "[12]", "color", "#b0b0b0"); + assertXPath(pXmlDoc, sThemeColorPath + "[3]", "name"_ostr, "dark2"); + assertXPath(pXmlDoc, sThemeColorPath + "[3]", "color"_ostr, "#002200"); + assertXPath(pXmlDoc, sThemeColorPath + "[9]", "name"_ostr, "accent5"); + assertXPath(pXmlDoc, sThemeColorPath + "[9]", "color"_ostr, "#880088"); + assertXPath(pXmlDoc, sThemeColorPath + "[12]", "name"_ostr, "followed-hyperlink"); + assertXPath(pXmlDoc, sThemeColorPath + "[12]", "color"_ostr, "#b0b0b0"); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf157018_ThemeImportDraw) diff --git a/xmloff/qa/unit/style.cxx b/xmloff/qa/unit/style.cxx index 4d24f31a1fbb..3d30b0176ba1 100644 --- a/xmloff/qa/unit/style.cxx +++ b/xmloff/qa/unit/style.cxx @@ -98,8 +98,8 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFontSorting) // Then make sure <style:font-face> elements are sorted (by style:name="..."): xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - xmlXPathObjectPtr pXPath - = getXPathNode(pXmlDoc, "/office:document-content/office:font-face-decls/style:font-face"); + xmlXPathObjectPtr pXPath = getXPathNode( + pXmlDoc, "/office:document-content/office:font-face-decls/style:font-face"_ostr); xmlNodeSetPtr pXmlNodes = pXPath->nodesetval; int nNodeCount = xmlXPathNodeSetGetLength(pXmlNodes); std::vector<XmlFont> aXMLFonts; @@ -196,11 +196,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR) xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); assertXPath(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:name='FrameBTLR']/" - "style:graphic-properties[@loext:writing-mode]"); + "style:graphic-properties[@loext:writing-mode]"_ostr); assertXPath(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:name='FrameBTLR']/" - "style:graphic-properties", - "writing-mode", "bt-lr"); + "style:graphic-properties"_ostr, + "writing-mode"_ostr, "bt-lr"); } loadFromURL(u"tdf150407_WritingModeBTLR_style.odt"); @@ -217,8 +217,8 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR) xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/" - "style:style[@style:name='FrameBTLR']/style:graphic-properties", - "writing-mode"); + "style:style[@style:name='FrameBTLR']/style:graphic-properties"_ostr, + "writing-mode"_ostr); } } @@ -251,12 +251,12 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) assertXPath( pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/" - "style:graphic-properties[@loext:vertical-rel]"); + "style:graphic-properties[@loext:vertical-rel]"_ostr); assertXPath( pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/" - "style:graphic-properties", - "vertical-rel", "page-content-bottom"); + "style:graphic-properties"_ostr, + "vertical-rel"_ostr, "page-content-bottom"); } loadFromURL(u"tdf150407_PosRelBottomMargin.docx"); @@ -273,8 +273,8 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); assertXPathNoAttribute(pXmlDoc, "/office:document-content/office:automatic-styles/" - "style:style[@style:name='gr1']/style:graphic-properties", - "vertical-rel"); + "style:style[@style:name='gr1']/style:graphic-properties"_ostr, + "vertical-rel"_ostr); } } @@ -307,12 +307,12 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) assertXPath( pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/" - "style:graphic-properties[@loext:vertical-rel]"); + "style:graphic-properties[@loext:vertical-rel]"_ostr); assertXPath( pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/" - "style:graphic-properties", - "vertical-rel", "page-content-top"); + "style:graphic-properties"_ostr, + "vertical-rel"_ostr, "page-content-top"); } loadFromURL(u"tdf150407_PosRelTopMargin.docx"); @@ -329,8 +329,8 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); assertXPathNoAttribute(pXmlDoc, "/office:document-content/office:automatic-styles/" - "style:style[@style:name='gr1']/style:graphic-properties", - "vertical-rel"); + "style:style[@style:name='gr1']/style:graphic-properties"_ostr, + "vertical-rel"_ostr); } } @@ -346,18 +346,19 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_OldToNew) // Examine file markup // For compatibility the file should still have the old attributes 'start-color' and 'end-color' xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); - OString sPath = "/office:document-styles/office:styles/draw:gradient[@draw:name='red2yellow']"; - assertXPath(pXmlDoc, sPath, "start-color", "#ff0000"); - assertXPath(pXmlDoc, sPath, "end-color", "#ffff00"); + OString sPath + = "/office:document-styles/office:styles/draw:gradient[@draw:name='red2yellow']"_ostr; + assertXPath(pXmlDoc, sPath, "start-color"_ostr, "#ff0000"); + assertXPath(pXmlDoc, sPath, "end-color"_ostr, "#ffff00"); // And it must have the new 'gradient-stop' elements. // The prefix 'loext' needs to be adapted, when the element is available in ODF strict. - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset", "0"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-type", "rgb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value", "#ff0000"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset", "1"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-type", "rgb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value", "#ffff00"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset"_ostr, "0"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-type"_ostr, "rgb"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value"_ostr, "#ff0000"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset"_ostr, "1"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-type"_ostr, "rgb"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value"_ostr, "#ffff00"); // Examine reloaded file uno::Reference<drawing::XShape> xShape(getShape(0)); @@ -399,24 +400,24 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_OldToNew_opacity) // Examine file markup // For compatibility the file should still have the old attributes. xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); - OString sPath = "/office:document-styles/office:styles/draw:opacity"; - assertXPath(pXmlDoc, sPath, "start", "10%"); // UI 90% transparency - assertXPath(pXmlDoc, sPath, "end", "100%"); // UI 0% transparency - assertXPath(pXmlDoc, sPath, "border", "20%"); - assertXPath(pXmlDoc, sPath, "cx", "50%"); - assertXPath(pXmlDoc, sPath, "cy", "50%"); - assertXPath(pXmlDoc, sPath, "style", "radial"); + OString sPath = "/office:document-styles/office:styles/draw:opacity"_ostr; + assertXPath(pXmlDoc, sPath, "start"_ostr, "10%"); // UI 90% transparency + assertXPath(pXmlDoc, sPath, "end"_ostr, "100%"); // UI 0% transparency + assertXPath(pXmlDoc, sPath, "border"_ostr, "20%"); + assertXPath(pXmlDoc, sPath, "cx"_ostr, "50%"); + assertXPath(pXmlDoc, sPath, "cy"_ostr, "50%"); + assertXPath(pXmlDoc, sPath, "style"_ostr, "radial"); // And it must have the new 'opacity-stop' elements. // The prefix 'loext' needs to be adapted, when the element is available in ODF strict. OString sFirstStop = sPath + "/loext:opacity-stop[1]"; - assertXPath(pXmlDoc, sFirstStop, "offset", "0"); + assertXPath(pXmlDoc, sFirstStop, "offset"_ostr, "0"); // Because of converting through color, the grade of opacity is not exact "0.1" double fOpacity = getXPathContent(pXmlDoc, sFirstStop + "/@svg:stop-opacity").toDouble(); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.1, fOpacity, 0.002); - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "offset", "1"); - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "stop-opacity", "1"); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "offset"_ostr, "1"); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "stop-opacity"_ostr, "1"); // Examine reloaded file uno::Reference<drawing::XShape> xShape(getShape(0)); @@ -459,26 +460,27 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_threeStops) // Examine file markup // For compatibility the file should still have the old attributes 'start-color' and 'end-color' xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); - OString sPath = "/office:document-styles/office:styles/draw:gradient[@draw:name='threeStops']"; - assertXPath(pXmlDoc, sPath, "start-color", "#ff0000"); - assertXPath(pXmlDoc, sPath, "end-color", "#ffff00"); - assertXPath(pXmlDoc, sPath, "style", "square"); - assertXPath(pXmlDoc, sPath, "cx", "0%"); - assertXPath(pXmlDoc, sPath, "cy", "50%"); - assertXPath(pXmlDoc, sPath, "angle", "45deg"); - assertXPath(pXmlDoc, sPath, "border", "10%"); + OString sPath + = "/office:document-styles/office:styles/draw:gradient[@draw:name='threeStops']"_ostr; + assertXPath(pXmlDoc, sPath, "start-color"_ostr, "#ff0000"); + assertXPath(pXmlDoc, sPath, "end-color"_ostr, "#ffff00"); + assertXPath(pXmlDoc, sPath, "style"_ostr, "square"); + assertXPath(pXmlDoc, sPath, "cx"_ostr, "0%"); + assertXPath(pXmlDoc, sPath, "cy"_ostr, "50%"); + assertXPath(pXmlDoc, sPath, "angle"_ostr, "45deg"); + assertXPath(pXmlDoc, sPath, "border"_ostr, "10%"); // And it must have the new 'gradient-stop' elements. // The prefix 'loext' needs to be adapted, when the element is available in ODF strict. - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset", "0"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-type", "rgb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value", "#ff0000"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset", "0.3"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-type", "rgb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value", "#0099bb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "offset", "1"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "color-type", "rgb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "color-value", "#ffff00"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset"_ostr, "0"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-type"_ostr, "rgb"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value"_ostr, "#ff0000"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset"_ostr, "0.3"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-type"_ostr, "rgb"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value"_ostr, "#0099bb"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "offset"_ostr, "1"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "color-type"_ostr, "rgb"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "color-value"_ostr, "#ffff00"); // Examine reloaded file uno::Reference<drawing::XShape> xShape(getShape(0)); @@ -536,21 +538,21 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBorderRestoration) save("impress8"); xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); OString sPath - = "/office:document-styles/office:styles/draw:gradient[@draw:name='Gradient_20_1']"; - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value", "#ff0000"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset", "1"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value", "#ffff00"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset", "0"); - assertXPath(pXmlDoc, sPath, "border", "50%"); + = "/office:document-styles/office:styles/draw:gradient[@draw:name='Gradient_20_1']"_ostr; + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value"_ostr, "#ff0000"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset"_ostr, "1"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value"_ostr, "#ffff00"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset"_ostr, "0"); + assertXPath(pXmlDoc, sPath, "border"_ostr, "50%"); // Save to ODF 1.3 strict and make sure border, start-color and end-color are suitable set. SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion::ODFVER_013); save("impress8"); pXmlDoc = parseExport("styles.xml"); assertXPath(pXmlDoc, sPath + "/loext:gradient-stop", 0); - assertXPath(pXmlDoc, sPath, "start-color", "#ffff00"); - assertXPath(pXmlDoc, sPath, "end-color", "#ff0000"); - assertXPath(pXmlDoc, sPath, "border", "50%"); + assertXPath(pXmlDoc, sPath, "start-color"_ostr, "#ffff00"); + assertXPath(pXmlDoc, sPath, "end-color"_ostr, "#ff0000"); + assertXPath(pXmlDoc, sPath, "border"_ostr, "50%"); // Set back to original ODF default version. SetODFDefaultVersion(nCurrentODFVersion); @@ -573,21 +575,21 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testTransparencyBorderRestoration) SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion::ODFVER_LATEST); save("impress8"); xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); - OString sPath = "/office:document-styles/office:styles/draw:opacity[1]"; - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "stop-opacity", "0.9"); - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "offset", "1"); - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[1]", "stop-opacity", "0"); - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[1]", "offset", "0"); - assertXPath(pXmlDoc, sPath, "border", "40%"); + OString sPath = "/office:document-styles/office:styles/draw:opacity[1]"_ostr; + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "stop-opacity"_ostr, "0.9"); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "offset"_ostr, "1"); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[1]", "stop-opacity"_ostr, "0"); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[1]", "offset"_ostr, "0"); + assertXPath(pXmlDoc, sPath, "border"_ostr, "40%"); // Save to ODF 1.3 strict and make sure border, start and end opacity are suitable set. SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion::ODFVER_013); save("impress8"); pXmlDoc = parseExport("styles.xml"); assertXPath(pXmlDoc, sPath + "/loext:opacity-stop", 0); - assertXPath(pXmlDoc, sPath, "start", "0%"); - assertXPath(pXmlDoc, sPath, "end", "90%"); - assertXPath(pXmlDoc, sPath, "border", "40%"); + assertXPath(pXmlDoc, sPath, "start"_ostr, "0%"); + assertXPath(pXmlDoc, sPath, "end"_ostr, "90%"); + assertXPath(pXmlDoc, sPath, "border"_ostr, "40%"); // Set back to original ODF default version. SetODFDefaultVersion(nCurrentODFVersion); diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx index 2a5350423c0d..7462e23f7c39 100644 --- a/xmloff/qa/unit/text.cxx +++ b/xmloff/qa/unit/text.cxx @@ -209,8 +209,9 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testParaStyleListLevel) // Without the accompanying fix in place, this failed with: // - XPath '/office:document-styles/office:styles/style:style[@style:name='mystyle']' no attribute 'list-level' exist // i.e. a custom NumberingLevel was lost on save. - assertXPath(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:name='mystyle']", - "list-level", "2"); + assertXPath(pXmlDoc, + "/office:document-styles/office:styles/style:style[@style:name='mystyle']"_ostr, + "list-level"_ostr, "2"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContinueNumberingWord) @@ -248,7 +249,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId) // Without the accompanying fix in place, this failed with: // - XPath '//text:list' unexpected 'id' attribute // i.e. xml:id="..." was written unconditionally, even when no other list needed it. - assertXPathNoAttribute(pXmlDoc, "//text:list", "id"); + assertXPathNoAttribute(pXmlDoc, "//text:list"_ostr, "id"_ostr); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId2) @@ -313,11 +314,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId2) CPPUNIT_ASSERT(pXmlDoc); // Without the fix in place, this would fail, // i.e. xml:id="..." was omitted, even though it was needed for the next item. - OUString id - = getXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:list[3]", "id"); + OUString id = getXPath( + pXmlDoc, "/office:document-content/office:body/office:text/text:list[3]"_ostr, "id"_ostr); CPPUNIT_ASSERT(!id.isEmpty()); - assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:list[4]", - "continue-list", id); + assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:list[4]"_ostr, + "continue-list"_ostr, id); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListIdState) @@ -349,8 +350,8 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListIdState) // Without the accompanying fix in place, this test would have failed, // i.e. para 1 didn't write an xml:id="..." but para 3 referred to it using continue-list="...", // which is inconsistent. - OUString id - = getXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:list[1]", "id"); + OUString id = getXPath( + pXmlDoc, "/office:document-content/office:body/office:text/text:list[1]"_ostr, "id"_ostr); CPPUNIT_ASSERT(!id.isEmpty()); } @@ -407,12 +408,12 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListIdOnRestart) // Then make sure that no xml:id="..." attribute is written, even in restarted case: xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); CPPUNIT_ASSERT(pXmlDoc); - assertXPath(pXmlDoc, "//text:list", 3); - assertXPathNoAttribute(pXmlDoc, "//text:list[1]", "id"); - assertXPathNoAttribute(pXmlDoc, "//text:list[2]", "id"); - assertXPathNoAttribute(pXmlDoc, "//text:list[3]", "id"); - assertXPathNoAttribute(pXmlDoc, "//text:list[3]", "continue-list"); - assertXPath(pXmlDoc, "//text:list[3]", "continue-numbering", "true"); + assertXPath(pXmlDoc, "//text:list"_ostr, 3); + assertXPathNoAttribute(pXmlDoc, "//text:list[1]"_ostr, "id"_ostr); + assertXPathNoAttribute(pXmlDoc, "//text:list[2]"_ostr, "id"_ostr); + assertXPathNoAttribute(pXmlDoc, "//text:list[3]"_ostr, "id"_ostr); + assertXPathNoAttribute(pXmlDoc, "//text:list[3]"_ostr, "continue-list"_ostr); + assertXPath(pXmlDoc, "//text:list[3]"_ostr, "continue-numbering"_ostr, "true"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakExport) @@ -439,7 +440,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakExport) // Without the accompanying fix in place, this failed with: // - XPath '//text:line-break' number of nodes is incorrect // i.e. the clearing break was lost on export. - assertXPath(pXmlDoc, "//text:line-break", "clear", "all"); + assertXPath(pXmlDoc, "//text:line-break"_ostr, "clear"_ostr, "all"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakImport) @@ -508,7 +509,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRelativeWidth) // - Actual : 0.0161in (0.04 cm) // i.e. the fallback width value wasn't the expected half of the body frame width, but a smaller // value. - assertXPath(pXmlDoc, "//draw:frame", "width", "3.1492in"); + assertXPath(pXmlDoc, "//draw:frame"_ostr, "width"_ostr, "3.1492in"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testScaleWidthAndHeight) @@ -538,7 +539,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testScaleWidthAndHeight) // - Expected: 0.7874in // - Actual : 0in // i.e. the exported size was 0, not 2000 mm100 in inches. - assertXPath(pXmlDoc, "//draw:frame", "width", "0.7874in"); + assertXPath(pXmlDoc, "//draw:frame"_ostr, "width"_ostr, "0.7874in"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlExport) @@ -566,7 +567,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlExport) // Without the accompanying fix in place, this failed with: // - XPath '//loext:content-control' number of nodes is incorrect // i.e. the content control was lost on export. - assertXPath(pXmlDoc, "//loext:content-control", "showing-place-holder", "true"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "showing-place-holder"_ostr, "true"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlImport) @@ -625,10 +626,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlExport) // Then make sure the expected markup is used: xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, "//loext:content-control", "checkbox", "true"); - assertXPath(pXmlDoc, "//loext:content-control", "checked", "true"); - assertXPath(pXmlDoc, "//loext:content-control", "checked-state", u"☒"_ustr); - assertXPath(pXmlDoc, "//loext:content-control", "unchecked-state", u"☐"_ustr); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "checkbox"_ostr, "true"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "checked"_ostr, "true"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "checked-state"_ostr, u"☒"_ustr); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "unchecked-state"_ostr, u"☐"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlImport) @@ -712,18 +713,21 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlExport) // Then make sure the expected markup is used: xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, "//loext:content-control", "dropdown", "true"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "dropdown"_ostr, "true"); // Without the accompanying fix in place, this failed with: // - Expected: 1 // - Actual : 0 // - XPath '//loext:content-control/loext:list-item[1]' number of nodes is incorrect // i.e. the list items were lost on export. - assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[1]", "display-text", "red"); - assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[1]", "value", "R"); - assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[2]", "display-text", "green"); - assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[2]", "value", "G"); - assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[3]", "display-text", "blue"); - assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[3]", "value", "B"); + assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[1]"_ostr, "display-text"_ostr, + "red"); + assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[1]"_ostr, "value"_ostr, "R"); + assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[2]"_ostr, "display-text"_ostr, + "green"); + assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[2]"_ostr, "value"_ostr, "G"); + assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[3]"_ostr, "display-text"_ostr, + "blue"); + assertXPath(pXmlDoc, "//loext:content-control/loext:list-item[3]"_ostr, "value"_ostr, "B"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlImport) @@ -799,7 +803,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPictureContentControlExport) xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); // Without the accompanying fix in place, this test would have failed with: // - XPath '//loext:content-control' no attribute 'picture' exist - assertXPath(pXmlDoc, "//loext:content-control", "picture", "true"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "picture"_ostr, "true"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPictureContentControlImport) @@ -857,10 +861,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDateContentControlExport) xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); // Without the accompanying fix in place, this test would have failed with: // - XPath '//loext:content-control' no attribute 'date' exist - assertXPath(pXmlDoc, "//loext:content-control", "date", "true"); - assertXPath(pXmlDoc, "//loext:content-control", "date-format", "YYYY-MM-DD"); - assertXPath(pXmlDoc, "//loext:content-control", "date-rfc-language-tag", "en-US"); - assertXPath(pXmlDoc, "//loext:content-control", "current-date", "2022-05-25T00:00:00Z"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "date"_ostr, "true"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "date-format"_ostr, "YYYY-MM-DD"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "date-rfc-language-tag"_ostr, "en-US"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "current-date"_ostr, + "2022-05-25T00:00:00Z"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDateContentControlImport) @@ -924,7 +929,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPlainTextContentControlExport) // Without the accompanying fix in place, this test would have failed with: // - XPath '//loext:content-control' no attribute 'plain-text' exist // i.e. the plain text content control was turned into a rich text one on export. - assertXPath(pXmlDoc, "//loext:content-control", "plain-text", "true"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "plain-text"_ostr, "true"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPlainTextContentControlImport) @@ -979,7 +984,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testComboBoxContentControlExport) // Without the accompanying fix in place, this test would have failed with: // - XPath '//loext:content-control' no attribute 'combobox' exist // i.e. the combo box content control was turned into a drop-down one on export. - assertXPath(pXmlDoc, "//loext:content-control", "combobox", "true"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "combobox"_ostr, "true"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testAliasContentControlExport) @@ -1012,11 +1017,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testAliasContentControlExport) // - Expression: prop // - XPath '//loext:content-control' no attribute 'alias' exist // i.e. alias was lost on export. - assertXPath(pXmlDoc, "//loext:content-control", "alias", "my alias"); - assertXPath(pXmlDoc, "//loext:content-control", "tag", "my tag"); - assertXPath(pXmlDoc, "//loext:content-control", "id", "-2147483648"); - assertXPath(pXmlDoc, "//loext:content-control", "tab-index", "3"); - assertXPath(pXmlDoc, "//loext:content-control", "lock", "unlocked"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "alias"_ostr, "my alias"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "tag"_ostr, "my tag"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "id"_ostr, "-2147483648"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "tab-index"_ostr, "3"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "lock"_ostr, "unlocked"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testComboBoxContentControlImport) @@ -1121,7 +1126,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testScaleWidthRedline) // - Expected: 6.1728in // - Actual : 0in // i.e. the deleted image had zero size, which is incorrect. - assertXPath(pXmlDoc, "//draw:frame[@draw:name='Image45']", "width", "6.1728in"); + assertXPath(pXmlDoc, "//draw:frame[@draw:name='Image45']"_ostr, "width"_ostr, "6.1728in"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testThemeExport) @@ -1156,14 +1161,14 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testThemeExport) // Check if the 12 colors are written in the XML: xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); - OString aThemePath = "//office:styles/loext:theme/loext:theme-colors/loext:color"; + OString aThemePath = "//office:styles/loext:theme/loext:theme-colors/loext:color"_ostr; assertXPath(pXmlDoc, aThemePath, 12); - assertXPath(pXmlDoc, aThemePath + "[1]", "name", "dark1"); - assertXPath(pXmlDoc, aThemePath + "[1]", "color", "#101010"); - assertXPath(pXmlDoc, aThemePath + "[2]", "name", "light1"); - assertXPath(pXmlDoc, aThemePath + "[2]", "color", "#202020"); - assertXPath(pXmlDoc, aThemePath + "[12]", "name", "followed-hyperlink"); - assertXPath(pXmlDoc, aThemePath + "[12]", "color", "#c0c0c0"); + assertXPath(pXmlDoc, aThemePath + "[1]", "name"_ostr, "dark1"); + assertXPath(pXmlDoc, aThemePath + "[1]", "color"_ostr, "#101010"); + assertXPath(pXmlDoc, aThemePath + "[2]", "name"_ostr, "light1"); + assertXPath(pXmlDoc, aThemePath + "[2]", "color"_ostr, "#202020"); + assertXPath(pXmlDoc, aThemePath + "[12]", "name"_ostr, "followed-hyperlink"); + assertXPath(pXmlDoc, aThemePath + "[12]", "color"_ostr, "#c0c0c0"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFloatingTableExport) @@ -1197,7 +1202,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFloatingTableExport) // Without the accompanying fix in place, this test would have failed with: // - XPath '//draw:frame' no attribute 'may-break-between-pages' exist // i.e. no floating table was exported. - assertXPath(pXmlDoc, "//draw:frame", "may-break-between-pages", "true"); + assertXPath(pXmlDoc, "//draw:frame"_ostr, "may-break-between-pages"_ostr, "true"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFloatingTableImport) @@ -1250,10 +1255,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testParagraphScopedTabDistance) // Then make sure we write the tab-stop-distance xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, "//style:style[@style:name='P1']/style:paragraph-properties", - "tab-stop-distance", "10cm"); + assertXPath(pXmlDoc, "//style:style[@style:name='P1']/style:paragraph-properties"_ostr, + "tab-stop-distance"_ostr, "10cm"); - assertXPath(pXmlDoc, "//text:p[@text:style-name='P1']"); + assertXPath(pXmlDoc, "//text:p[@text:style-name='P1']"_ostr); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testNestedSpans)