svx/qa/unit/customshapes.cxx | 2 svx/qa/unit/sdr.cxx | 48 svx/qa/unit/svdraw.cxx | 119 svx/qa/unit/table.cxx | 38 svx/qa/unit/unodraw.cxx | 4 svx/source/dialog/ClassificationDialog.cxx | 2 svx/source/svdraw/svdmrkv.cxx | 10 svx/source/table/tablecontroller.cxx | 8 svx/source/tbxctrls/StylesPreviewWindow.cxx | 2 svx/source/unodraw/UnoGraphicExporter.cxx | 4 sw/qa/core/doc/doc.cxx | 2 sw/qa/core/frmedt/frmedt.cxx | 3 sw/qa/core/layout/layout.cxx | 105 sw/qa/core/layout/paintfrm.cxx | 6 sw/qa/core/layout/tabfrm.cxx | 2 sw/qa/core/objectpositioning/objectpositioning.cxx | 68 sw/qa/core/text/text.cxx | 130 sw/qa/core/txtnode/txtnode.cxx | 4 sw/qa/core/unocore/unocore.cxx | 18 sw/qa/extras/docbookexport/docbookexport.cxx | 2 sw/qa/extras/fodfexport/fodfexport.cxx | 8 sw/qa/extras/globalfilter/globalfilter.cxx | 216 - sw/qa/extras/htmlexport/htmlexport.cxx | 371 +- sw/qa/extras/htmlexport/xhtmlexport.cxx | 6 sw/qa/extras/indexing/IndexingExportTest.cxx | 258 - sw/qa/extras/indexing/SearchResultLocatorTest.cxx | 6 sw/qa/extras/layout/layout.cxx | 2900 +++++++++++---------- sw/qa/extras/layout/layout2.cxx | 1401 +++++----- sw/qa/extras/layout/layout3.cxx | 672 ++-- sw/qa/extras/mailmerge/mailmerge.cxx | 44 sw/qa/extras/mailmerge/mailmerge2.cxx | 28 sw/qa/extras/odfexport/odfexport.cxx | 402 +- sw/qa/extras/odfexport/odfexport2.cxx | 238 - sw/qa/extras/odfimport/odfimport.cxx | 54 sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 302 +- sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 54 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 76 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 719 ++--- sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 224 - sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 380 +- sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 244 - sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 126 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 130 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 110 sw/qa/extras/ooxmlexport/ooxmlexport19.cxx | 71 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx | 128 sw/qa/extras/ooxmlexport/ooxmlexport20.cxx | 398 +- sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 362 +- sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 280 +- sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 226 - sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 290 +- sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 614 ++-- sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 14 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 326 +- sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx | 4 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 192 - sw/qa/extras/ooxmlexport/ooxmllinks.cxx | 28 sw/qa/extras/ooxmlexport/ooxmlw14export.cxx | 772 ++--- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 48 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 14 sw/qa/extras/rtfexport/rtfexport3.cxx | 7 sw/qa/extras/rtfexport/rtfexport4.cxx | 28 sw/qa/extras/rtfexport/rtfexport5.cxx | 33 sw/qa/extras/rtfexport/rtfexport6.cxx | 21 sw/qa/extras/rtfimport/rtfimport.cxx | 10 sw/qa/extras/tiledrendering/tiledrendering.cxx | 86 sw/qa/extras/txtexport/txtexport.cxx | 6 sw/qa/extras/txtimport/txtimport.cxx | 2 sw/qa/extras/uiwriter/uiwriter.cxx | 10 sw/qa/extras/uiwriter/uiwriter2.cxx | 161 - sw/qa/extras/uiwriter/uiwriter3.cxx | 251 - sw/qa/extras/uiwriter/uiwriter4.cxx | 183 - sw/qa/extras/uiwriter/uiwriter5.cxx | 260 - sw/qa/extras/uiwriter/uiwriter6.cxx | 188 - sw/qa/extras/uiwriter/uiwriter7.cxx | 20 sw/qa/extras/uiwriter/uiwriter8.cxx | 195 - sw/qa/extras/ww8export/ww8export.cxx | 82 sw/qa/extras/ww8export/ww8export2.cxx | 18 sw/qa/extras/ww8export/ww8export3.cxx | 8 sw/qa/extras/ww8export/ww8export4.cxx | 4 sw/qa/extras/ww8import/ww8import.cxx | 6 sw/qa/filter/html/html.cxx | 15 sw/qa/filter/ww8/ww8.cxx | 30 sw/qa/uibase/shells/shells.cxx | 16 sw/qa/uibase/shells/textsh.cxx | 2 sw/qa/uibase/uiview/uiview.cxx | 2 sw/source/core/crsr/bookmark.cxx | 2 sw/source/core/frmedt/feshview.cxx | 2 sw/source/core/inc/swfntcch.hxx | 2 sw/source/core/layout/dbg_lay.cxx | 6 sw/source/core/layout/newfrm.cxx | 2 sw/source/core/model/SearchResultLocator.cxx | 6 sw/source/core/text/txtfrm.cxx | 2 sw/source/core/text/txtinit.cxx | 2 sw/source/filter/html/css1atr.cxx | 82 sw/source/filter/html/htmlatr.cxx | 12 sw/source/filter/html/htmlflywriter.cxx | 10 sw/source/filter/html/htmlforw.cxx | 2 sw/source/filter/html/htmlftn.cxx | 2 sw/source/filter/html/htmlplug.cxx | 2 sw/source/filter/html/htmlreqifreader.cxx | 8 sw/source/filter/html/htmltabw.cxx | 2 sw/source/filter/html/wrthtml.cxx | 2 sw/source/filter/indexing/IndexingExport.cxx | 14 sw/source/filter/ww8/docxattributeoutput.cxx | 164 - sw/source/filter/ww8/rtfattributeoutput.cxx | 101 sw/source/ui/misc/translatelangselect.cxx | 56 sw/source/uibase/app/swmodule.cxx | 2 sw/source/uibase/shells/translatehelper.cxx | 14 sw/source/uibase/uiview/view.cxx | 6 sw/source/uibase/uiview/viewsrch.cxx | 2 sw/source/uibase/uiview/viewstat.cxx | 4 112 files changed, 8066 insertions(+), 7400 deletions(-)
New commits: commit 79e8a54893c4a95d732388326eecd1ad151017d9 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Nov 19 13:26:03 2023 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Nov 19 17:29:59 2023 +0100 Extended loplugin:ostr: svx Change-Id: I290b1c60c8030b5345a1c2fa3816e83e21967cf6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159671 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 523cf7342b7b..34a60fdbc3e4 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -1177,7 +1177,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf136176) saveAndReload("draw8"); // Expected values of point 4 of the shape polygon - const OString sTestCase[] = { "FlipH", "FlipV", "FlipHV" }; + const OString sTestCase[] = { "FlipH"_ostr, "FlipV"_ostr, "FlipHV"_ostr }; const double fX[] = { 14981.0, 3849.0, 15214.0 }; const double fY[] = { 9366.0, 16464.0, 23463.0 }; diff --git a/svx/qa/unit/sdr.cxx b/svx/qa/unit/sdr.cxx index 4d6c4226d11b..74885586a3b1 100644 --- a/svx/qa/unit/sdr.cxx +++ b/svx/qa/unit/sdr.cxx @@ -69,8 +69,8 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowScaleOrigin) // Examine the created primitives. drawinglayer::Primitive2dXmlDump aDumper; xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence); - sal_Int32 fShadowX = getXPath(pDocument, "//shadow/transform", "xy13").toInt32(); - sal_Int32 fShadowY = getXPath(pDocument, "//shadow/transform", "xy23").toInt32(); + sal_Int32 fShadowX = getXPath(pDocument, "//shadow/transform"_ostr, "xy13"_ostr).toInt32(); + sal_Int32 fShadowY = getXPath(pDocument, "//shadow/transform"_ostr, "xy23"_ostr).toInt32(); // Without the accompanying fix in place, this test would have failed with: // - Expected: -705 // - Actual : -158 @@ -101,32 +101,32 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowAlignment) // - Actual : 162 // - In <>, attribute 'xy13' of '(//shadow/transform)[1]' incorrect value. // i.e. shadow alignment was ignored while scaling the shadow. - assertXPath(pDocument, "(//shadow/transform)[1]", "xy13", "-567"); - assertXPath(pDocument, "(//shadow/transform)[1]", "xy23", "162"); + assertXPath(pDocument, "(//shadow/transform)[1]"_ostr, "xy13"_ostr, "-567"); + assertXPath(pDocument, "(//shadow/transform)[1]"_ostr, "xy23"_ostr, "162"); - assertXPath(pDocument, "(//shadow/transform)[2]", "xy13", "-1794"); - assertXPath(pDocument, "(//shadow/transform)[2]", "xy23", "162"); + assertXPath(pDocument, "(//shadow/transform)[2]"_ostr, "xy13"_ostr, "-1794"); + assertXPath(pDocument, "(//shadow/transform)[2]"_ostr, "xy23"_ostr, "162"); - assertXPath(pDocument, "(//shadow/transform)[3]", "xy13", "-3021"); - assertXPath(pDocument, "(//shadow/transform)[3]", "xy23", "161"); + assertXPath(pDocument, "(//shadow/transform)[3]"_ostr, "xy13"_ostr, "-3021"); + assertXPath(pDocument, "(//shadow/transform)[3]"_ostr, "xy23"_ostr, "161"); - assertXPath(pDocument, "(//shadow/transform)[4]", "xy13", "-567"); - assertXPath(pDocument, "(//shadow/transform)[4]", "xy23", "-749"); + assertXPath(pDocument, "(//shadow/transform)[4]"_ostr, "xy13"_ostr, "-567"); + assertXPath(pDocument, "(//shadow/transform)[4]"_ostr, "xy23"_ostr, "-749"); - assertXPath(pDocument, "(//shadow/transform)[5]", "xy13", "-3021"); - assertXPath(pDocument, "(//shadow/transform)[5]", "xy23", "-750"); + assertXPath(pDocument, "(//shadow/transform)[5]"_ostr, "xy13"_ostr, "-3021"); + assertXPath(pDocument, "(//shadow/transform)[5]"_ostr, "xy23"_ostr, "-750"); - assertXPath(pDocument, "(//shadow/transform)[6]", "xy13", "-566"); - assertXPath(pDocument, "(//shadow/transform)[6]", "xy23", "-1691"); + assertXPath(pDocument, "(//shadow/transform)[6]"_ostr, "xy13"_ostr, "-566"); + assertXPath(pDocument, "(//shadow/transform)[6]"_ostr, "xy23"_ostr, "-1691"); - assertXPath(pDocument, "(//shadow/transform)[7]", "xy13", "-1794"); - assertXPath(pDocument, "(//shadow/transform)[7]", "xy23", "-1693"); + assertXPath(pDocument, "(//shadow/transform)[7]"_ostr, "xy13"_ostr, "-1794"); + assertXPath(pDocument, "(//shadow/transform)[7]"_ostr, "xy23"_ostr, "-1693"); - assertXPath(pDocument, "(//shadow/transform)[8]", "xy13", "-3022"); - assertXPath(pDocument, "(//shadow/transform)[8]", "xy23", "-1691"); + assertXPath(pDocument, "(//shadow/transform)[8]"_ostr, "xy13"_ostr, "-3022"); + assertXPath(pDocument, "(//shadow/transform)[8]"_ostr, "xy23"_ostr, "-1691"); - assertXPath(pDocument, "(//shadow/transform)[9]", "xy13", "-1794"); - assertXPath(pDocument, "(//shadow/transform)[9]", "xy23", "-750"); + assertXPath(pDocument, "(//shadow/transform)[9]"_ostr, "xy13"_ostr, "-1794"); + assertXPath(pDocument, "(//shadow/transform)[9]"_ostr, "xy23"_ostr, "-750"); } { // Page 2 contains a table with shadow alignment center @@ -143,8 +143,8 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowAlignment) // - Expected: -5196 // - Actual : 0 // - In<>, attribute 'xy13' of '//shadow/transform' incorrect value. - assertXPath(pDocument, "//shadow/transform", "xy13", "-5196"); - assertXPath(pDocument, "//shadow/transform", "xy23", "-2290"); + assertXPath(pDocument, "//shadow/transform"_ostr, "xy13"_ostr, "-5196"); + assertXPath(pDocument, "//shadow/transform"_ostr, "xy23"_ostr, "-2290"); } } @@ -165,7 +165,7 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testZeroWidthTextWrap) // - Expected: 1 // - Actual : 12 // i.e. the text on the only shape on the slide had 12 lines, not a single one. - assertXPath(pDocument, "//textsimpleportion", 1); + assertXPath(pDocument, "//textsimpleportion"_ostr, 1); } CPPUNIT_TEST_FIXTURE(SdrTest, testSlideBackground) @@ -187,7 +187,7 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testSlideBackground) // - Expected: 1 // - Actual : 0 // i.e. the rendering did not find the bitmap. - assertXPath(pDocument, "//bitmap", 1); + assertXPath(pDocument, "//bitmap"_ostr, 1); } } diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index 1284fa6305bf..8a6a39892b9d 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -123,7 +123,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSemiTransparentText) // - XPath '//unifiedtransparence' number of nodes is incorrect // i.e. the text was just plain red, not semi-transparent. sal_Int16 fTransparence - = getXPath(pDocument, "//unifiedtransparence", "transparence").toInt32(); + = getXPath(pDocument, "//unifiedtransparence"_ostr, "transparence"_ostr).toInt32(); CPPUNIT_ASSERT_EQUAL(nTransparence, fTransparence); } @@ -288,40 +288,40 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObject) drawinglayer::Primitive2dXmlDump aDumper; xmlDocUniquePtr pXmlDoc = aDumper.dumpAndParse(xPrimitiveSequence); - assertXPath(pXmlDoc, "/primitive2D", 1); + assertXPath(pXmlDoc, "/primitive2D"_ostr, 1); - OString aBasePath("/primitive2D/sdrrectangle/polypolygoncolor"); - assertXPath(pXmlDoc, aBasePath, "color", "#729fcf"); + OString aBasePath("/primitive2D/sdrrectangle/polypolygoncolor"_ostr); + assertXPath(pXmlDoc, aBasePath, "color"_ostr, "#729fcf"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "height", + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "height"_ostr, "99"); // weird Rectangle is created with size 100 - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "width", "99"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "minx", "0"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "miny", "0"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxx", "99"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxy", "99"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "width"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "minx"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "miny"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxx"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxy"_ostr, "99"); aBasePath = "/primitive2D/sdrrectangle/polypolygoncolor/polypolygon/polygon"; assertXPath(pXmlDoc, aBasePath + "/point", 5); - assertXPath(pXmlDoc, aBasePath + "/point[1]", "x", "49.5"); // hmm, weird, why? - assertXPath(pXmlDoc, aBasePath + "/point[1]", "y", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[2]", "x", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[2]", "y", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[3]", "x", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[3]", "y", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[4]", "x", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[4]", "y", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[5]", "x", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[5]", "y", "99"); + assertXPath(pXmlDoc, aBasePath + "/point[1]", "x"_ostr, "49.5"); // hmm, weird, why? + assertXPath(pXmlDoc, aBasePath + "/point[1]", "y"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[2]", "x"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[2]", "y"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[3]", "x"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[3]", "y"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[4]", "x"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[4]", "y"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[5]", "x"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[5]", "y"_ostr, "99"); aBasePath = "/primitive2D/sdrrectangle/polygonstroke"; assertXPath(pXmlDoc, aBasePath, 1); - assertXPath(pXmlDoc, aBasePath + "/line", "color", "#3465a4"); - assertXPath(pXmlDoc, aBasePath + "/line", "width", "0"); - assertXPath(pXmlDoc, aBasePath + "/line", "linejoin", "Round"); - assertXPath(pXmlDoc, aBasePath + "/line", "linecap", "BUTT"); + assertXPath(pXmlDoc, aBasePath + "/line", "color"_ostr, "#3465a4"); + assertXPath(pXmlDoc, aBasePath + "/line", "width"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/line", "linejoin"_ostr, "Round"); + assertXPath(pXmlDoc, aBasePath + "/line", "linecap"_ostr, "BUTT"); assertXPathContent(pXmlDoc, aBasePath + "/polygon", "49.5,99 0,99 0,0 99,0 99,99"); @@ -373,14 +373,15 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testFontWorks) SdrPage* pSdrPage = pDrawPage->GetSdrPage(); xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); - assertXPath(pXmlDoc, "/primitive2D", 1); + assertXPath(pXmlDoc, "/primitive2D"_ostr, 1); - assertXPath(pXmlDoc, "//scene", "projectionMode", "Perspective"); - assertXPath(pXmlDoc, "//scene/extrude3D[1]/fill", "color", "#ff0000"); - assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material", "color", "#ff0000"); + assertXPath(pXmlDoc, "//scene"_ostr, "projectionMode"_ostr, "Perspective"); + assertXPath(pXmlDoc, "//scene/extrude3D[1]/fill"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material"_ostr, "color"_ostr, + "#ff0000"); // ODF default 50% is represented by Specular Intensity = 2^5. The relationship is not linear. - assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material", "specularIntensity", - "32"); + assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material"_ostr, + "specularIntensity"_ostr, "32"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_EOLinCurvedText) @@ -399,13 +400,13 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_EOLinCurvedText) // this is a group shape, hence 2 nested objectinfo OString aBasePath = "/primitive2D/objectinfo[4]/objectinfo/unhandled/unhandled/" - "polypolygoncolor/polypolygon/"; + "polypolygoncolor/polypolygon/"_ostr; // The text is: "O" + eop + "O" + eol + "O" // It should be displayed as 3 line of text. (1 "O" letter in every line) - sal_Int32 nY1 = getXPath(pXmlDoc, aBasePath + "polygon[1]/point[1]", "y").toInt32(); - sal_Int32 nY2 = getXPath(pXmlDoc, aBasePath + "polygon[3]/point[1]", "y").toInt32(); - sal_Int32 nY3 = getXPath(pXmlDoc, aBasePath + "polygon[5]/point[1]", "y").toInt32(); + sal_Int32 nY1 = getXPath(pXmlDoc, aBasePath + "polygon[1]/point[1]", "y"_ostr).toInt32(); + sal_Int32 nY2 = getXPath(pXmlDoc, aBasePath + "polygon[3]/point[1]", "y"_ostr).toInt32(); + sal_Int32 nY3 = getXPath(pXmlDoc, aBasePath + "polygon[5]/point[1]", "y"_ostr).toInt32(); sal_Int32 nDiff21 = nY2 - nY1; sal_Int32 nDiff32 = nY3 - nY2; @@ -437,9 +438,9 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMetal) // ODF specifies for metal = true specular color as rgb(200,200,200) and adding 15 to specularity // Together with extrusion-first-light-level 67% and extrusion-specularity 80% factor is // 0.67*0.8 * 200/255 = 0.42 and color #6b6b6b - assertXPath(pXmlDoc, "(//material)[1]", "specular", "#6b6b6b"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specular"_ostr, "#6b6b6b"); // 3D specularIntensity = 2^(50/10) + 15 = 47, with default extrusion-shininess 50% - assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "47"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specularIntensity"_ostr, "47"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testExtrusionPhong) @@ -451,8 +452,8 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testExtrusionPhong) xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); // The rendering method and normals kind were always 'Flat' without the patch. - assertXPath(pXmlDoc, "//scene", "shadeMode", "Phong"); - assertXPath(pXmlDoc, "//object3Dattributes", "normalsKind", "Specific"); + assertXPath(pXmlDoc, "//scene"_ostr, "shadeMode"_ostr, "Phong"); + assertXPath(pXmlDoc, "//object3Dattributes"_ostr, "normalsKind"_ostr, "Specific"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMattePPT) @@ -469,14 +470,14 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMattePPT) // to forth light, as only first light is specular. Because first and third lights are off, the // forth light is the second one in the dump. The gray color corresponding to // FirstLightLevel = 38000/2^16 is #949494. - assertXPath(pXmlDoc, "(//material)[1]", "specular", "#000000"); - assertXPath(pXmlDoc, "(//light)[2]", "color", "#949494"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specular"_ostr, "#000000"); + assertXPath(pXmlDoc, "(//light)[2]"_ostr, "color"_ostr, "#949494"); // To make the second light soft, part of its intensity is moved to lights 5,6,7 and 8. - assertXPath(pXmlDoc, "(//light)[1]", "color", "#1e1e1e"); - assertXPath(pXmlDoc, "(//light)[3]", "color", "#3b3b3b"); + assertXPath(pXmlDoc, "(//light)[1]"_ostr, "color"_ostr, "#1e1e1e"); + assertXPath(pXmlDoc, "(//light)[3]"_ostr, "color"_ostr, "#3b3b3b"); // The 3D property specularIntensity is not related to 'extrusion-specularity' but to // 'extrusion-shininess'. specularIntensity = 2^(shininess/10), here default 32. - assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "32"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specularIntensity"_ostr, "32"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testMaterialSpecular) @@ -492,13 +493,13 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testMaterialSpecular) // -level'. 3D specularIntensity is derived from property 'draw:extrusion-shininess'. Both are // object properties, not scene properties. Those were wrong in various forms before the patch. // Specularity = 77% * first-light-level 67% = 0.5159, which corresponds to gray color #848484. - assertXPath(pXmlDoc, "(//material)[1]", "specular", "#848484"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specular"_ostr, "#848484"); // extrusion-shininess 50% corresponds to 3D specularIntensity 32, use 2^(50/10). - assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "32"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specularIntensity"_ostr, "32"); // extrusion-first-light-level 67% corresponds to gray color #ababab, use 255 * 0.67. - assertXPath(pXmlDoc, "(//light)[1]", "color", "#ababab"); + assertXPath(pXmlDoc, "(//light)[1]"_ostr, "color"_ostr, "#ababab"); // The first light is harsh, the second light soft. So the 3D scene should have 6 lights (1+1+4). - assertXPath(pXmlDoc, "//light", 6); + assertXPath(pXmlDoc, "//light"_ostr, 6); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testVideoSnapshot) @@ -692,27 +693,27 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testClipVerticalTextOverflow) // - In <>, XPath contents of child does not match // i.e. the vertically overflowing text wasn't clipped & overflowing text // was drawn anyways. - assertXPathContent(pDocument, "count((//sdrblocktext)[4]//textsimpleportion)", "6"); + assertXPathContent(pDocument, "count((//sdrblocktext)[4]//textsimpleportion)"_ostr, "6"); // make sure text is aligned correctly after the overflowing text is clipped - assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[1]", "y", "3749"); - assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[6]", "y", "7559"); + assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[1]"_ostr, "y"_ostr, "3749"); + assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[6]"_ostr, "y"_ostr, "7559"); // make sure the text that isn't overflowing is still aligned properly - assertXPathContent(pDocument, "count((//sdrblocktext)[5]//textsimpleportion)", "3"); - assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[1]", "y", "5073"); - assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[3]", "y", "6597"); + assertXPathContent(pDocument, "count((//sdrblocktext)[5]//textsimpleportion)"_ostr, "3"); + assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[1]"_ostr, "y"_ostr, "5073"); + assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[3]"_ostr, "y"_ostr, "6597"); // Test vertically overflowing text, with vertical text direction - assertXPathContent(pDocument, "count((//sdrblocktext)[6]//textsimpleportion)", "12"); + assertXPathContent(pDocument, "count((//sdrblocktext)[6]//textsimpleportion)"_ostr, "12"); // make sure text is aligned correctly after the overflowing text is clipped - assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[1]", "x", "13093"); - assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[12]", "x", "4711"); + assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[1]"_ostr, "x"_ostr, "13093"); + assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[12]"_ostr, "x"_ostr, "4711"); // make sure the text that isn't overflowing is still aligned properly - assertXPathContent(pDocument, "count((//sdrblocktext)[7]//textsimpleportion)", "3"); - assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[1]", "x", "25417"); - assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[3]", "x", "23893"); + assertXPathContent(pDocument, "count((//sdrblocktext)[7]//textsimpleportion)"_ostr, "3"); + assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[1]"_ostr, "x"_ostr, "25417"); + assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[3]"_ostr, "x"_ostr, "23893"); } } diff --git a/svx/qa/unit/table.cxx b/svx/qa/unit/table.cxx index cc0c46efa21c..32faa1f97286 100644 --- a/svx/qa/unit/table.cxx +++ b/svx/qa/unit/table.cxx @@ -81,25 +81,25 @@ CPPUNIT_TEST_FIXTURE(Test, testTableShadowBlur) //- Actual : 2 //- In <>, XPath contents of child does not match // i.e. the shadow's transparency was miscalculated. - assertXPathContent(pDocument, "count(//objectinfo/unifiedtransparence)", "0"); - - assertXPath(pDocument, "//objectinfo/shadow[1]", "color", "#ff0000"); - assertXPath(pDocument, "//objectinfo/shadow[1]", "blur", "141"); - assertXPath(pDocument, "//objectinfo/shadow[2]", "color", "#ff0000"); - assertXPath(pDocument, "//objectinfo/shadow[2]", "blur", "141"); - assertXPath(pDocument, "//objectinfo/shadow[3]", "color", "#ff0000"); - assertXPath(pDocument, "//objectinfo/shadow[3]", "blur", "141"); - assertXPath(pDocument, "//objectinfo/shadow[4]", "color", "#ff0000"); - assertXPath(pDocument, "//objectinfo/shadow[4]", "blur", "141"); - assertXPath(pDocument, "//objectinfo/shadow[5]", "color", "#ff0000"); - assertXPath(pDocument, "//objectinfo/shadow[5]", "blur", "141"); - - assertXPath(pDocument, "//objectinfo/group/sdrCell[1]/unifiedtransparence", 0); - assertXPath(pDocument, "//objectinfo/group/sdrCell[2]/unifiedtransparence", 0); - assertXPath(pDocument, "//objectinfo/group/sdrCell[3]/unifiedtransparence", "transparence", - "80"); - assertXPath(pDocument, "//objectinfo/group/sdrCell[4]/unifiedtransparence", "transparence", - "80"); + assertXPathContent(pDocument, "count(//objectinfo/unifiedtransparence)"_ostr, "0"); + + assertXPath(pDocument, "//objectinfo/shadow[1]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "//objectinfo/shadow[1]"_ostr, "blur"_ostr, "141"); + assertXPath(pDocument, "//objectinfo/shadow[2]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "//objectinfo/shadow[2]"_ostr, "blur"_ostr, "141"); + assertXPath(pDocument, "//objectinfo/shadow[3]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "//objectinfo/shadow[3]"_ostr, "blur"_ostr, "141"); + assertXPath(pDocument, "//objectinfo/shadow[4]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "//objectinfo/shadow[4]"_ostr, "blur"_ostr, "141"); + assertXPath(pDocument, "//objectinfo/shadow[5]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "//objectinfo/shadow[5]"_ostr, "blur"_ostr, "141"); + + assertXPath(pDocument, "//objectinfo/group/sdrCell[1]/unifiedtransparence"_ostr, 0); + assertXPath(pDocument, "//objectinfo/group/sdrCell[2]/unifiedtransparence"_ostr, 0); + assertXPath(pDocument, "//objectinfo/group/sdrCell[3]/unifiedtransparence"_ostr, + "transparence"_ostr, "80"); + assertXPath(pDocument, "//objectinfo/group/sdrCell[4]/unifiedtransparence"_ostr, + "transparence"_ostr, "80"); } CPPUNIT_TEST_FIXTURE(Test, testSvxTableControllerSetAttrToSelectedShape) diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx index ff24012402d8..0f619784553f 100644 --- a/svx/qa/unit/unodraw.cxx +++ b/svx/qa/unit/unodraw.cxx @@ -147,14 +147,14 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testTableShadowDirect) // Check the primitives. drawinglayer::Primitive2dXmlDump aDumper; xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence); - assertXPath(pDocument, "//shadow", /*nNumberOfNodes=*/1); + assertXPath(pDocument, "//shadow"_ostr, /*nNumberOfNodes=*/1); // Without the accompanying fix in place, this test would have failed with: // - Expected: 0 // - Actual : 1 // i.e. there was shadow for the cell text, while here PowerPoint-compatible output is expected, // which has no shadow for cell text (only for cell borders and cell background). - assertXPath(pDocument, "//shadow//sdrblocktext", /*nNumberOfNodes=*/0); + assertXPath(pDocument, "//shadow//sdrblocktext"_ostr, /*nNumberOfNodes=*/0); } CPPUNIT_TEST_FIXTURE(UnodrawTest, testTitleShapeBullets) diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx index 78fc83bec15e..03f38bb2f389 100644 --- a/svx/source/dialog/ClassificationDialog.cxx +++ b/svx/source/dialog/ClassificationDialog.cxx @@ -335,7 +335,7 @@ void ClassificationDialog::readRecentlyUsed() // Convert string to classification type, but continue only if // conversion was successful. - if (stringToClassificationType(aWalker.attribute("type"), eType)) + if (stringToClassificationType(aWalker.attribute("type"_ostr), eType)) { aWalker.children(); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 841cac87bb31..d13291726258 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -814,7 +814,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S } // hide the text selection too - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""_ostr); } { @@ -889,7 +889,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S if (aSel >>= aValue) { OString aObjectCID(aValue.getStr(), aValue.getLength(), osl_getThreadTextEncoding()); - const std::vector<OString> aProps{"Draggable", "Resizable", "Rotatable"}; + const std::vector<OString> aProps{"Draggable"_ostr, "Resizable"_ostr, "Rotatable"_ostr}; for (const auto& rProp: aProps) { sal_Int32 nPos = aObjectCID.indexOf(rProp); @@ -963,7 +963,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow); Point aLogicOffset = pWin->PixelToLogic(aOffsetPx); - OString sPolygonElem("<polygon points=\\\""); + OString sPolygonElem("<polygon points=\\\""_ostr); for (sal_uInt32 nIndex = 0; nIndex < nPolySize; ++nIndex) { const basegfx::B2DPoint aB2Point = aPolygon.getB2DPoint(nIndex); @@ -1123,7 +1123,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S sSelectionText = "EMPTY"; sSelectionTextView = "EMPTY"; if (!pOtherShell) - pViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", OString()); + pViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection"_ostr, OString()); } if (bTableSelection) @@ -1141,7 +1141,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S } else if (!getSdrModelFromSdrView().IsWriter()) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, "{}"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, "{}"_ostr); } if (pOtherShell) diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 73c10be946c9..78363db198a4 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2397,10 +2397,10 @@ void SvxTableController::destroySelectionOverlay() // Clear the LOK text selection so far provided by this table. if(SfxViewShell* pViewShell = SfxViewShell::Current()) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, "EMPTY"); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, "EMPTY"); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, "EMPTY"); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, "EMPTY"_ostr); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, "EMPTY"_ostr); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, "EMPTY"_ostr); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"_ostr); } } } diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index 27e992c92059..da560feb0e15 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -564,7 +564,7 @@ static OString extractPngString(const BitmapEx& rBitmap) return aBuffer.makeStringAndClear(); } - return ""; + return ""_ostr; } // 0: json writer, 1: TreeIter, 2: property. returns true if supported diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index cf6cfe1d964d..c7bd99d93a0b 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -864,11 +864,11 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr pMtf->SetPrefMapMode( aLocalMapMode ); pMtf->AddAction( new MetaCommentAction( - "XTEXT_SCROLLRECT", 0, + "XTEXT_SCROLLRECT"_ostr, 0, reinterpret_cast<sal_uInt8 const*>(&aScrollRectangle), sizeof( tools::Rectangle ) ) ); pMtf->AddAction( new MetaCommentAction( - "XTEXT_PAINTRECT", 0, + "XTEXT_PAINTRECT"_ostr, 0, reinterpret_cast<sal_uInt8 const*>(&aPaintRectangle), sizeof( tools::Rectangle ) ) ); commit 7724e504be75fdf2a90b0ffc19dce3df76ed14a6 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Nov 19 13:25:26 2023 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Nov 19 17:29:47 2023 +0100 Extended loplugin:ostr: sw Change-Id: I210f61f6d90776b086b7058fb1a831d235699fb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159670 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index 2fad46194174..b653a1cc2201 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -230,7 +230,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxMakeFlyFrame) // Without the accompanying fix in place, this test would have failed, because the first text // frame in the body frame had an SwAnchoredDrawObject anchored to it, but not a fly frame, so // a blank square was painted, not the image. - assertXPath(pLayout, "/root/page/body/txt/anchored/fly", 1); + assertXPath(pLayout, "/root/page/body/txt/anchored/fly"_ostr, 1); } CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testIMEGrouping) diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx index 55c6c7b9d01f..618fe7fb574f 100644 --- a/sw/qa/core/frmedt/frmedt.cxx +++ b/sw/qa/core/frmedt/frmedt.cxx @@ -89,7 +89,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testVertPosFromBottomBoundingBox) // Get the absolute position of the top of the page bottom margin area. xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - SwTwips nPagePrintAreaBottom = getXPath(pXmlDoc, "//page/infos/prtBounds", "bottom").toInt32(); + SwTwips nPagePrintAreaBottom + = getXPath(pXmlDoc, "//page/infos/prtBounds"_ostr, "bottom"_ostr).toInt32(); // Calculate the allowed bounding box of the shape, e.g. the shape's position & size dialog uses // this to limit the vertical position to sensible values. diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 4399c01a0074..5971e870304d 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -54,11 +54,13 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlap) // Load a document that has an image anchored in the header. // It also has a table which has the wrap around the image. createSwDoc("table-fly-overlap.docx"); - SwTwips nFlyTop = parseDump("//header/txt/anchored/fly/infos/bounds", "top").toInt32(); - SwTwips nFlyHeight = parseDump("//header/txt/anchored/fly/infos/bounds", "height").toInt32(); + SwTwips nFlyTop + = parseDump("//header/txt/anchored/fly/infos/bounds"_ostr, "top"_ostr).toInt32(); + SwTwips nFlyHeight + = parseDump("//header/txt/anchored/fly/infos/bounds"_ostr, "height"_ostr).toInt32(); SwTwips nFlyBottom = nFlyTop + nFlyHeight; - SwTwips nTableFrameTop = parseDump("//tab/infos/bounds", "top").toInt32(); - SwTwips nTablePrintTop = parseDump("//tab/infos/prtBounds", "top").toInt32(); + SwTwips nTableFrameTop = parseDump("//tab/infos/bounds"_ostr, "top"_ostr).toInt32(); + SwTwips nTablePrintTop = parseDump("//tab/infos/prtBounds"_ostr, "top"_ostr).toInt32(); SwTwips nTableTop = nTableFrameTop + nTablePrintTop; // Without the accompanying fix in place, this test would have failed with: // - Expected greater or equal than: 3579 @@ -73,8 +75,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTdf128195) // Load a document that has two paragraphs in the header. // The second paragraph should have its bottom spacing applied. createSwDoc("tdf128195.docx"); - sal_Int32 nTxtHeight = parseDump("//header/txt[2]/infos/bounds", "height").toInt32(); - sal_Int32 nTxtBottom = parseDump("//header/txt[2]/infos/bounds", "bottom").toInt32(); + sal_Int32 nTxtHeight = parseDump("//header/txt[2]/infos/bounds"_ostr, "height"_ostr).toInt32(); + sal_Int32 nTxtBottom = parseDump("//header/txt[2]/infos/bounds"_ostr, "bottom"_ostr).toInt32(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2269), nTxtHeight); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3529), nTxtBottom); } @@ -102,7 +104,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBorderCollapseCompat) // - Actual : 48 // i.e. there was no single cell border with width=20, rather there were 48 border parts // (forming a dotted border), all with width=40. - assertXPath(pXmlDoc, "//polyline[@style='solid']", "width", "20"); + assertXPath(pXmlDoc, "//polyline[@style='solid']"_ostr, "width"_ostr, "20"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrTableRowSpan) @@ -120,18 +122,19 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrTableRowSpan) // - Expected: USA // - Actual : West // i.e. the "USA" text completely disappeared. - assertXPathContent(pXmlDoc, "//textarray[1]/text", "USA"); + assertXPathContent(pXmlDoc, "//textarray[1]/text"_ostr, "USA"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlapSpacing) { // Load a document that has an image on the right of a table. The table wraps around the image. createSwDoc("table-fly-overlap-spacing.docx"); - SwTwips nFlyTop = parseDump("//body/txt/anchored/fly/infos/bounds", "top").toInt32(); - SwTwips nFlyHeight = parseDump("//body/txt/anchored/fly/infos/bounds", "height").toInt32(); + SwTwips nFlyTop = parseDump("//body/txt/anchored/fly/infos/bounds"_ostr, "top"_ostr).toInt32(); + SwTwips nFlyHeight + = parseDump("//body/txt/anchored/fly/infos/bounds"_ostr, "height"_ostr).toInt32(); SwTwips nFlyBottom = nFlyTop + nFlyHeight; - SwTwips nTableFrameTop = parseDump("//tab/infos/bounds", "top").toInt32(); - SwTwips nTablePrintTop = parseDump("//tab/infos/prtBounds", "top").toInt32(); + SwTwips nTableFrameTop = parseDump("//tab/infos/bounds"_ostr, "top"_ostr).toInt32(); + SwTwips nTablePrintTop = parseDump("//tab/infos/prtBounds"_ostr, "top"_ostr).toInt32(); SwTwips nTableTop = nTableFrameTop + nTablePrintTop; // Without the accompanying fix in place, this test would have failed with: // - Expected greater or equal than: 3993 @@ -161,7 +164,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTablesMoveBackwards) // - Actual : 2 // i.e. there was an unexpected 2nd page, as only 20 out of 21 tables were moved to the first // page. - assertXPath(pLayout, "//page", 1); + assertXPath(pLayout, "//page"_ostr, 1); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testContinuousEndnotesMoveBackwards) @@ -170,15 +173,15 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testContinuousEndnotesMoveBackwards) createSwDoc("continuous-endnotes-move-backwards.doc"); xmlDocUniquePtr pLayout = parseLayoutDump(); // We have 2 pages. - assertXPath(pLayout, "/root/page", 2); + assertXPath(pLayout, "/root/page"_ostr, 2); // No endnote container on page 1. // Without the accompanying fix in place, this test would have failed with: // - Expected: 0 // - Actual : 1 // i.e. there were unexpected endnotes on page 1. - assertXPath(pLayout, "/root/page[1]/ftncont", 0); + assertXPath(pLayout, "/root/page[1]/ftncont"_ostr, 0); // All endnotes are in a container on page 2. - assertXPath(pLayout, "/root/page[2]/ftncont", 1); + assertXPath(pLayout, "/root/page[2]/ftncont"_ostr, 1); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testAnchorPositionBasedOnParagraph) @@ -188,12 +191,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testAnchorPositionBasedOnParagraph) createSwDoc("tdf134783_testAnchorPositionBasedOnParagraph.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); - assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds", "top", "1671"); - assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds", "bottom", "1732"); - assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[2]/bounds", "top", "1947"); - assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[2]/bounds", "bottom", "2008"); - assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[3]/bounds", "top", "3783"); - assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[3]/bounds", "bottom", "3844"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds"_ostr, "top"_ostr, "1671"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds"_ostr, "bottom"_ostr, "1732"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[2]/bounds"_ostr, "top"_ostr, "1947"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[2]/bounds"_ostr, "bottom"_ostr, "2008"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[3]/bounds"_ostr, "top"_ostr, "3783"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[3]/bounds"_ostr, "bottom"_ostr, "3844"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxStaysInsideShape) @@ -206,8 +209,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxStaysInsideShape) // Without the fix in place, this test would have failed with // - Expected: 1932 // - Actual : 7476 - assertXPath(pXmlDoc, "//anchored/fly/infos/bounds", "top", "1932"); - assertXPath(pXmlDoc, "//anchored/fly/infos/bounds", "bottom", "7184"); + assertXPath(pXmlDoc, "//anchored/fly/infos/bounds"_ostr, "top"_ostr, "1932"); + assertXPath(pXmlDoc, "//anchored/fly/infos/bounds"_ostr, "bottom"_ostr, "7184"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxNotModifiedOnOpen) @@ -235,10 +238,13 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical) discardDumpedLayout(); xmlDocUniquePtr pLayout = parseLayoutDump(); CPPUNIT_ASSERT(pLayout); - sal_Int32 nFlyLeft = getXPath(pLayout, "//anchored/fly/infos/bounds", "left").toInt32(); - sal_Int32 nFlyTop = getXPath(pLayout, "//anchored/fly/infos/bounds", "top").toInt32(); - sal_Int32 nFlyRight = getXPath(pLayout, "//anchored/fly/infos/bounds", "right").toInt32(); - sal_Int32 nFlyBottom = getXPath(pLayout, "//anchored/fly/infos/bounds", "bottom").toInt32(); + sal_Int32 nFlyLeft + = getXPath(pLayout, "//anchored/fly/infos/bounds"_ostr, "left"_ostr).toInt32(); + sal_Int32 nFlyTop = getXPath(pLayout, "//anchored/fly/infos/bounds"_ostr, "top"_ostr).toInt32(); + sal_Int32 nFlyRight + = getXPath(pLayout, "//anchored/fly/infos/bounds"_ostr, "right"_ostr).toInt32(); + sal_Int32 nFlyBottom + = getXPath(pLayout, "//anchored/fly/infos/bounds"_ostr, "bottom"_ostr).toInt32(); tools::Rectangle aFlyRect(nFlyLeft, nFlyTop, nFlyRight, nFlyBottom); // Without the accompanying fix in place, this test would have failed, as aFlyRect was too wide, // so it was not inside aShapeRect anymore. @@ -269,7 +275,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxInHeaderIsPositioned) // - Actual : 1418 // Comparison with 7000 chosen due to variability between devices CPPUNIT_ASSERT_GREATEREQUAL( - double(7000), getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toDouble()); + double(7000), + getXPath(pXmlDoc, "//anchored/fly/infos/bounds"_ostr, "left"_ostr).toDouble()); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) @@ -307,11 +314,11 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testKeepwithnextFullheight) xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); // Make sure the document has 2 pages. - assertXPath(pXmlDoc, "//page", 2); + assertXPath(pXmlDoc, "//page"_ostr, 2); // Heading stays on page 1 to avoid a layout loop. - assertXPathContent(pXmlDoc, "//page[1]/body/txt[2]", "Heading"); + assertXPathContent(pXmlDoc, "//page[1]/body/txt[2]"_ostr, "Heading"); // Image stays on page 2. - assertXPath(pXmlDoc, "//page[2]/body/txt/anchored/fly", 1); + assertXPath(pXmlDoc, "//page[2]/body/txt/anchored/fly"_ostr, 1); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMargin) @@ -455,7 +462,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMarginPageBorder) // - Expected: 2565 // - Actual : 1425 // Where 2565 is close to the left edge of the text area (2553). - assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]", "x", "2565"); + assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]"_ostr, "x"_ostr, "2565"); #endif } @@ -479,7 +486,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testVerticallyMergedCellBorder) MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); // Collect vertical positions of all border points. - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; std::vector<sal_Int32> aBorderPositions; for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); ++i) @@ -492,7 +499,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testVerticallyMergedCellBorder) xmlXPathFreeObject(pXmlObj); // Collect top and bottom of the B1->B3 rows. xmlDocUniquePtr pLayout = parseLayoutDump(); - pXmlObj = getXPathNode(pLayout, "//tab/row/infos/bounds"); + pXmlObj = getXPathNode(pLayout, "//tab/row/infos/bounds"_ostr); pXmlNodes = pXmlObj->nodesetval; std::vector<sal_Int32> aLayoutPositions; for (int i = 0; i < 3; ++i) @@ -562,7 +569,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testLinkedBullet) // - Expected: 1 // - Actual : 0 // i.e. the bullet's bitmap was lost. - assertXPath(pXmlDoc, "//bmpexscale", 1); + assertXPath(pXmlDoc, "//bmpexscale"_ostr, 1); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testInnerCellBorderIntersect) @@ -580,7 +587,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testInnerCellBorderIntersect) MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); // Collect start/end (vertical) positions of horizontal borders. - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; std::vector<std::pair<sal_Int32, sal_Int32>> aBorderStartEnds; for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2) @@ -642,7 +649,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testInnerCellBorderNocompatIntersect) MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); // Collect start/end (vertical) positions of horizontal borders. - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; std::vector<std::pair<sal_Int32, sal_Int32>> aBorderStartEnds; for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2) @@ -696,7 +703,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderVertical) MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); // Collect widths of vertical lines. - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; // Horizontal position -> width. std::map<sal_Int32, sal_Int32> aBorderWidths; @@ -745,7 +752,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderHorizontal) MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); // Collect widths of horizontal lines. - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; // Vertical position -> width. std::map<sal_Int32, sal_Int32> aBorderWidths; @@ -797,7 +804,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testParaBorderInCellClip) // - Actual : 0 // - XPath '//clipregion/polygon' number of nodes is incorrect // i.e. there was no clipping applied, leading to unexpected left/right borders. - assertXPath(pXmlDoc, "//clipregion/polygon", 2); + assertXPath(pXmlDoc, "//clipregion/polygon"_ostr, 2); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoublePageBorder) @@ -815,7 +822,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoublePageBorder) MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); // Collect widths of horizontal lines. - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; // Vertical position -> width. std::map<sal_Int32, sal_Int32> aBorderWidths; @@ -887,8 +894,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testNegativePageBorder) // i.e. the negative border distance was rounded up to 0 in lcl_CalcBorderRect(). // Ideally this would be 284 (top of first page) + 284 (top margin) + 366 (border distance) = // 934. - assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]", "y", "899"); - assertXPath(pXmlDoc, "//polyline[@style='solid']/point[2]", "y", "899"); + assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]"_ostr, "y"_ostr, "899"); + assertXPath(pXmlDoc, "//polyline[@style='solid']/point[2]"_ostr, "y"_ostr, "899"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testNegativePageBorderNoMargin) @@ -926,8 +933,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testNegativePageBorderNoMargin) // i.e. this failed differently: the lack of top margin caused a second problem. // Ideally this would be 284 (top of first page) + 650 (border distance) = // 934. - assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]", "y", "899"); - assertXPath(pXmlDoc, "//polyline[@style='solid']/point[2]", "y", "899"); + assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]"_ostr, "y"_ostr, "899"); + assertXPath(pXmlDoc, "//polyline[@style='solid']/point[2]"_ostr, "y"_ostr, "899"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testFollowTextFlowWrapInBackground) @@ -958,7 +965,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testFollowTextFlowWrapInBackground) // Then make sure that the cell height grows to have space for the graphic, given that // background=true is not specified. xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nCellHeight = getXPath(pXmlDoc, "//cell[1]/infos/bounds", "height").toInt32(); + sal_Int32 nCellHeight + = getXPath(pXmlDoc, "//cell[1]/infos/bounds"_ostr, "height"_ostr).toInt32(); // Without the accompanying fix in place, this test would have failed with: // - Expected greater than: 1000 // - Actual : 396 @@ -1030,7 +1038,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testNewFollowTextFlowWrapInBackground) // Then make sure that the cell height grows to have space for the graphic, given that // background=true is not specified. xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nCellHeight = getXPath(pXmlDoc, "//cell[1]/infos/bounds", "height").toInt32(); + sal_Int32 nCellHeight + = getXPath(pXmlDoc, "//cell[1]/infos/bounds"_ostr, "height"_ostr).toInt32(); // Without the accompanying fix in place, this test would have failed with: // - Expected less than: 1000 // - Actual : 1120 diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx index baa858020acf..b5990648b20f 100644 --- a/sw/qa/core/layout/paintfrm.cxx +++ b/sw/qa/core/layout/paintfrm.cxx @@ -40,7 +40,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitTableBorder) // border: MetafileXmlDump aDumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; int nHorizontalBorders = 0; // Count the horizontal borders: @@ -82,7 +82,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRTLBorderMerge) // Then make sure the 5 columns all have left and right vertical borders: MetafileXmlDump aDumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; int nVerticalBorders = 0; // Count the vertical borders: @@ -123,7 +123,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitTableMergedBorder) // Then make sure that the master table has a bottom border with the correct widths: MetafileXmlDump aDumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; std::set<int> aHorizontalBorderStarts; std::set<int> aHorizontalBorderEnds; diff --git a/sw/qa/core/layout/tabfrm.cxx b/sw/qa/core/layout/tabfrm.cxx index 1659cf0df6fd..cfad007cebcd 100644 --- a/sw/qa/core/layout/tabfrm.cxx +++ b/sw/qa/core/layout/tabfrm.cxx @@ -32,7 +32,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTablePrintAreaLeft) createSwDoc("table-print-area-left.docx"); // When laying out that document & parsing the left margin of the table: - SwTwips nTablePrintLeft = parseDump("//tab/infos/prtBounds", "left").toInt32(); + SwTwips nTablePrintLeft = parseDump("//tab/infos/prtBounds"_ostr, "left"_ostr).toInt32(); // Then make sure it has ~no left margin: // Without the accompanying fix in place, this test would have failed with: diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx b/sw/qa/core/objectpositioning/objectpositioning.cxx index 9fea64267a15..bf560cbdaf90 100644 --- a/sw/qa/core/objectpositioning/objectpositioning.cxx +++ b/sw/qa/core/objectpositioning/objectpositioning.cxx @@ -75,9 +75,9 @@ CPPUNIT_TEST_FIXTURE(Test, testVertPosFromBottom) // Verify that the distance between the body and anchored object bottom is indeed around 1cm. xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); + sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds"_ostr, "bottom"_ostr).toInt32(); sal_Int32 nAnchoredBottom - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "bottom").toInt32(); + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds"_ostr, "bottom"_ostr).toInt32(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 565 // - Actual : 9035 @@ -133,18 +133,22 @@ CPPUNIT_TEST_FIXTURE(Test, testVertAlignBottomMargin) xDrawPageSupplierTop->getDrawPage()->add(xShapeTop); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); //14989 - sal_Int32 nPageBottom = getXPath(pXmlDoc, "//page/infos/bounds", "bottom").toInt32(); //16123 + sal_Int32 nBodyBottom + = getXPath(pXmlDoc, "//body/infos/bounds"_ostr, "bottom"_ostr).toInt32(); //14989 + sal_Int32 nPageBottom + = getXPath(pXmlDoc, "//page/infos/bounds"_ostr, "bottom"_ostr).toInt32(); //16123 sal_Int32 nFirstShapeBottom - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds", "bottom") + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds"_ostr, "bottom"_ostr) .toInt32(); //16124 sal_Int32 nSecondShapeBottom - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "bottom") + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds"_ostr, "bottom"_ostr) .toInt32(); //15699 sal_Int32 nSecondShapeTop - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "top").toInt32(); //15414 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds"_ostr, "top"_ostr) + .toInt32(); //15414 sal_Int32 nThirdShapeTop - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds", "top").toInt32(); //14989 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds"_ostr, "top"_ostr) + .toInt32(); //14989 // Verify that the distance between the bottom of page and bottom of first shape is around 0cm. (align=bottom) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nFirstShapeBottom - nPageBottom); @@ -205,18 +209,22 @@ CPPUNIT_TEST_FIXTURE(Test, testVertAlignBottomMarginWithFooter) xDrawPageSupplierTop->getDrawPage()->add(xShapeTop); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); //14853 - sal_Int32 nPageBottom = getXPath(pXmlDoc, "//page/infos/bounds", "bottom").toInt32(); //17121 + sal_Int32 nBodyBottom + = getXPath(pXmlDoc, "//body/infos/bounds"_ostr, "bottom"_ostr).toInt32(); //14853 + sal_Int32 nPageBottom + = getXPath(pXmlDoc, "//page/infos/bounds"_ostr, "bottom"_ostr).toInt32(); //17121 sal_Int32 nFirstShapeBottom - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds", "bottom") + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds"_ostr, "bottom"_ostr) .toInt32(); //17122 sal_Int32 nSecondShapeTop - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "top").toInt32(); //15703 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds"_ostr, "top"_ostr) + .toInt32(); //15703 sal_Int32 nSecondShapeBottom - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "bottom") + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds"_ostr, "bottom"_ostr) .toInt32(); //16272 sal_Int32 nThirdShapeTop - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds", "top").toInt32(); //14853 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds"_ostr, "top"_ostr) + .toInt32(); //14853 // Verify that the distance between the bottom of page and bottom of first shape is around 0cm. (align=bottom) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nFirstShapeBottom - nPageBottom); @@ -235,13 +243,16 @@ CPPUNIT_TEST_FIXTURE(Test, testInsideOutsideVertAlignBottomMargin) createSwDoc("inside-outside-vert-align.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); //15704 - sal_Int32 nPageBottom = getXPath(pXmlDoc, "//page/infos/bounds", "bottom").toInt32(); //17121 + sal_Int32 nBodyBottom + = getXPath(pXmlDoc, "//body/infos/bounds"_ostr, "bottom"_ostr).toInt32(); //15704 + sal_Int32 nPageBottom + = getXPath(pXmlDoc, "//page/infos/bounds"_ostr, "bottom"_ostr).toInt32(); //17121 sal_Int32 nFirstShapeOutside - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds", "bottom") + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds"_ostr, "bottom"_ostr) .toInt32(); //17098 sal_Int32 nSecondShapeInside - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "top").toInt32(); //15694 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds"_ostr, "top"_ostr) + .toInt32(); //15694 // Verify that the distance between the bottom of page and bottom of first shape is around 0cm. (align=outside) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), nPageBottom - nFirstShapeOutside); @@ -258,23 +269,28 @@ CPPUNIT_TEST_FIXTURE(Test, testVMLVertAlignBottomMargin) createSwDoc("vml-vertical-alignment.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); //11803 - sal_Int32 nPageBottom = getXPath(pXmlDoc, "//page/infos/bounds", "bottom").toInt32(); //16123 + sal_Int32 nBodyBottom + = getXPath(pXmlDoc, "//body/infos/bounds"_ostr, "bottom"_ostr).toInt32(); //11803 + sal_Int32 nPageBottom + = getXPath(pXmlDoc, "//page/infos/bounds"_ostr, "bottom"_ostr).toInt32(); //16123 sal_Int32 nFirstVMLShapeInside - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds", "top").toInt32(); //11802 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds"_ostr, "top"_ostr) + .toInt32(); //11802 sal_Int32 nSecondVMLShapeBottom - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "bottom") + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds"_ostr, "bottom"_ostr) .toInt32(); //16124 sal_Int32 nThirdVMLShapeCenterBottom - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds", "bottom") + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds"_ostr, "bottom"_ostr) .toInt32(); //14185 sal_Int32 nThirdVMLShapeCenterTop - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds", "top").toInt32(); //13741 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds"_ostr, "top"_ostr) + .toInt32(); //13741 sal_Int32 nFourthVMLShapeTop - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[4]/bounds", "top").toInt32(); //11802 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[4]/bounds"_ostr, "top"_ostr) + .toInt32(); //11802 sal_Int32 nFifthVMLShapeOutside - = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[5]/bounds", "bottom") + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[5]/bounds"_ostr, "bottom"_ostr) .toInt32(); //16124 // Verify that the distance between the bottom of body and top of first VMLshape is around 0cm. (align=inside) diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 496c14006539..8951b9fb6a82 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -100,7 +100,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testSemiTransparentText) MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); - assertXPath(pXmlDoc, "//floattransparent"); + assertXPath(pXmlDoc, "//floattransparent"_ostr); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport) @@ -391,8 +391,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTabOverMarginSection) createSwDoc("tabovermargin-section.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nWidth - = getXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']", - "width") + = getXPath(pXmlDoc, + "//SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']"_ostr, + "width"_ostr) .toInt32(); // Without the accompanying fix in place, this test would have failed with: // - Expected less than: 5000 @@ -415,7 +416,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineHeight) // - Expected: 284 // - Actual : -65252 // due to various unsigned integer truncations. - assertXPath(pXmlDoc, "//fly/infos/bounds", "top", OUString::number(DOCUMENTBORDER)); + assertXPath(pXmlDoc, "//fly/infos/bounds"_ostr, "top"_ostr, OUString::number(DOCUMENTBORDER)); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineWidth) @@ -449,10 +450,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testChineseAutoFirstLineIndent) // Get the line width of the first line for the 1st paragraph. sal_Int32 nFirstLineWidth - = getXPath(pXmlDoc, "//body/txt[1]/SwParaPortion/SwLineLayout[1]", "width").toInt32(); + = getXPath(pXmlDoc, "//body/txt[1]/SwParaPortion/SwLineLayout[1]"_ostr, "width"_ostr) + .toInt32(); // Get the line width of the first line for the 2nd paragraph. sal_Int32 nSecondLineWidth - = getXPath(pXmlDoc, "//body/txt[2]/SwParaPortion/SwLineLayout[1]", "width").toInt32(); + = getXPath(pXmlDoc, "//body/txt[2]/SwParaPortion/SwLineLayout[1]"_ostr, "width"_ostr) + .toInt32(); // Tdf#129448: the changing of line-height should not affect the auto first line indent. // As a result, the first line width of the two paragraphs should be the same. @@ -542,7 +545,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreak) // - Actual : 276 // i.e. the line height wasn't the twips value of the 1.806 cm from the file, but was based on // the font size of the text, which is only correct for non-clearing breaks. - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]", "height", "1024"); + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]"_ostr, "height"_ostr, "1024"); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakAtStart) @@ -572,7 +575,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakAtStart) // - Actual : 276 // i.e. the line height was too small, but only in case the full line was a fly and a break // portion, without any real content. - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]", "height", "1024"); + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]"_ostr, "height"_ostr, "1024"); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeft) @@ -624,7 +627,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeft) // - Expected: 2837 // - Actual : 4254 // i.e. any non-none type was handled as type=all, and this was jumping below both shapes. - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]", "height", "2837"); + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]"_ostr, "height"_ostr, "2837"); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeftRTL) @@ -665,7 +668,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeftRTL) // - Expected: 276 // - Actual : 2837 // i.e. left/right was not ignored in the RTL case. - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]", "height", "276"); + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]"_ostr, "height"_ostr, "276"); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakVertical) @@ -708,7 +711,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakVertical) // - Actual : 7135 // i.e. the expected break height is the twips value of the 5cm rectangle size, it was much // more. - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]/SwBreakPortion", "height", "2837"); + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]/SwBreakPortion"_ostr, "height"_ostr, + "2837"); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakHeader) @@ -724,7 +728,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakHeader) // - Expected: 276 // - Actual : 15398 // i.e. the shape was in the background, but we failed to ignore it for the break portion. - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]", "height", "276"); + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]"_ostr, "height"_ostr, "276"); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testAsCharImageDocModelFromViewPoint) @@ -1218,8 +1222,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testNumberPortionFormat) // i.e. the numbering portion font size was 12pt, not 24pt (but only when the doc had a // bookmark). assertXPath(pXmlDoc, - "//SwParaPortion/SwLineLayout/child::*[@type='PortionType::Number']/SwFont", - "height", "480"); + "//SwParaPortion/SwLineLayout/child::*[@type='PortionType::Number']/SwFont"_ostr, + "height"_ostr, "480"); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testNumberPortionNoformat) @@ -1237,7 +1241,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testNumberPortionNoformat) // i.e. the run color affected the color of the number portion in Writer, but not in Word. CPPUNIT_ASSERT_EQUAL( OUString("ffffffff"), - getXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwFieldPortion/SwFont", "color")); + getXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwFieldPortion/SwFont"_ostr, "color"_ostr)); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf41652NBSPWidth) @@ -1258,8 +1262,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf41652NBSPWidth) MetafileXmlDump aDumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); - nSectionAfterNBSPX_legacy_leftAligned = getXPath(pXmlDoc, "//textarray[3]", "x").toInt32(); - nSectionAfterNBSPX_legacy_justified = getXPath(pXmlDoc, "//textarray[8]", "x").toInt32(); + nSectionAfterNBSPX_legacy_leftAligned + = getXPath(pXmlDoc, "//textarray[3]"_ostr, "x"_ostr).toInt32(); + nSectionAfterNBSPX_legacy_justified + = getXPath(pXmlDoc, "//textarray[8]"_ostr, "x"_ostr).toInt32(); } // Measure the X of sections after NBSPs in a file with the option enabled @@ -1272,9 +1278,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf41652NBSPWidth) xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); nSectionAfterNBSPX_optionDisabled_leftAligned - = getXPath(pXmlDoc, "//textarray[3]", "x").toInt32(); + = getXPath(pXmlDoc, "//textarray[3]"_ostr, "x"_ostr).toInt32(); nSectionAfterNBSPX_optionDisabled_justified - = getXPath(pXmlDoc, "//textarray[8]", "x").toInt32(); + = getXPath(pXmlDoc, "//textarray[8]"_ostr, "x"_ostr).toInt32(); } // Measure the X of the sections after NBSPs in a file with the option enabled @@ -1287,9 +1293,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf41652NBSPWidth) xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); nSectionAfterNBSPX_optionEnabled_leftAligned - = getXPath(pXmlDoc, "//textarray[3]", "x").toInt32(); + = getXPath(pXmlDoc, "//textarray[3]"_ostr, "x"_ostr).toInt32(); nSectionAfterNBSPX_optionEnabled_justified - = getXPath(pXmlDoc, "//textarray[8]", "x").toInt32(); + = getXPath(pXmlDoc, "//textarray[8]"_ostr, "x"_ostr).toInt32(); } // Assert left aligned NBSP for the legacy file is larger than zero @@ -1372,39 +1378,47 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf89288) // Then make sure there is no kern portions between the Western and Complex // portions: - assertXPath(pXmlDoc, "//body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion", 3); + assertXPath(pXmlDoc, "//body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion"_ostr, 3); assertXPath(pXmlDoc, - "//body/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text']", 3); + "//body/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text']"_ostr, + 3); assertXPath(pXmlDoc, - "//body/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Kern']", 0); + "//body/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Kern']"_ostr, + 0); - assertXPath(pXmlDoc, "//body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion", 3); + assertXPath(pXmlDoc, "//body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion"_ostr, 3); assertXPath(pXmlDoc, - "//body/txt[2]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text']", 3); + "//body/txt[2]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text']"_ostr, + 3); assertXPath(pXmlDoc, - "//body/txt[2]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Kern']", 0); + "//body/txt[2]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Kern']"_ostr, + 0); // But also make sure there is a kern portion between each Western and Asian // portion: - assertXPath(pXmlDoc, "//body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion", 5); + assertXPath(pXmlDoc, "//body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion"_ostr, 5); assertXPath(pXmlDoc, - "//body/txt[3]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text']", 3); + "//body/txt[3]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text']"_ostr, + 3); assertXPath(pXmlDoc, - "//body/txt[3]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Kern']", 2); - assertXPath(pXmlDoc, "//body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type", - "PortionType::Kern"); - assertXPath(pXmlDoc, "//body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[4]", "type", - "PortionType::Kern"); - - assertXPath(pXmlDoc, "//body/txt[4]/SwParaPortion/SwLineLayout/SwLinePortion", 5); + "//body/txt[3]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Kern']"_ostr, + 2); + assertXPath(pXmlDoc, "//body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]"_ostr, + "type"_ostr, "PortionType::Kern"); + assertXPath(pXmlDoc, "//body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[4]"_ostr, + "type"_ostr, "PortionType::Kern"); + + assertXPath(pXmlDoc, "//body/txt[4]/SwParaPortion/SwLineLayout/SwLinePortion"_ostr, 5); assertXPath(pXmlDoc, - "//body/txt[4]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text']", 3); + "//body/txt[4]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text']"_ostr, + 3); assertXPath(pXmlDoc, - "//body/txt[4]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Kern']", 2); - assertXPath(pXmlDoc, "//body/txt[4]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type", - "PortionType::Kern"); - assertXPath(pXmlDoc, "//body/txt[4]/SwParaPortion/SwLineLayout/SwLinePortion[4]", "type", - "PortionType::Kern"); + "//body/txt[4]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Kern']"_ostr, + 2); + assertXPath(pXmlDoc, "//body/txt[4]/SwParaPortion/SwLineLayout/SwLinePortion[2]"_ostr, + "type"_ostr, "PortionType::Kern"); + assertXPath(pXmlDoc, "//body/txt[4]/SwParaPortion/SwLineLayout/SwLinePortion[4]"_ostr, + "type"_ostr, "PortionType::Kern"); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf139863) @@ -1419,8 +1433,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf139863) // Without the fix we don’t even reach here, as the old code resulted in a // lone surrogate which can’t be converted to UTF-8 for the layout dump and // we get an assert in OString::toUtf8(). - assertXPath(pXmlDoc, "//body/txt[1]/SwParaPortion/SwLineLayout/child::*", 1); - assertXPath(pXmlDoc, "//body/txt[2]/SwParaPortion/SwLineLayout/child::*", 1); + assertXPath(pXmlDoc, "//body/txt[1]/SwParaPortion/SwLineLayout/child::*"_ostr, 1); + assertXPath(pXmlDoc, "//body/txt[2]/SwParaPortion/SwLineLayout/child::*"_ostr, 1); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testParaUpperMarginFlyIntersect) @@ -1436,15 +1450,16 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testParaUpperMarginFlyIntersect) // upper margin, not based on the 1st para lower margin: xmlDocUniquePtr pXmlDoc = parseLayoutDump(); int nFlyCount - = getXPathContent(pXmlDoc, - "count(//SwParaPortion/SwLineLayout/child::*[@type='PortionType::Fly'])") + = getXPathContent( + pXmlDoc, + "count(//SwParaPortion/SwLineLayout/child::*[@type='PortionType::Fly'])"_ostr) .toInt32(); int nHeight = 0; for (int i = 1; i <= nFlyCount; ++i) { OString xPath = "(//SwParaPortion/SwLineLayout/child::*[@type='PortionType::Fly'])[" + OString::number(i) + "]"; - nHeight += getXPath(pXmlDoc, xPath, "height").toInt32(); + nHeight += getXPath(pXmlDoc, xPath, "height"_ostr).toInt32(); } // Without the accompanying fix in place, this test would have failed with: // - Expected: 521 (~500) @@ -1503,20 +1518,20 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testScriptinfosurrogatePairs) // Without the fix it fails with: // - Expected: 11 // - Actual : 11◌ - assertXPath(pXmlDoc, "//txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "portion", - u"11"_ustr); - assertXPath(pXmlDoc, "//txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "portion", - u"\u25CC\U00010A01"_ustr); + assertXPath(pXmlDoc, "//txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]"_ostr, + "portion"_ostr, u"11"_ustr); + assertXPath(pXmlDoc, "//txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]"_ostr, + "portion"_ostr, u"\u25CC\U00010A01"_ustr); // Without the fix this would crash because we got a lone surrogate that // can’t be converted to UTF-8, but if it were not for that it might fail // with something like: // - Expected: 11 // - Actual : 11𝐀 - assertXPath(pXmlDoc, "//txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "portion", - u"11"_ustr); - assertXPath(pXmlDoc, "//txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "portion", - u"\U0001D400\u064E"_ustr); + assertXPath(pXmlDoc, "//txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]"_ostr, + "portion"_ostr, u"11"_ustr); + assertXPath(pXmlDoc, "//txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]"_ostr, + "portion"_ostr, u"\U0001D400\u064E"_ustr); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf112594) @@ -1530,8 +1545,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf112594) // - Expected: 11 // - Actual : 11\u202F // (U+020F is a space, so might not be visible) - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion[1]", "portion", u"11"_ustr); - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion[2]", "portion", + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion[1]"_ostr, "portion"_ostr, + u"11"_ustr); + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion[2]"_ostr, "portion"_ostr, u"\u202F\u1824"_ustr); } diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index c5d7d8fc740e..9369a187c482 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -60,12 +60,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese) std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); - assertXPath(pXmlDoc, "//font[1]", "orientation", "900"); + assertXPath(pXmlDoc, "//font[1]"_ostr, "orientation"_ostr, "900"); // Without the accompanying fix in place, this test would have failed with: // - Expected: false // - Actual : true // i.e. the glyph was rotated further, so it was upside down. - assertXPath(pXmlDoc, "//font[1]", "vertical", "false"); + assertXPath(pXmlDoc, "//font[1]"_ostr, "vertical"_ostr, "false"); } CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testSpecialInsertAfterMergedCells) diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index ea0f802ad515..fd5c139e979a 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -425,15 +425,16 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlTextPortionEnum) // Also test the generated layout: xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwFieldPortion", "expand", ""); + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwFieldPortion"_ostr, "expand"_ostr, ""); // Without the accompanying fix in place, this test would have failed with: // - Expected: PortionType::ContentControl // - Actual : PortionType::Text // i.e. SwContentControl generated a plain text portion, not a dedicated content control // portion. - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion", "type", + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion"_ostr, "type"_ostr, "PortionType::ContentControl"); - assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion", "portion", "test*"); + assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion"_ostr, "portion"_ostr, + "test*"); // Also test the doc model, make sure that there is a dummy character at the start and end, so // the user can explicitly decide if they want to expand the content control or not: @@ -844,7 +845,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testParagraphMarkerODFExport) // i.e. the custom "red" color was lost as RES_PARATR_LIST_AUTOFMT was not serialized to ODT. CPPUNIT_ASSERT_EQUAL( OUString("00ff0000"), - getXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwFieldPortion/SwFont", "color")); + getXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwFieldPortion/SwFont"_ostr, "color"_ostr)); } CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testParagraphMarkerFormattedRun) @@ -861,9 +862,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testParagraphMarkerFormattedRun) // - Expected: normal // - Actual : bold // i.e. the numbering portion was bold, while its weight should be normal. - CPPUNIT_ASSERT_EQUAL( - OUString("normal"), - getXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwFieldPortion/SwFont", "weight")); + CPPUNIT_ASSERT_EQUAL(OUString("normal"), + getXPath(pXmlDoc, + "//SwParaPortion/SwLineLayout/SwFieldPortion/SwFont"_ostr, + "weight"_ostr)); } CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testFlySplit) @@ -982,7 +984,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testCollectFrameAtNodeWithLayout) // element. xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); // Also make sure that we don't have multiple <draw:frame> elements in the first place. - assertXPath(pXmlDoc, "//draw:frame", 1); + assertXPath(pXmlDoc, "//draw:frame"_ostr, 1); } CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf149555) diff --git a/sw/qa/extras/docbookexport/docbookexport.cxx b/sw/qa/extras/docbookexport/docbookexport.cxx index 74241d353d33..10568528b10b 100644 --- a/sw/qa/extras/docbookexport/docbookexport.cxx +++ b/sw/qa/extras/docbookexport/docbookexport.cxx @@ -24,7 +24,7 @@ DECLARE_DOCBOOKEXPORT_TEST(testsimple, "simple.docx") xmlDocUniquePtr pDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pDoc); - assertXPathContent(pDoc, "/article/para", "aaaa"); + assertXPathContent(pDoc, "/article/para"_ostr, "aaaa"); } /* the test actually should crash with this file */ diff --git a/sw/qa/extras/fodfexport/fodfexport.cxx b/sw/qa/extras/fodfexport/fodfexport.cxx index c666d7a31054..30bcc1fcf54a 100644 --- a/sw/qa/extras/fodfexport/fodfexport.cxx +++ b/sw/qa/extras/fodfexport/fodfexport.cxx @@ -28,9 +28,9 @@ DECLARE_FODFEXPORT_TEST(testTdf113696, "tdf113696.odt") if (xmlDocUniquePtr pXmlDoc = parseExportedFile()) { assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/" - "draw:image[@draw:mime-type='image/x-vclgraphic']"); + "draw:image[@draw:mime-type='image/x-vclgraphic']"_ostr); assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/" - "draw:image[@draw:mime-type='image/png']"); + "draw:image[@draw:mime-type='image/png']"_ostr); } } @@ -43,9 +43,9 @@ DECLARE_FODFEXPORT_TEST(testTdf113696WriterImage, "tdf113696-writerimage.odt") if (xmlDocUniquePtr pXmlDoc = parseExportedFile()) { assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/" - "draw:image[@draw:mime-type='image/x-vclgraphic']"); + "draw:image[@draw:mime-type='image/x-vclgraphic']"_ostr); assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/" - "draw:image[@draw:mime-type='image/png']"); + "draw:image[@draw:mime-type='image/png']"_ostr); } } diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index cdf56ccf45d5..c12e300ebfaa 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -983,18 +983,18 @@ void Test::testODF13() // check XML xmlDocUniquePtr pContentXml = parseExport("content.xml"); - assertXPath(pContentXml, "/office:document-content/office:automatic-styles/style:style/style:paragraph-properties[@style:contextual-spacing='true']"); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/meta:creator-initials"); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/loext:sender-initials", 0); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-start"); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-start", 0); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-end"); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-end", 0); + assertXPath(pContentXml, "/office:document-content/office:automatic-styles/style:style/style:paragraph-properties[@style:contextual-spacing='true']"_ostr); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/meta:creator-initials"_ostr); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/loext:sender-initials"_ostr, 0); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-start"_ostr); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-start"_ostr, 0); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-end"_ostr); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-end"_ostr, 0); xmlDocUniquePtr pStylesXml = parseExport("styles.xml"); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:header-first"); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:header-first", 0); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:footer-first"); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:footer-first", 0); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:header-first"_ostr); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:header-first"_ostr, 0); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:footer-first"_ostr); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:footer-first"_ostr, 0); // check model verifyText13("1.3 reload"); @@ -1016,18 +1016,18 @@ void Test::testODF13() // check XML xmlDocUniquePtr pContentXml = parseExport("content.xml"); - assertXPath(pContentXml, "/office:document-content/office:automatic-styles/style:style/style:paragraph-properties[@loext:contextual-spacing='true']"); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/loext:sender-initials"); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/meta:creator-initials", 0); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-start"); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-start", 0); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-end"); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-end", 0); + assertXPath(pContentXml, "/office:document-content/office:automatic-styles/style:style/style:paragraph-properties[@loext:contextual-spacing='true']"_ostr); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/loext:sender-initials"_ostr); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/meta:creator-initials"_ostr, 0); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-start"_ostr); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-start"_ostr, 0); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-end"_ostr); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-end"_ostr, 0); xmlDocUniquePtr pStylesXml = parseExport("styles.xml"); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:header-first"); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:header-first", 0); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:footer-first"); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:footer-first", 0); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:header-first"_ostr); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:header-first"_ostr, 0); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:footer-first"_ostr); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:footer-first"_ostr, 0); // reload mxComponent->dispose(); @@ -1048,18 +1048,18 @@ void Test::testODF13() // check XML xmlDocUniquePtr pContentXml = parseExport("content.xml"); - assertXPathNoAttribute(pContentXml, "/office:document-content/office:automatic-styles/style:style/style:paragraph-properties", "contextual-spacing"); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/meta:creator-initials", 0); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/loext:sender-initials", 0); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-start", 0); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-start", 0); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-end", 0); - assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-end", 0); + assertXPathNoAttribute(pContentXml, "/office:document-content/office:automatic-styles/style:style/style:paragraph-properties"_ostr, "contextual-spacing"_ostr); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/meta:creator-initials"_ostr, 0); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:p/office:annotation/loext:sender-initials"_ostr, 0); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-start"_ostr, 0); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-start"_ostr, 0); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-end"_ostr, 0); + assertXPath(pContentXml, "/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-end"_ostr, 0); xmlDocUniquePtr pStylesXml = parseExport("styles.xml"); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:header-first", 0); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:header-first", 0); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:footer-first", 0); - assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:footer-first", 0); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:header-first"_ostr, 0); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:header-first"_ostr, 0); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/style:footer-first"_ostr, 0); + assertXPath(pStylesXml, "/office:document-styles/office:master-styles/style:master-page/loext:footer-first"_ostr, 0); } } @@ -1318,7 +1318,7 @@ CPPUNIT_TEST_FIXTURE(Test, testListLabelPDFExport) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -1406,17 +1406,17 @@ CPPUNIT_TEST_FIXTURE(Test, testListLabelPDFExport) auto pObject0 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject0) continue; - auto pType0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject0->Lookup("Type")); + auto pType0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject0->Lookup("Type"_ostr)); if (!pType0 || pType0->GetValue() != "StructElem") { continue; } - auto pS0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject0->Lookup("S")); + auto pS0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject0->Lookup("S"_ostr)); if (!pS0 || pS0->GetValue() != "Document") { continue; } - auto pKids0 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject0->Lookup("K")); + auto pKids0 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject0->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids0); for (const auto& pKid0 : pKids0->GetElements()) @@ -1425,16 +1425,16 @@ CPPUNIT_TEST_FIXTURE(Test, testListLabelPDFExport) CPPUNIT_ASSERT(pRefKid0); auto pObject1 = pRefKid0->LookupObject(); CPPUNIT_ASSERT(pObject1); - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); CPPUNIT_ASSERT(pType1); if (pType1 && pType1->GetValue() == "StructElem") { - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); if (pS1 && pS1->GetValue() == "L") { ++nL; - auto pKids1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K")); + auto pKids1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1); // this is purely structural so there should be 1 child CPPUNIT_ASSERT_EQUAL(size_t(1), pKids1->GetElements().size()); @@ -1443,14 +1443,14 @@ CPPUNIT_TEST_FIXTURE(Test, testListLabelPDFExport) CPPUNIT_ASSERT(pRefKid11); auto pObject11 = pRefKid11->LookupObject(); CPPUNIT_ASSERT(pObject11); - auto pType11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("Type")); + auto pType11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("Type"_ostr)); CPPUNIT_ASSERT(pType11); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType11->GetValue()); - auto pS11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("S")); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType11->GetValue()); + auto pS11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("S"_ostr)); CPPUNIT_ASSERT(pS11); - CPPUNIT_ASSERT_EQUAL(OString("LI"), pS11->GetValue()); + CPPUNIT_ASSERT_EQUAL("LI"_ostr, pS11->GetValue()); // LI has 2 children: Lbl and LBody - auto pKids11 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject11->Lookup("K")); + auto pKids11 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject11->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids11); CPPUNIT_ASSERT_EQUAL(size_t(2), pKids11->GetElements().size()); @@ -1458,14 +1458,14 @@ CPPUNIT_TEST_FIXTURE(Test, testListLabelPDFExport) ... etc. - the rest is truncated