sc/qa/extras/htmlexporttest.cxx | 14 sc/qa/extras/macros-test.cxx | 8 sc/qa/unit/SparklineImportExportTest.cxx | 67 +- sc/qa/unit/ThemeImportExportTest.cxx | 62 +- sc/qa/unit/dataproviders_test.cxx | 6 sc/qa/unit/jumbosheets-test.cxx | 14 sc/qa/unit/pivottable_filters_test.cxx | 687 ++++++++++++++------------- sc/qa/unit/screenshots/screenshots.cxx | 30 - sc/qa/unit/subsequent_export_test.cxx | 560 +++++++++++----------- sc/qa/unit/subsequent_export_test2.cxx | 377 ++++++++------ sc/qa/unit/subsequent_export_test3.cxx | 138 ++--- sc/qa/unit/subsequent_export_test4.cxx | 318 ++++++------ sc/qa/unit/tiledrendering/tiledrendering.cxx | 42 - sc/qa/unit/ucalc_copypaste.cxx | 10 sc/source/core/data/document10.cxx | 2 sc/source/core/data/table7.cxx | 4 sc/source/filter/excel/xecontent.cxx | 18 sc/source/filter/excel/xeescher.cxx | 2 sc/source/filter/excel/xeextlst.cxx | 16 sc/source/filter/excel/xepivotxml.cxx | 24 sc/source/filter/excel/xeview.cxx | 2 sc/source/filter/html/htmlexp.cxx | 2 sc/source/ui/app/inputhdl.cxx | 6 sc/source/ui/app/scmod.cxx | 2 sc/source/ui/unoobj/docuno.cxx | 8 sc/source/ui/view/drawview.cxx | 2 sc/source/ui/view/gridwin.cxx | 26 - sc/source/ui/view/tabview3.cxx | 2 sc/source/ui/view/tabvwsh4.cxx | 8 29 files changed, 1310 insertions(+), 1147 deletions(-)
New commits: commit 099be392bfc5ddba21370726fa887a2fd6c99cd5 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Nov 19 17:31:36 2023 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Nov 19 20:38:33 2023 +0100 Extended loplugin:ostr: sc Change-Id: I44536a13f4c31558671c1166d06b7f6216456641 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159680 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx index 6e28d791fbb3..774f75078a85 100644 --- a/sc/qa/extras/htmlexporttest.cxx +++ b/sc/qa/extras/htmlexporttest.cxx @@ -38,16 +38,16 @@ public: htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT (pDoc); - assertXPath(pDoc, "/html/body", 1); - assertXPath(pDoc, "/html/body/table/tr/td/img", 1); + assertXPath(pDoc, "/html/body"_ostr, 1); + assertXPath(pDoc, "/html/body/table/tr/td/img"_ostr, 1); setFilterOptions("SkipImages"); save("HTML (StarCalc)"); pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT (pDoc); - assertXPath(pDoc, "/html/body", 1); - assertXPath(pDoc, "/html/body/table/tr/td/img", 0); + assertXPath(pDoc, "/html/body"_ostr, 1); + assertXPath(pDoc, "/html/body/table/tr/td/img"_ostr, 0); } void testTdf155244() @@ -58,10 +58,10 @@ public: xmlDocUniquePtr pXmlDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pXmlDoc); - assertXPath(pXmlDoc, "/xhtml:html", 1); + assertXPath(pXmlDoc, "/xhtml:html"_ostr, 1); // the problem was that there were 2 CSS styles named "Default" - assertXPath(pXmlDoc, "/xhtml:html/xhtml:body/xhtml:table/xhtml:tr/xhtml:td", "class", "cell-Default"); - OUString const styles = getXPathContent(pXmlDoc, "/xhtml:html/xhtml:head/xhtml:style"); + assertXPath(pXmlDoc, "/xhtml:html/xhtml:body/xhtml:table/xhtml:tr/xhtml:td"_ostr, "class"_ostr, "cell-Default"); + OUString const styles = getXPathContent(pXmlDoc, "/xhtml:html/xhtml:head/xhtml:style"_ostr); CPPUNIT_ASSERT(styles.indexOf(".graphic-Default{ background-color:#729fcf;") != -1); CPPUNIT_ASSERT(styles.indexOf(".cell-Default{ font-size:10pt; font-family:'Liberation Sans'; }") != -1); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), styles.indexOf(".Default")); diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index f1602465f7d2..c483a05c9300 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -167,13 +167,13 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testMacroButtonFormControlXlsxExport) // Without the fix in place, this test would have failed with: // - XPath '//x:controlPr' no attribute 'macro' exist // i.e. the macro was lost on export. - assertXPath(pSheetDoc, "//x:controlPr", "macro", "Module1.Button1_Click"); + assertXPath(pSheetDoc, "//x:controlPr"_ostr, "macro"_ostr, "Module1.Button1_Click"); // Then also make sure that there is no defined name for the macro, which is only needed for // XLS: xmlDocUniquePtr pWorkbookDoc = parseExport("xl/workbook.xml"); CPPUNIT_ASSERT(pWorkbookDoc); - assertXPath(pWorkbookDoc, "//x:workbook/definedNames", 0); + assertXPath(pWorkbookDoc, "//x:workbook/definedNames"_ostr, 0); } CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf104902) @@ -255,14 +255,14 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf89920) assertXPathContent(pContentXml, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" - "table:table-row[1]/table:table-cell[1]/text:p[1]", + "table:table-row[1]/table:table-cell[1]/text:p[1]"_ostr, "aa bb"); // Without the fix in place, this test would have failed here with // - Expression: xmlXPathNodeSetGetLength(pXmlNodes) > 0 assertXPathContent(pContentXml, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" - "table:table-row[1]/table:table-cell[1]/text:p[2]", + "table:table-row[1]/table:table-cell[1]/text:p[2]"_ostr, "cc dd"); } diff --git a/sc/qa/unit/SparklineImportExportTest.cxx b/sc/qa/unit/SparklineImportExportTest.cxx index 7b7d37b6f242..63f7867bc7fc 100644 --- a/sc/qa/unit/SparklineImportExportTest.cxx +++ b/sc/qa/unit/SparklineImportExportTest.cxx @@ -51,7 +51,7 @@ void checkSparklines(ScDocument& rDocument) { auto pSparkline = rDocument.GetSparkline(ScAddress(0, 1, 0)); // A2 CPPUNIT_ASSERT(pSparkline); - CPPUNIT_ASSERT_EQUAL(OString("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"), + CPPUNIT_ASSERT_EQUAL("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"_ostr, pSparkline->getSparklineGroup()->getID().getString()); auto& rAttributes = pSparkline->getSparklineGroup()->getAttributes(); @@ -170,42 +170,45 @@ void SparklineImportExportTest::testSparklinesExportODS() xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); // We have 3 sparkline groups = 3 tables that contain sparklines - assertXPath(pXmlDoc, "//table:table/calcext:sparkline-groups", 3); + assertXPath(pXmlDoc, "//table:table/calcext:sparkline-groups"_ostr, 3); // Check the number of sparkline groups in table[1] - assertXPath(pXmlDoc, "//table:table[1]/calcext:sparkline-groups/calcext:sparkline-group", 2); + assertXPath(pXmlDoc, "//table:table[1]/calcext:sparkline-groups/calcext:sparkline-group"_ostr, + 2); // Check the number of sparkline groups in table[2] - assertXPath(pXmlDoc, "//table:table[2]/calcext:sparkline-groups/calcext:sparkline-group", 2); + assertXPath(pXmlDoc, "//table:table[2]/calcext:sparkline-groups/calcext:sparkline-group"_ostr, + 2); // Check the number of sparkline groups in table[3] - assertXPath(pXmlDoc, "//table:table[3]/calcext:sparkline-groups/calcext:sparkline-group", 3); + assertXPath(pXmlDoc, "//table:table[3]/calcext:sparkline-groups/calcext:sparkline-group"_ostr, + 3); // Check table[1] - sparkline-group[1] OString aSparklineGroupPath - = "//table:table[1]/calcext:sparkline-groups/calcext:sparkline-group[1]"; - assertXPath(pXmlDoc, aSparklineGroupPath, "type", "line"); - assertXPath(pXmlDoc, aSparklineGroupPath, "line-width", "1pt"); - assertXPath(pXmlDoc, aSparklineGroupPath, "display-empty-cells-as", "gap"); - assertXPath(pXmlDoc, aSparklineGroupPath, "markers", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "high", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "low", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "first", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "last", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "negative", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "display-x-axis", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "min-axis-type", "individual"); - assertXPath(pXmlDoc, aSparklineGroupPath, "max-axis-type", "individual"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-series", "#376092"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-negative", "#00b050"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-axis", "#000000"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-markers", "#000000"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-first", "#7030a0"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-last", "#ff0000"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-high", "#92d050"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-low", "#00b0f0"); + = "//table:table[1]/calcext:sparkline-groups/calcext:sparkline-group[1]"_ostr; + assertXPath(pXmlDoc, aSparklineGroupPath, "type"_ostr, "line"); + assertXPath(pXmlDoc, aSparklineGroupPath, "line-width"_ostr, "1pt"); + assertXPath(pXmlDoc, aSparklineGroupPath, "display-empty-cells-as"_ostr, "gap"); + assertXPath(pXmlDoc, aSparklineGroupPath, "markers"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "high"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "low"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "first"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "last"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "negative"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "display-x-axis"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "min-axis-type"_ostr, "individual"); + assertXPath(pXmlDoc, aSparklineGroupPath, "max-axis-type"_ostr, "individual"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-series"_ostr, "#376092"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-negative"_ostr, "#00b050"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-axis"_ostr, "#000000"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-markers"_ostr, "#000000"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-first"_ostr, "#7030a0"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-last"_ostr, "#ff0000"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-high"_ostr, "#92d050"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-low"_ostr, "#00b0f0"); assertXPath(pXmlDoc, aSparklineGroupPath + "/calcext:sparklines/calcext:sparkline", 1); assertXPath(pXmlDoc, aSparklineGroupPath + "/calcext:sparklines/calcext:sparkline[1]", - "cell-address", "Sheet1.A2"); + "cell-address"_ostr, "Sheet1.A2"); } void SparklineImportExportTest::testSparklinesRoundtripODS() @@ -236,10 +239,10 @@ void SparklineImportExportTest::testNoSparklinesInDocumentXLSX() xmlDocUniquePtr pXmlDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pXmlDoc); - assertXPath(pXmlDoc, "/x:worksheet", 1); - assertXPath(pXmlDoc, "/x:worksheet/x:extLst/x:ext/x14:sparklineGroups", 0); - assertXPath(pXmlDoc, "/x:worksheet/x:extLst/x:ext", 0); - assertXPath(pXmlDoc, "/x:worksheet/x:extLst", 0); + assertXPath(pXmlDoc, "/x:worksheet"_ostr, 1); + assertXPath(pXmlDoc, "/x:worksheet/x:extLst/x:ext/x14:sparklineGroups"_ostr, 0); + assertXPath(pXmlDoc, "/x:worksheet/x:extLst/x:ext"_ostr, 0); + assertXPath(pXmlDoc, "/x:worksheet/x:extLst"_ostr, 0); } namespace @@ -248,7 +251,7 @@ void checkSparklineThemeColors(ScDocument& rDocument) { auto pSparkline = rDocument.GetSparkline(ScAddress(0, 1, 0)); // A2 CPPUNIT_ASSERT(pSparkline); - CPPUNIT_ASSERT_EQUAL(OString("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"), + CPPUNIT_ASSERT_EQUAL("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"_ostr, pSparkline->getSparklineGroup()->getID().getString()); auto& rAttributes = pSparkline->getSparklineGroup()->getAttributes(); diff --git a/sc/qa/unit/ThemeImportExportTest.cxx b/sc/qa/unit/ThemeImportExportTest.cxx index ec33c2a1afe3..d8c7c468c368 100644 --- a/sc/qa/unit/ThemeImportExportTest.cxx +++ b/sc/qa/unit/ThemeImportExportTest.cxx @@ -86,12 +86,12 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExportAndImport) assertXPath(pXmlDoc, sThemeColorsPath + "[@loext:name='MyColorSet']"); const OString sThemeColorPath = sThemeColorsPath + "/loext:color"; assertXPath(pXmlDoc, sThemeColorPath, 12); - assertXPath(pXmlDoc, sThemeColorPath + "[3]", "name", "dark2"); - assertXPath(pXmlDoc, sThemeColorPath + "[3]", "color", "#333333"); - assertXPath(pXmlDoc, sThemeColorPath + "[9]", "name", "accent5"); - assertXPath(pXmlDoc, sThemeColorPath + "[9]", "color", "#999999"); - assertXPath(pXmlDoc, sThemeColorPath + "[12]", "name", "followed-hyperlink"); - assertXPath(pXmlDoc, sThemeColorPath + "[12]", "color", "#cccccc"); + assertXPath(pXmlDoc, sThemeColorPath + "[3]", "name"_ostr, "dark2"); + assertXPath(pXmlDoc, sThemeColorPath + "[3]", "color"_ostr, "#333333"); + assertXPath(pXmlDoc, sThemeColorPath + "[9]", "name"_ostr, "accent5"); + assertXPath(pXmlDoc, sThemeColorPath + "[9]", "color"_ostr, "#999999"); + assertXPath(pXmlDoc, sThemeColorPath + "[12]", "name"_ostr, "followed-hyperlink"); + assertXPath(pXmlDoc, sThemeColorPath + "[12]", "color"_ostr, "#cccccc"); } // Check the theme after import/export cycle @@ -119,42 +119,42 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExportOOXML) { xmlDocUniquePtr pXmlDoc = parseExport("xl/theme/theme1.xml"); - OString aClrScheme = "/a:theme/a:themeElements/a:clrScheme"; - assertXPath(pXmlDoc, aClrScheme, "name", "Office"); - assertXPath(pXmlDoc, aClrScheme + "/a:dk1/a:srgbClr", "val", "000000"); - assertXPath(pXmlDoc, aClrScheme + "/a:lt1/a:srgbClr", "val", "ffffff"); - assertXPath(pXmlDoc, aClrScheme + "/a:dk2/a:srgbClr", "val", "44546a"); - assertXPath(pXmlDoc, aClrScheme + "/a:lt2/a:srgbClr", "val", "e7e6e6"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent1/a:srgbClr", "val", "4472c4"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent2/a:srgbClr", "val", "ed7d31"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent3/a:srgbClr", "val", "a5a5a5"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent4/a:srgbClr", "val", "ffc000"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent5/a:srgbClr", "val", "5b9bd5"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent6/a:srgbClr", "val", "70ad47"); - assertXPath(pXmlDoc, aClrScheme + "/a:hlink/a:srgbClr", "val", "0563c1"); - assertXPath(pXmlDoc, aClrScheme + "/a:folHlink/a:srgbClr", "val", "954f72"); + OString aClrScheme = "/a:theme/a:themeElements/a:clrScheme"_ostr; + assertXPath(pXmlDoc, aClrScheme, "name"_ostr, "Office"); + assertXPath(pXmlDoc, aClrScheme + "/a:dk1/a:srgbClr", "val"_ostr, "000000"); + assertXPath(pXmlDoc, aClrScheme + "/a:lt1/a:srgbClr", "val"_ostr, "ffffff"); + assertXPath(pXmlDoc, aClrScheme + "/a:dk2/a:srgbClr", "val"_ostr, "44546a"); + assertXPath(pXmlDoc, aClrScheme + "/a:lt2/a:srgbClr", "val"_ostr, "e7e6e6"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent1/a:srgbClr", "val"_ostr, "4472c4"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent2/a:srgbClr", "val"_ostr, "ed7d31"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent3/a:srgbClr", "val"_ostr, "a5a5a5"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent4/a:srgbClr", "val"_ostr, "ffc000"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent5/a:srgbClr", "val"_ostr, "5b9bd5"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent6/a:srgbClr", "val"_ostr, "70ad47"); + assertXPath(pXmlDoc, aClrScheme + "/a:hlink/a:srgbClr", "val"_ostr, "0563c1"); + assertXPath(pXmlDoc, aClrScheme + "/a:folHlink/a:srgbClr", "val"_ostr, "954f72"); } { xmlDocUniquePtr pXmlDoc = parseExport("xl/styles.xml"); - assertXPath(pXmlDoc, "/x:styleSheet", 1); + assertXPath(pXmlDoc, "/x:styleSheet"_ostr, 1); // Fonts - OString aFont = "/x:styleSheet/x:fonts/x:font"; + OString aFont = "/x:styleSheet/x:fonts/x:font"_ostr; assertXPath(pXmlDoc, aFont, 6); - assertXPath(pXmlDoc, aFont + "[5]/x:color", "theme", "7"); - assertXPath(pXmlDoc, aFont + "[6]/x:color", "rgb", "FF9C5700"); + assertXPath(pXmlDoc, aFont + "[5]/x:color", "theme"_ostr, "7"); + assertXPath(pXmlDoc, aFont + "[6]/x:color", "rgb"_ostr, "FF9C5700"); // Fills - OString aFill = "/x:styleSheet/x:fills/x:fill"; + OString aFill = "/x:styleSheet/x:fills/x:fill"_ostr; assertXPath(pXmlDoc, aFill, 4); - assertXPath(pXmlDoc, aFill + "[1]/x:patternFill", "patternType", "none"); - assertXPath(pXmlDoc, aFill + "[2]/x:patternFill", "patternType", "gray125"); - assertXPath(pXmlDoc, aFill + "[3]/x:patternFill", "patternType", "solid"); - assertXPath(pXmlDoc, aFill + "[3]/x:patternFill/x:fgColor", "rgb", "FFFFEB9C"); - assertXPath(pXmlDoc, aFill + "[4]/x:patternFill", "patternType", "solid"); - assertXPath(pXmlDoc, aFill + "[4]/x:patternFill/x:fgColor", "theme", "4"); + assertXPath(pXmlDoc, aFill + "[1]/x:patternFill", "patternType"_ostr, "none"); + assertXPath(pXmlDoc, aFill + "[2]/x:patternFill", "patternType"_ostr, "gray125"); + assertXPath(pXmlDoc, aFill + "[3]/x:patternFill", "patternType"_ostr, "solid"); + assertXPath(pXmlDoc, aFill + "[3]/x:patternFill/x:fgColor", "rgb"_ostr, "FFFFEB9C"); + assertXPath(pXmlDoc, aFill + "[4]/x:patternFill", "patternType"_ostr, "solid"); + assertXPath(pXmlDoc, aFill + "[4]/x:patternFill/x:fgColor", "theme"_ostr, "4"); } } diff --git a/sc/qa/unit/dataproviders_test.cxx b/sc/qa/unit/dataproviders_test.cxx index d4d0a9f8f60c..5b1aa76b95ed 100644 --- a/sc/qa/unit/dataproviders_test.cxx +++ b/sc/qa/unit/dataproviders_test.cxx @@ -158,9 +158,9 @@ void ScDataProvidersTest::testXMLImport() ScOrcusImportXMLParam::RangeLink aRangeLink; aRangeLink.maPos = ScAddress(0, 0, 0); - aRangeLink.maFieldPaths.push_back("/bookstore/book/title"); - aRangeLink.maFieldPaths.push_back("/bookstore/book/author"); - aRangeLink.maRowGroups.push_back("/bookstore/book"); + aRangeLink.maFieldPaths.push_back("/bookstore/book/title"_ostr); + aRangeLink.maFieldPaths.push_back("/bookstore/book/author"_ostr); + aRangeLink.maRowGroups.push_back("/bookstore/book"_ostr); aParam.maRangeLinks.push_back(aRangeLink); OUString aFileURL = createFileURL(u"xml/test1.xml"); diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index 468b479deb3d..e3bba0717a86 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -139,12 +139,12 @@ void ScJumboSheetsTest::testRoundtripColumnRangeOds() CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table/" - "table:table-row[1]/table:table-cell[1]", - "formula", "of:=SUM([.2:.2])"); + "table:table-row[1]/table:table-cell[1]"_ostr, + "formula"_ostr, "of:=SUM([.2:.2])"); assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table/" - "table:table-row[1]/table:table-cell[2]", - "formula", "of:=SUM([.C:.C])"); + "table:table-row[1]/table:table-cell[2]"_ostr, + "formula"_ostr, "of:=SUM([.C:.C])"); } } @@ -161,8 +161,10 @@ void ScJumboSheetsTest::testRoundtripColumnRangeXlsx() CPPUNIT_ASSERT_EQUAL(OUString("=SUM(C:C)"), pDoc->GetFormula(1, 0, 0)); xmlDocUniquePtr pXmlDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pXmlDoc); - assertXPathContent(pXmlDoc, "/x:worksheet/x:sheetData/x:row[1]/x:c[1]/x:f", "SUM(2:2)"); - assertXPathContent(pXmlDoc, "/x:worksheet/x:sheetData/x:row[1]/x:c[2]/x:f", "SUM(C:C)"); + assertXPathContent(pXmlDoc, "/x:worksheet/x:sheetData/x:row[1]/x:c[1]/x:f"_ostr, + "SUM(2:2)"); + assertXPathContent(pXmlDoc, "/x:worksheet/x:sheetData/x:row[1]/x:c[2]/x:f"_ostr, + "SUM(C:C)"); } } diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index c89380f1aebf..8d6b1ad5d39e 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -579,11 +579,13 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableExportXLSX) xmlDocUniquePtr pTable = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items", "count", - "4"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item", 4); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item[3]", - "h", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items"_ostr, + "count"_ostr, "4"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item"_ostr, + 4); + assertXPath(pTable, + "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item[3]"_ostr, + "h"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableExportXLSXSingleDataField) @@ -594,15 +596,15 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableExportXLSXSingleData xmlDocUniquePtr pTable = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "ref", "A3:B6"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstDataRow", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstDataCol", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields", "count", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "ref"_ostr, "A3:B6"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstHeaderRow"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstDataRow"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstDataCol"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields"_ostr, "count"_ostr, "1"); // There should not be any colFields tag, before the fix there used to be a singleton with // <field x="-2"/> as child node. - assertXPath(pTable, "/x:pivotTableDefinition/x:colFields", 0); + assertXPath(pTable, "/x:pivotTableDefinition/x:colFields"_ostr, 0); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableExportXLSXMultipleDataFields) @@ -613,19 +615,19 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableExportXLSXMultipleDa xmlDocUniquePtr pTable = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "ref", "A1:C6"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstDataRow", "2"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstDataCol", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "ref"_ostr, "A1:C6"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstHeaderRow"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstDataRow"_ostr, "2"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstDataCol"_ostr, "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields", "count", "2"); + assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields"_ostr, "count"_ostr, "2"); // There should be a single colFields tag with sole child node // <field x="-2"/>. - assertXPath(pTable, "/x:pivotTableDefinition/x:colFields", 1); - assertXPath(pTable, "/x:pivotTableDefinition/x:colFields", "count", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:colFields/x:field", 1); - assertXPath(pTable, "/x:pivotTableDefinition/x:colFields/x:field", "x", "-2"); + assertXPath(pTable, "/x:pivotTableDefinition/x:colFields"_ostr, 1); + assertXPath(pTable, "/x:pivotTableDefinition/x:colFields"_ostr, "count"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:colFields/x:field"_ostr, 1); + assertXPath(pTable, "/x:pivotTableDefinition/x:colFields/x:field"_ostr, "x"_ostr, "-2"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotCacheExportXLSX) @@ -643,235 +645,267 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotCacheExportXLSX) xmlDocUniquePtr pCacheDef = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pCacheDef); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 6); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField"_ostr, 6); // Four strings and one empty field - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", - "mixed strings and empty"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsBlank", "1"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsSemiMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsNonDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsString"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "minDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "maxDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsNumber"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsInteger"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "minValue"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "maxValue"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "count", "5"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]"_ostr, + "name"_ostr, "mixed strings and empty"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsBlank"_ostr, "1"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsNonDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsString"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "minDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "maxDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsNumber"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsInteger"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "minValue"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "maxValue"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "count"_ostr, "5"); // Two integers and one empty field - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]", "name", - "mixed empty fields and integers"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsBlank", "1"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsSemiMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsNonDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsString", "0"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "minDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "maxDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsNumber", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsInteger", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "minValue", "111"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "maxValue", "222"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]"_ostr, + "name"_ostr, "mixed empty fields and integers"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsBlank"_ostr, "1"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsNonDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsString"_ostr, "0"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "minDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "maxDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsNumber"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsInteger"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "minValue"_ostr, "111"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "maxValue"_ostr, "222"); // We list items on round-trip, Excel not, but Excel accepts that; We need list all items, because we are using it as reference in pivotCacheRecords1.xml - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "count", "3"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "count"_ostr, "3"); // Five integers - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]", "name", - "all fields are integers"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsBlank"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsMixedTypes"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsSemiMixedTypes", "0"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsNonDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsString", "0"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "minDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "maxDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsNumber", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsInteger", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "minValue", "1111"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "maxValue", "5555"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]"_ostr, + "name"_ostr, "all fields are integers"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsBlank"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr, "0"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsNonDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsString"_ostr, "0"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "minDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "maxDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsNumber"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsInteger"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "minValue"_ostr, "1111"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "maxValue"_ostr, "5555"); // We list items on round-trip, Excel not, but Excel accepts that; We need list all items, because we are using it as reference in pivotCacheRecords1.xml - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "count", "5"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "count"_ostr, "5"); // Three integers and one string - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]", "name", - "mixed strings and integers"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsBlank"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsMixedTypes", "1"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsSemiMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsNonDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsString"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "minDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "maxDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsNumber", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsInteger", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "minValue", "1234"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "maxValue", "5678"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]"_ostr, + "name"_ostr, "mixed strings and integers"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsBlank"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr, "1"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsNonDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsString"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "minDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "maxDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsNumber"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsInteger"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "minValue"_ostr, "1234"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "maxValue"_ostr, "5678"); // We list items on round-trip, Excel not, but Excel accepts that; We need list all items, because we are using it as reference in pivotCacheRecords1.xml - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "count", "4"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "count"_ostr, "4"); // Four dates without blanks - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]", "name", - "date and time with duplicated entries"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsBlank"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsMixedTypes"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsSemiMixedTypes", "0"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsNonDate", "0"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsDate", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsString", "0"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "minDate", "1899-12-31T00:00:00"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "maxDate", "2009-07-06T10:53:02"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsNumber"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsInteger"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "minValue"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "maxValue"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]"_ostr, + "name"_ostr, "date and time with duplicated entries"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsBlank"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr, "0"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsNonDate"_ostr, "0"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsDate"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsString"_ostr, "0"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "minDate"_ostr, "1899-12-31T00:00:00"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "maxDate"_ostr, "2009-07-06T10:53:02"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsNumber"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsInteger"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "minValue"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "maxValue"_ostr); // We list items on round-trip, Excel not, but Excel accepts that; We need list all items, because we are using it as reference in pivotCacheRecords1.xml - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "count", "4"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "count"_ostr, "4"); // Only blanks - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]", "name", - "blank"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsBlank", "1"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsMixedTypes"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]"_ostr, + "name"_ostr, "blank"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsBlank"_ostr, "1"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); // Despite what documentation says, in case there's only blank values in field (no strings), containsSemiMixedTypes is true (default - not written) - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsSemiMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsString", "0"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "minDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "maxDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsNumber"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsInteger"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "minValue"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "maxValue"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "count", "1"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsString"_ostr, "0"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "minDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "maxDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsNumber"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsInteger"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "minValue"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "maxValue"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "count"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableXLSX) @@ -1729,15 +1763,15 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableFirstHeaderRowXLSX) save("Calc Office Open XML"); xmlDocUniquePtr pTable = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstHeaderRow"_ostr, "1"); pTable = parseExport("xl/pivotTables/pivotTable2.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstHeaderRow"_ostr, "1"); pTable = parseExport("xl/pivotTables/pivotTable3.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstHeaderRow"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableDoubleFieldFilterXLSX) @@ -2160,11 +2194,12 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableOutlineModeXLSX) CPPUNIT_ASSERT(pTable); // Next to the outline flags, compact flags also should be set (true is the default) - assertXPath(pTable, "/x:pivotTableDefinition", "outline", "1"); - assertXPath(pTable, "/x:pivotTableDefinition", "outlineData", "1"); - assertXPath(pTable, "/x:pivotTableDefinition", "compact", "0"); - assertXPath(pTable, "/x:pivotTableDefinition", "compactData", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "compact", "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "outline"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "outlineData"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "compact"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "compactData"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]"_ostr, + "compact"_ostr, "0"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableDuplicatedMemberFilterXLSX) @@ -2176,10 +2211,10 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableDuplicatedMemberFilt CPPUNIT_ASSERT(pTable); // Check whether page field has the right number of items - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]", "axis", + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]"_ostr, "axis"_ostr, "axisPage"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]/x:items", "count", - "21"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]/x:items"_ostr, + "count"_ostr, "21"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableTabularModeXLSX) @@ -2191,12 +2226,14 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableTabularModeXLSX) CPPUNIT_ASSERT(pTable); // In tabular mode both outline and compact flag should be false - assertXPath(pTable, "/x:pivotTableDefinition", "outline", "0"); - assertXPath(pTable, "/x:pivotTableDefinition", "outlineData", "0"); - assertXPath(pTable, "/x:pivotTableDefinition", "compact", "0"); - assertXPath(pTable, "/x:pivotTableDefinition", "compactData", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "compact", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "outline", "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "outline"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "outlineData"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "compact"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "compactData"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]"_ostr, + "compact"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]"_ostr, + "outline"_ostr, "0"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableDuplicateFields) @@ -2207,17 +2244,19 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableDuplicateFields) xmlDocUniquePtr pCacheDef = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pCacheDef); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields", "count", "6"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", "ID"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]", "name", "Name"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]", "name", - "Score"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]", "name", - "Method"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]", "name", - "method2"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]", "name", - "Method3"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields"_ostr, "count"_ostr, "6"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]"_ostr, + "name"_ostr, "ID"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]"_ostr, + "name"_ostr, "Name"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]"_ostr, + "name"_ostr, "Score"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]"_ostr, + "name"_ostr, "Method"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]"_ostr, + "name"_ostr, "method2"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]"_ostr, + "name"_ostr, "Method3"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf112106) @@ -2255,8 +2294,9 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf123923) xmlDocUniquePtr pTable = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems/x:e", - "v", "#REF!"); + assertXPath(pTable, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems/x:e"_ostr, + "v"_ostr, "#REF!"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf123939) @@ -2269,17 +2309,17 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf123939) xmlDocUniquePtr pTable = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); - assertXPathNoAttribute(pTable, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsMixedTypes"); + assertXPathNoAttribute( + pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); // But we must emit containsMixedTypes="1" for a mix of errors and non-string types! pTable = parseExport("xl/pivotCache/pivotCacheDefinition2.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsMixedTypes", "1"); + assertXPath(pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124651) @@ -2292,7 +2332,8 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124651) // We have to export name attribute, even though it's optional according to ECMA-376 standard, // because Excel (at least 2016) seems to require it. // tdf#124881: this shouldn't be an empty string - assertXPath(pDoc, "/x:pivotTableDefinition/x:dataFields/x:dataField", "name", "Sum - num"); + assertXPath(pDoc, "/x:pivotTableDefinition/x:dataFields/x:dataField"_ostr, "name"_ostr, + "Sum - num"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124736) @@ -2304,33 +2345,34 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124736) xmlDocUniquePtr pTable = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems", - "count", "45"); + assertXPath( + pTable, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems"_ostr, + "count"_ostr, "45"); // Group items must start with "<05/16/1958", then years sorted ascending, then ">06/11/2009" // They used to have years in the beginning, then "<05/16/1958", then ">06/11/2009". // The "<" and ">" date strings are locale-dependent, so test depends on en_US locale assertXPath( pTable, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[1]", - "v", "<05/16/1958"); + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[1]"_ostr, + "v"_ostr, "<05/16/1958"); for (int i = 2; i <= 44; ++i) assertXPath( pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[" + OString::number(i) + "]", - "v", OUString::number(1963 + i)); + "v"_ostr, OUString::number(1963 + i)); assertXPath( pTable, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[45]", - "v", ">06/11/2009"); + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[45]"_ostr, + "v"_ostr, ">06/11/2009"); // Now check that table references these in correct order (document-dependent, so this is how // it should be in this specific testdoc which shows "<" and ">" values in the end) pTable = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items", "count", - "46"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items"_ostr, + "count"_ostr, "46"); const int vals[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 0, 44 }; @@ -2339,10 +2381,11 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124736) assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items/x:item[" + OString::number(i + 1) + "]", - "x", OUString::number(vals[i])); + "x"_ostr, OUString::number(vals[i])); } - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items/x:item[46]", - "t", "default"); + assertXPath(pTable, + "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items/x:item[46]"_ostr, + "t"_ostr, "default"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124772NumFmt) @@ -2355,15 +2398,15 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124772NumFmt) CPPUNIT_ASSERT(pTable); // This asserts that numFmtId attribute is present - const OUString sXclNumFmt - = getXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField", "numFmtId"); + const OUString sXclNumFmt = getXPath( + pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField"_ostr, "numFmtId"_ostr); pTable = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pTable); // Check that we refer to correct format assertXPath(pTable, "/x:styleSheet/x:numFmts/x:numFmt[@numFmtId='" + sXclNumFmt.toUtf8() + "']", - "formatCode", "\\$#,##0"); + "formatCode"_ostr, "\\$#,##0"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124810) @@ -2377,13 +2420,18 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124810) CPPUNIT_ASSERT(pTable); // All attributes must have been roundtripped correctly (testdoc uses some non-default values) - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "name", + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, "name"_ostr, "PivotStyleDark1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showRowHeaders", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showColHeaders", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showRowStripes", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showColStripes", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showLastColumn", "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showRowHeaders"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showColHeaders"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showRowStripes"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showColStripes"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showLastColumn"_ostr, "0"); } { @@ -2397,13 +2445,18 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124810) CPPUNIT_ASSERT(pTable); // The default style for pivot tables in Excel 2007 through 2016 is PivotStyleLight16 - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "name", + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, "name"_ostr, "PivotStyleLight16"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showRowHeaders", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showColHeaders", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showRowStripes", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showColStripes", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showLastColumn", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showRowHeaders"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showColHeaders"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showRowStripes"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showColStripes"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showLastColumn"_ostr, "1"); } } @@ -2416,9 +2469,9 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124883) CPPUNIT_ASSERT(pTable); // The field names must be kept just as they appear in original XLSX - assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[1]", "name", + assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[1]"_ostr, "name"_ostr, "Sum of Value"); - assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[2]", "name", + assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[2]"_ostr, "name"_ostr, "Count of Value2"); } @@ -2429,8 +2482,8 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf125046) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "longText", "1"); + assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "longText"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf125055) @@ -2446,26 +2499,32 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf125055) // "2017-07-10T09:11:02.99999..." into "2017-07-10T09:11:02", creating two identical strings // Only compare times here: see comment to ScPivotTableFiltersTest::testPivotCacheExportXLSX // "TODO Date generator in tests are one day higher, than during standard xlsx export" - OUString sISODateTime = getXPath( - pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "minDate"); + OUString sISODateTime + = getXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "minDate"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("T09:11:02"), sISODateTime.copy(10)); - sISODateTime = getXPath( - pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "maxDate"); + sISODateTime + = getXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "maxDate"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("T09:11:03"), sISODateTime.copy(10)); - assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "count", "3"); - assertXPathChildren(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", + assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "count"_ostr, "3"); + assertXPathChildren(pDoc, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, 3); // 2 different values + empty sISODateTime = getXPath( - pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[1]", "v"); + pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[1]"_ostr, + "v"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("T09:11:02"), sISODateTime.copy(10)); sISODateTime = getXPath( - pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[2]", "v"); + pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[2]"_ostr, + "v"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("T09:11:03"), sISODateTime.copy(10)); // Trailing empty CPPUNIT_ASSERT_EQUAL( - 2, getXPathPosition( - pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "m")); + 2, + getXPathPosition( + pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, "m")); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf125086) @@ -2475,9 +2534,11 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf125086) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]", "axis", "axisRow"); + assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]"_ostr, "axis"_ostr, + "axisRow"); // "dataField" attribute was not written for this "axisRow" field - assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]", "dataField", "1"); + assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]"_ostr, + "dataField"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf73845) diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index ee167117278a..19e93c95fce7 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -111,21 +111,21 @@ void ScScreenshotTest::initialize() void ScScreenshotTest::registerKnownDialogsByID(mapType& rKnownDialogs) { // fill map of known dialogs - rKnownDialogs["modules/scalc/ui/insertsheet.ui"] = 0; - rKnownDialogs["modules/scalc/ui/deletecells.ui"] = 1; - rKnownDialogs["modules/scalc/ui/pastespecial.ui"] = 2; - rKnownDialogs["modules/scalc/ui/changesourcedialog.ui"] = 3; - rKnownDialogs["modules/scalc/ui/selectdatasource.ui"] = 4; - rKnownDialogs["modules/scalc/ui/selectsource.ui"] = 5; - rKnownDialogs["modules/scalc/ui/deletecontents.ui"] = 6; - rKnownDialogs["modules/scalc/ui/createnamesdialog.ui"] = 7; - rKnownDialogs["modules/scalc/ui/inputstringdialog.ui"] = 8; - rKnownDialogs["modules/scalc/ui/tabcolordialog.ui"] = 9; - rKnownDialogs["modules/scalc/ui/textimportoptions.ui"] = 10; - rKnownDialogs["modules/scalc/ui/dataform.ui"] = 11; - rKnownDialogs["modules/scalc/ui/movecopysheet.ui"] = 12; - rKnownDialogs["modules/scalc/ui/textimportcsv.ui"] = 13; - rKnownDialogs["modules/scalc/ui/formatcellsdialog.ui"] = 14; + rKnownDialogs["modules/scalc/ui/insertsheet.ui"_ostr] = 0; + rKnownDialogs["modules/scalc/ui/deletecells.ui"_ostr] = 1; + rKnownDialogs["modules/scalc/ui/pastespecial.ui"_ostr] = 2; + rKnownDialogs["modules/scalc/ui/changesourcedialog.ui"_ostr] = 3; + rKnownDialogs["modules/scalc/ui/selectdatasource.ui"_ostr] = 4; + rKnownDialogs["modules/scalc/ui/selectsource.ui"_ostr] = 5; + rKnownDialogs["modules/scalc/ui/deletecontents.ui"_ostr] = 6; + rKnownDialogs["modules/scalc/ui/createnamesdialog.ui"_ostr] = 7; + rKnownDialogs["modules/scalc/ui/inputstringdialog.ui"_ostr] = 8; + rKnownDialogs["modules/scalc/ui/tabcolordialog.ui"_ostr] = 9; + rKnownDialogs["modules/scalc/ui/textimportoptions.ui"_ostr] = 10; + rKnownDialogs["modules/scalc/ui/dataform.ui"_ostr] = 11; + rKnownDialogs["modules/scalc/ui/movecopysheet.ui"_ostr] = 12; + rKnownDialogs["modules/scalc/ui/textimportcsv.ui"_ostr] = 13; + rKnownDialogs["modules/scalc/ui/formatcellsdialog.ui"_ostr] = 14; } VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID) diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 035709a036ac..30600191d54a 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -100,8 +100,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf139167) xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:cellStyles", "count", "6"); - assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:fill/x:patternFill/x:bgColor", "rgb", + assertXPath(pDoc, "/x:styleSheet/x:cellStyles"_ostr, "count"_ostr, "6"); + assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:fill/x:patternFill/x:bgColor"_ostr, "rgb"_ostr, "FFFFFF00"); } @@ -118,14 +118,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testFontColorWithMultipleAttributesDefined) xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:fonts", "count", "6"); + assertXPath(pDoc, "/x:styleSheet/x:fonts"_ostr, "count"_ostr, "6"); // Expect "theme" attribute to be set correctly - assertXPath(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:color", "theme", "1"); + assertXPath(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:color"_ostr, "theme"_ostr, "1"); // We don't export "rgb" attribute - assertXPathNoAttribute(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:color", "rgb"); + assertXPathNoAttribute(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:color"_ostr, "rgb"_ostr); // Just making sure the checked font is the correct one - assertXPath(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:name", "val", "Calibri"); + assertXPath(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:name"_ostr, "val"_ostr, "Calibri"); } CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf139394) @@ -139,17 +139,17 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf139394) assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" - "x14:cfRule/xm:f", + "x14:cfRule/xm:f"_ostr, "LEFT(A1,LEN(\"+\"))=\"+\""); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" - "x14:cfRule/xm:f", + "x14:cfRule/xm:f"_ostr, "RIGHT(A2,LEN(\"-\"))=\"-\""); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[3]/" - "x14:cfRule/xm:f", + "x14:cfRule/xm:f"_ostr, "LEFT(A3,LEN($B$3))=$B$3"); } @@ -164,32 +164,32 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testExtCondFormatXLSX) assertXPath( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" - "x14:cfRule", - "type", "containsText"); + "x14:cfRule"_ostr, + "type"_ostr, "containsText"); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" - "x14:cfRule/xm:f[1]", + "x14:cfRule/xm:f[1]"_ostr, "NOT(ISERROR(SEARCH($B$1,A1)))"); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" - "x14:cfRule/xm:f[2]", + "x14:cfRule/xm:f[2]"_ostr, "$B$1"); assertXPath( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" - "x14:cfRule", - "type", "notContainsText"); + "x14:cfRule"_ostr, + "type"_ostr, "notContainsText"); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" - "x14:cfRule/xm:f[1]", + "x14:cfRule/xm:f[1]"_ostr, "ISERROR(SEARCH($B$2,A2))"); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" - "x14:cfRule/xm:f[2]", + "x14:cfRule/xm:f[2]"_ostr, "$B$2"); } @@ -204,11 +204,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf90104) assertXPathContent(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation/mc:AlternateContent" - "/mc:Choice/x12ac:list", + "/mc:Choice/x12ac:list"_ostr, "1,\"2,3\",4,\"5,6\""); assertXPathContent(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation/mc:AlternateContent" - "/mc:Fallback/x:formula1", + "/mc:Fallback/x:formula1"_ostr, "\"1,2,3,4,5,6\""); } @@ -221,7 +221,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf111876) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/worksheets/_rels/sheet1.xml.rels"); CPPUNIT_ASSERT(pDoc); - OUString sTarget = getXPath(pDoc, "/rels:Relationships/rels:Relationship", "Target"); + OUString sTarget = getXPath(pDoc, "/rels:Relationships/rels:Relationship"_ostr, "Target"_ostr); // Document is saved to the temporary directory, relative path should be different than original one CPPUNIT_ASSERT(sTarget != "../xls/bug-fixes.xls"); @@ -357,14 +357,16 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF16LErtlSHA1) // round-trip the password as-is save("calc8"); xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, - "//office:spreadsheet[@table:structure-protected='true' and " - "@table:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); - assertXPath(pXmlDoc, - "//table:table[@table:protected='true' and " - "@table:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); + assertXPath( + pXmlDoc, + "//office:spreadsheet[@table:structure-protected='true' and " + "@table:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=' and " + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); + assertXPath( + pXmlDoc, + "//table:table[@table:protected='true' and " + "@table:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=' and " + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA1) @@ -383,14 +385,16 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA1) // round-trip the password as-is save("calc8"); xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, - "//office:spreadsheet[@table:structure-protected='true' and " - "@table:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); - assertXPath(pXmlDoc, - "//table:table[@table:protected='true' and " - "@table:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); + assertXPath( + pXmlDoc, + "//office:spreadsheet[@table:structure-protected='true' and " + "@table:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=' and " + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); + assertXPath( + pXmlDoc, + "//table:table[@table:protected='true' and " + "@table:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=' and " + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256ODF12) @@ -413,12 +417,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256ODF12) pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and " "@table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"_ostr); assertXPath( pXmlDoc, "//table:table[@table:protected='true' and " "@table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256W3C) @@ -441,12 +445,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256W3C) pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and " "@table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"_ostr); assertXPath( pXmlDoc, "//table:table[@table:protected='true' and " "@table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_XL_SHA1) @@ -471,14 +475,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_XL_SHA1) "@table:protection-key='OX3WkEe79fv1PE+FUmfOLdwVoqI=' and " "@table:protection-key-digest-algorithm='http://docs.oasis-open.org/office/ns/table/" "legacy-hash-excel' and " - "@loext:protection-key-digest-algorithm-2='http://www.w3.org/2000/09/xmldsig#sha1']"); + "@loext:protection-key-digest-algorithm-2='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); assertXPath( pXmlDoc, "//table:table[@table:protected='true' and " "@table:protection-key='OX3WkEe79fv1PE+FUmfOLdwVoqI=' and " "@table:protection-key-digest-algorithm='http://docs.oasis-open.org/office/ns/table/" "legacy-hash-excel' and " - "@loext:protection-key-digest-algorithm-2='http://www.w3.org/2000/09/xmldsig#sha1']"); + "@loext:protection-key-digest-algorithm-2='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest, testColorScaleExportODS) @@ -536,27 +540,27 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testCommentExportXLSX) xmlDocUniquePtr pComments = parseExport("xl/comments1.xml"); CPPUNIT_ASSERT(pComments); - assertXPathContent(pComments, "/x:comments/x:authors/x:author[1]", "BAKO"); - assertXPath(pComments, "/x:comments/x:authors/x:author", 1); + assertXPathContent(pComments, "/x:comments/x:authors/x:author[1]"_ostr, "BAKO"); + assertXPath(pComments, "/x:comments/x:authors/x:author"_ostr, 1); - assertXPathContent(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", + assertXPathContent(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t"_ostr, "Komentarz"); xmlDocUniquePtr pVmlDrawing = parseExport("xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); //assertXPath(pVmlDrawing, "/xml/v:shapetype", "coordsize", "21600,21600"); - assertXPath(pVmlDrawing, "/xml/v:shapetype", "spt", "202"); - assertXPath(pVmlDrawing, "/xml/v:shapetype/v:stroke", "joinstyle", "miter"); - const OUString sShapeTypeId = "#" + getXPath(pVmlDrawing, "/xml/v:shapetype", "id"); + assertXPath(pVmlDrawing, "/xml/v:shapetype"_ostr, "spt"_ostr, "202"); + assertXPath(pVmlDrawing, "/xml/v:shapetype/v:stroke"_ostr, "joinstyle"_ostr, "miter"); + const OUString sShapeTypeId = "#" + getXPath(pVmlDrawing, "/xml/v:shapetype"_ostr, "id"_ostr); - assertXPath(pVmlDrawing, "/xml/v:shape", "type", sShapeTypeId); - assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "color", "black"); - assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "obscured", "t"); + assertXPath(pVmlDrawing, "/xml/v:shape"_ostr, "type"_ostr, sShapeTypeId); + assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow"_ostr, "color"_ostr, "black"); + assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow"_ostr, "obscured"_ostr, "t"); //tdf#117274 fix MSO interoperability with the secret VML shape type id - assertXPath(pVmlDrawing, "/xml/v:shapetype", "id", "_x0000_t202"); - assertXPath(pVmlDrawing, "/xml/v:shape", "type", "#_x0000_t202"); + assertXPath(pVmlDrawing, "/xml/v:shapetype"_ostr, "id"_ostr, "_x0000_t202"); + assertXPath(pVmlDrawing, "/xml/v:shape"_ostr, "type"_ostr, "#_x0000_t202"); } CPPUNIT_TEST_FIXTURE(ScExportTest, testCommentExportXLSX_2_XLSX) @@ -577,13 +581,13 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testCommentExportXLSX_2_XLSX) xmlDocUniquePtr pComments = parseExport("xl/comments1.xml"); CPPUNIT_ASSERT(pComments); - assertXPathContent(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", + assertXPathContent(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t"_ostr, "visible comment"); xmlDocUniquePtr pVmlDrawing = parseExport("xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); - assertXPath(pVmlDrawing, "/xml/v:shape/x:ClientData/x:Visible", 0); + assertXPath(pVmlDrawing, "/xml/v:shape/x:ClientData/x:Visible"_ostr, 0); } #if HAVE_MORE_FONTS @@ -599,63 +603,63 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testCustomColumnWidthExportXLSX) // tdf#124741: check that we export default width, otherwise the skipped columns would have // wrong width. Previously defaultColWidth attribute was missing double nDefWidth - = getXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "defaultColWidth").toDouble(); + = getXPath(pSheet, "/x:worksheet/x:sheetFormatPr"_ostr, "defaultColWidth"_ostr).toDouble(); CPPUNIT_ASSERT_DOUBLES_EQUAL(11.53515625, nDefWidth, 0.01); // First column, has everything default (width in Calc: 1280), skipped // Second column, has custom width (width in Calc: 1225) - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "2"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "2"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "customWidth"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "min"_ostr, "2"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "max"_ostr, "2"); // Third column, has everything default (width in Calc: 1280), skipped // Fourth column has custom width. Columns from 4 to 7 are hidden - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "customWidth", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "min", "4"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "max", "4"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "customWidth"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "min"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "max"_ostr, "4"); // 5th column has custom width. Columns from 4 to 7 are hidden - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "customWidth", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "min", "5"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "max", "5"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "customWidth"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "min"_ostr, "5"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "max"_ostr, "5"); // 6th and 7th columns have default width and they are hidden - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "customWidth", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "min", "6"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "max", "7"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "customWidth"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "min"_ostr, "6"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "max"_ostr, "7"); // 8th column has everything default - skipped // 9th column has custom width - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "customWidth", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "min", "9"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "max", "9"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "customWidth"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "min"_ostr, "9"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "max"_ostr, "9"); // We expected that exactly 5 unique Nodes will be produced - assertXPath(pSheet, "/x:worksheet/x:cols/x:col", 5); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col"_ostr, 5); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "customFormat", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "customHeight", "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "customFormat"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "customHeight"_ostr, "false"); } #endif @@ -669,17 +673,17 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testXfDefaultValuesXLSX) CPPUNIT_ASSERT(pSheet); // cellStyleXfs don't need xfId, so we need to make sure it is not saved - assertXPathNoAttribute(pSheet, "/x:styleSheet/x:cellStyleXfs/x:xf[1]", "xfId"); + assertXPathNoAttribute(pSheet, "/x:styleSheet/x:cellStyleXfs/x:xf[1]"_ostr, "xfId"_ostr); // Because numFmtId fontId fillId borderId xfId are not existing during import // it should be created during export, with values set to "0" - assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[1]", "xfId", "0"); - assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[2]", "xfId", "0"); - assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[3]", "xfId", "0"); - assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[4]", "xfId", "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[1]"_ostr, "xfId"_ostr, "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[2]"_ostr, "xfId"_ostr, "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[3]"_ostr, "xfId"_ostr, "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[4]"_ostr, "xfId"_ostr, "0"); // We expected that exactly 15 cellXfs:xf Nodes will be produced - assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf", 14); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf"_ostr, 14); } static auto verifySpreadsheet13(char const* const pTestName, ScDocument& rDoc) -> void @@ -730,12 +734,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testODF13) // check XML xmlDocUniquePtr pContentXml = parseExport("content.xml"); assertXPath(pContentXml, "/office:document-content/office:automatic-styles/style:style/" - "style:table-properties[@table:tab-color='#ff3838']"); + "style:table-properties[@table:tab-color='#ff3838']"_ostr); xmlDocUniquePtr pStylesXml = parseExport("styles.xml"); assertXPath(pStylesXml, "/office:document-styles/office:automatic-styles/style:page-layout/" - "style:page-layout-properties[@style:scale-to-X='2']"); + "style:page-layout-properties[@style:scale-to-X='2']"_ostr); assertXPath(pStylesXml, "/office:document-styles/office:automatic-styles/style:page-layout/" - "style:page-layout-properties[@style:scale-to-Y='3']"); + "style:page-layout-properties[@style:scale-to-Y='3']"_ostr); // check model verifySpreadsheet13("1.3 reload", *pDoc); @@ -753,12 +757,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testODF13) // check XML xmlDocUniquePtr pContentXml = parseExport("content.xml"); assertXPath(pContentXml, "/office:document-content/office:automatic-styles/style:style/" - "style:table-properties[@tableooo:tab-color='#ff3838']"); + "style:table-properties[@tableooo:tab-color='#ff3838']"_ostr); xmlDocUniquePtr pStylesXml = parseExport("styles.xml"); assertXPath(pStylesXml, "/office:document-styles/office:automatic-styles/style:page-layout/" - "style:page-layout-properties[@loext:scale-to-X='2']"); + "style:page-layout-properties[@loext:scale-to-X='2']"_ostr); assertXPath(pStylesXml, "/office:document-styles/office:automatic-styles/style:page-layout/" ... etc. - the rest is truncated