include/test/xmltesttools.hxx | 11 +++++++++ oox/qa/unit/mcgr.cxx | 24 ++++++++++---------- sc/qa/unit/ThemeImportExportTest.cxx | 28 +++++++++++------------ sc/qa/unit/subsequent_export_test3.cxx | 9 ++++--- sd/qa/unit/export-tests-ooxml1.cxx | 33 ++++++++++++++++------------ sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 8 +++--- sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 16 ++++++------- sw/qa/extras/ooxmlexport/ooxmlw14export.cxx | 10 ++++---- test/source/xmltesttools.cxx | 8 ++++++ 9 files changed, 87 insertions(+), 60 deletions(-)
New commits: commit ba1de32981c698d5de697bff221f4bd7c2e6bf02 Author: Michael Meeks <[email protected]> AuthorDate: Tue Oct 7 16:33:11 2025 +0100 Commit: Michael Meeks <[email protected]> CommitDate: Thu Oct 9 12:37:15 2025 +0200 oox: add case-insensitive hex color comparison to the tests. Change-Id: I1d0f6d5e21a27d45f1a8d3a837ff6094a9e0cf34 Signed-off-by: Michael Meeks <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192071 Tested-by: Jenkins diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx index c6f10dd7edb6..555c64afe333 100644 --- a/include/test/xmltesttools.hxx +++ b/include/test/xmltesttools.hxx @@ -98,6 +98,17 @@ protected: { assertXPath(pXmlDoc, sXPath.getStr(), pAttribute, rExpectedValue); } + /** + * Assert that pXPath exists, returns exactly one node, and the pXPath's attribute's value + * is ASCII case-insensively equals to the rExpected value. + */ + void assertXPathInsensitive(const xmlDocUniquePtr& pXmlDoc, const char* pXPath, const char* pAttribute, + std::u16string_view rExpectedValue); + void assertXPathInsensitive(const xmlDocUniquePtr& pXmlDoc, const OString& sXPath, const char* pAttribute, + std::u16string_view rExpectedValue) + { + assertXPathInsensitive(pXmlDoc, sXPath.getStr(), pAttribute, rExpectedValue); + } void assertXPathAttrs(const xmlDocUniquePtr& pXmlDoc, const char* pXPath, const std::vector<std::pair<const char*, std::u16string_view>>& aPairVector); void assertXPathAttrs(const xmlDocUniquePtr& pXmlDoc, const OString& sXPath, diff --git a/oox/qa/unit/mcgr.cxx b/oox/qa/unit/mcgr.cxx index 5cef50f06a8d..88bc2bce99a4 100644 --- a/oox/qa/unit/mcgr.cxx +++ b/oox/qa/unit/mcgr.cxx @@ -37,11 +37,11 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradient) static constexpr OString sPath = "//a:r/a:rPr/a:gradFill/a:gsLst/"_ostr; assertXPath(pXmlDoc, sPath + "a:gs", 3); assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos", u"0"); - assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", u"ff1493"); + assertXPathInsensitive(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", u"ff1493"); assertXPath(pXmlDoc, sPath + "a:gs[2]", "pos", u"30000"); - assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val", u"ffff00"); + assertXPathInsensitive(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val", u"ffff00"); assertXPath(pXmlDoc, sPath + "a:gs[3]", "pos", u"100000"); - assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val", u"00ffff"); + assertXPathInsensitive(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val", u"00ffff"); } CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradientWord) @@ -60,11 +60,11 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradientWord) static constexpr OString sPath = "//w14:gradFill/w14:gsLst/"_ostr; assertXPath(pXmlDoc, sPath + "w14:gs", 3); assertXPath(pXmlDoc, sPath + "w14:gs[1]", "pos", u"0"); - assertXPath(pXmlDoc, sPath + "w14:gs[1]/w14:srgbClr", "val", u"ff1493"); + assertXPathInsensitive(pXmlDoc, sPath + "w14:gs[1]/w14:srgbClr", "val", u"ff1493"); assertXPath(pXmlDoc, sPath + "w14:gs[2]", "pos", u"30000"); - assertXPath(pXmlDoc, sPath + "w14:gs[2]/w14:srgbClr", "val", u"ffff00"); + assertXPathInsensitive(pXmlDoc, sPath + "w14:gs[2]/w14:srgbClr", "val", u"ffff00"); assertXPath(pXmlDoc, sPath + "w14:gs[3]", "pos", u"100000"); - assertXPath(pXmlDoc, sPath + "w14:gs[3]/w14:srgbClr", "val", u"00ffff"); + assertXPathInsensitive(pXmlDoc, sPath + "w14:gs[3]/w14:srgbClr", "val", u"00ffff"); } CPPUNIT_TEST_FIXTURE(TestMCGR, testTdf155825_SourcOffsetRangeDifferent) @@ -97,9 +97,9 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testStepCount) assertXPath(pXmlDoc, sPath + "a:gs[@pos='50000']", 2); assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000']", 2); // Without fix the color was 808080. - assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000'][1]/a:srgbClr", "val", u"55aaaa"); + assertXPathInsensitive(pXmlDoc, sPath + "a:gs[@pos='75000'][1]/a:srgbClr", "val", u"55aaaa"); // Without fix the color was 40bfbf, producing a gradient in the last segment. - assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000'][2]/a:srgbClr", "val", u"00ffff"); + assertXPathInsensitive(pXmlDoc, sPath + "a:gs[@pos='75000'][2]/a:srgbClr", "val", u"00ffff"); } CPPUNIT_TEST_FIXTURE(TestMCGR, testAxialColorLinearTrans) @@ -118,13 +118,13 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testAxialColorLinearTrans) static constexpr OString sPath = "//a:gradFill/a:gsLst/"_ostr; assertXPath(pXmlDoc, sPath + "a:gs", 3); assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos", u"0"); - assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", u"00ffff"); + assertXPathInsensitive(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", u"00ffff"); assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr/a:alpha", "val", u"20000"); assertXPath(pXmlDoc, sPath + "a:gs[2]", "pos", u"50000"); - assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val", u"ff0000"); - assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr/a:alpha", "val", u"60396"); + assertXPathInsensitive(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val", u"ff0000"); + assertXPathInsensitive(pXmlDoc, sPath + "a:gs[2]/a:srgbClr/a:alpha", "val", u"60396"); assertXPath(pXmlDoc, sPath + "a:gs[3]", "pos", u"100000"); - assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val", u"00ffff"); + assertXPathInsensitive(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val", u"00ffff"); // no <a:alpha> element for default val="100000" assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr/a:alpha", 0); } diff --git a/sc/qa/unit/ThemeImportExportTest.cxx b/sc/qa/unit/ThemeImportExportTest.cxx index 5f09ab65247a..82291c6a0bb9 100644 --- a/sc/qa/unit/ThemeImportExportTest.cxx +++ b/sc/qa/unit/ThemeImportExportTest.cxx @@ -120,18 +120,18 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExportOOXML) xmlDocUniquePtr pXmlDoc = parseExport(u"xl/theme/theme1.xml"_ustr); OString aClrScheme = "/a:theme/a:themeElements/a:clrScheme"_ostr; assertXPath(pXmlDoc, aClrScheme, "name", u"Office"); - assertXPath(pXmlDoc, aClrScheme + "/a:dk1/a:srgbClr", "val", u"000000"); - assertXPath(pXmlDoc, aClrScheme + "/a:lt1/a:srgbClr", "val", u"FFFFFF"); - assertXPath(pXmlDoc, aClrScheme + "/a:dk2/a:srgbClr", "val", u"44546A"); - assertXPath(pXmlDoc, aClrScheme + "/a:lt2/a:srgbClr", "val", u"E7E6E6"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent1/a:srgbClr", "val", u"4472C4"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent2/a:srgbClr", "val", u"ED7D31"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent3/a:srgbClr", "val", u"A5A5A5"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent4/a:srgbClr", "val", u"FFC000"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent5/a:srgbClr", "val", u"5B9BD5"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent6/a:srgbClr", "val", u"70AD47"); - assertXPath(pXmlDoc, aClrScheme + "/a:hlink/a:srgbClr", "val", u"0563C1"); - assertXPath(pXmlDoc, aClrScheme + "/a:folHlink/a:srgbClr", "val", u"954F72"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:dk1/a:srgbClr", "val", u"000000"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:lt1/a:srgbClr", "val", u"FFFFFF"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:dk2/a:srgbClr", "val", u"44546A"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:lt2/a:srgbClr", "val", u"E7E6E6"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:accent1/a:srgbClr", "val", u"4472C4"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:accent2/a:srgbClr", "val", u"ED7D31"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:accent3/a:srgbClr", "val", u"A5A5A5"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:accent4/a:srgbClr", "val", u"FFC000"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:accent5/a:srgbClr", "val", u"5B9BD5"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:accent6/a:srgbClr", "val", u"70AD47"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:hlink/a:srgbClr", "val", u"0563C1"); + assertXPathInsensitive(pXmlDoc, aClrScheme + "/a:folHlink/a:srgbClr", "val", u"954F72"); } { @@ -143,7 +143,7 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExportOOXML) OString aFont = "/x:styleSheet/x:fonts/x:font"_ostr; assertXPath(pXmlDoc, aFont, 6); assertXPath(pXmlDoc, aFont + "[5]/x:color", "theme", u"7"); - assertXPath(pXmlDoc, aFont + "[6]/x:color", "rgb", u"FF9C5700"); + assertXPathInsensitive(pXmlDoc, aFont + "[6]/x:color", "rgb", u"FF9C5700"); // Fills OString aFill = "/x:styleSheet/x:fills/x:fill"_ostr; @@ -151,7 +151,7 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExportOOXML) assertXPath(pXmlDoc, aFill + "[1]/x:patternFill", "patternType", u"none"); assertXPath(pXmlDoc, aFill + "[2]/x:patternFill", "patternType", u"gray125"); assertXPath(pXmlDoc, aFill + "[3]/x:patternFill", "patternType", u"solid"); - assertXPath(pXmlDoc, aFill + "[3]/x:patternFill/x:fgColor", "rgb", u"FFFFEB9C"); + assertXPathInsensitive(pXmlDoc, aFill + "[3]/x:patternFill/x:fgColor", "rgb", u"FFFFEB9C"); assertXPath(pXmlDoc, aFill + "[4]/x:patternFill", "patternType", u"solid"); assertXPath(pXmlDoc, aFill + "[4]/x:patternFill/x:fgColor", "theme", u"4"); } diff --git a/sc/qa/unit/subsequent_export_test3.cxx b/sc/qa/unit/subsequent_export_test3.cxx index a4bcb98758ff..ddcaf14cf6a7 100644 --- a/sc/qa/unit/subsequent_export_test3.cxx +++ b/sc/qa/unit/subsequent_export_test3.cxx @@ -1469,10 +1469,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testTextUnderlineColorXLSX) assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr", "b", u"1"); // Make sure that the underline color is RED - assertXPath(pDoc, - "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFill/" - "a:solidFill/a:srgbClr", - "val", u"ff0000"); + assertXPathInsensitive( + pDoc, + "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFill/" + "a:solidFill/a:srgbClr", + "val", u"ff0000"); // Make sure the underline type is drawn with heavy line assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr", diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 8e74163e43f2..17eb1ed1674e 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -1427,7 +1427,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf100348FontworkBitmapFill) xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); static constexpr OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr"_ostr); assertXPath(pXmlDoc, sPathStart + "/a:blipFill/a:blip", 1); - assertXPath(pXmlDoc, sPathStart + "/a:ln/a:solidFill/a:srgbClr", "val", u"ffbf00"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:ln/a:solidFill/a:srgbClr", "val", u"ffbf00"); } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf100348FontworkGradientGlow) @@ -1439,9 +1439,10 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf100348FontworkGradientGlow) // Without the patch, fill was black and no glow applied. xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); static constexpr OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr"_ostr); - assertXPath(pXmlDoc, sPathStart + "/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", u"8d281e"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", + u"8d281e"); assertXPath(pXmlDoc, sPathStart + "/a:effectLst/a:glow", "rad", u"63360"); - assertXPath(pXmlDoc, sPathStart + "/a:effectLst/a:glow/a:srgbClr", "val", u"ff4500"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:effectLst/a:glow/a:srgbClr", "val", u"ff4500"); } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf128345FullTransparentGradient) @@ -1465,11 +1466,13 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf128345GradientLinear) assertXPath(pXmlDoc, sPathStart + "/a:lin", "ang", u"3600000"); assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2); assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]", "pos", u"25000"); - assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr", "val", u"ff0000"); - assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", u"20000"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr", "val", u"ff0000"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", + u"20000"); assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]", "pos", u"100000"); - assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr", "val", u"ff0000"); - assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", u"80000"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr", "val", u"ff0000"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", + u"80000"); } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf128345GradientRadial) @@ -1482,9 +1485,9 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf128345GradientRadial) xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); static constexpr OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill"_ostr); assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2); - assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr", "val", u"ff0000"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr", "val", u"ff0000"); assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", 0); - assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr", "val", u"ffffff"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr", "val", u"ffffff"); assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", u"0"); } @@ -1522,8 +1525,10 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf134969TransparencyOnColorGradien xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); static constexpr OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill"_ostr); assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2); - assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", u"60000"); - assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", u"60000"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", + u"60000"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", + u"60000"); } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testArcTo) @@ -1625,8 +1630,10 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf140865Wordart3D) assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:bevelT", "h", u"38100"); assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:bevelT", "prst", u"softRound"); assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:bevelB", "h", u"152400"); - assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:extrusionClr/a:srgbClr", "val", u"990000"); - assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:contourClr/a:srgbClr", "val", u"009876"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:sp3d/a:extrusionClr/a:srgbClr", "val", + u"990000"); + assertXPathInsensitive(pXmlDoc, sPathStart + "/a:sp3d/a:contourClr/a:srgbClr", "val", + u"009876"); } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf124457) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 34478da70c54..dade93420975 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -832,7 +832,7 @@ CPPUNIT_TEST_FIXTURE(Test, testShapeThemePreservation) "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:schemeClr", "val", u"accent6"); // check whether theme color has been converted into native color - assertXPath(pXmlDocument, + assertXPathInsensitive(pXmlDocument, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill/a:srgbClr", "val", u"9bbb59"); @@ -940,13 +940,13 @@ CPPUNIT_TEST_FIXTURE(Test, testGradientFillPreservation) xmlDocUniquePtr pXmlDocument = parseExport(u"word/document.xml"_ustr); // check rgb colors for every step in the gradient of the first shape - assertXPath(pXmlDocument, + assertXPathInsensitive(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", u"ffff00"); - assertXPath(pXmlDocument, + assertXPathInsensitive(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr", "val", u"ffff33"); - assertXPath(pXmlDocument, + assertXPathInsensitive(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[3]/a:srgbClr", "val", u"ff0000"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index f17a6fa1b827..fe559d9e89bc 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -142,7 +142,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo76979) // The problem was that black was exported as "auto" fill color, resulting in well-formed, but invalid XML. xmlDocUniquePtr pXmlDoc = parseExport(u"word/header2.xml"_ustr); // This was "auto", not "FFFFFF". - assertXPath(pXmlDoc, "//wps:spPr/a:solidFill/a:srgbClr", "val", u"FFFFFF"); + assertXPathInsensitive(pXmlDoc, "//wps:spPr/a:solidFill/a:srgbClr", "val", u"FFFFFF"); } CPPUNIT_TEST_FIXTURE(Test, testTdf104539) @@ -241,7 +241,7 @@ CPPUNIT_TEST_FIXTURE(Test, testShapeEffectPreservation) 0 ); // should not be present // 5th shape with glow effect, scheme color - assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + assertXPathInsensitive(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:srgbClr", "val", u"eb2722"); @@ -267,10 +267,10 @@ CPPUNIT_TEST_FIXTURE(Test, testShapeEffectPreservation) "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow", "rad", 63500); // actually, it returns 63360 - assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + assertXPathInsensitive(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:srgbClr", "val", u"eb2722"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + assertXPathInsensitive(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw", "blurRad", u"63500"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" @@ -391,7 +391,7 @@ CPPUNIT_TEST_FIXTURE(Test, testShape3DEffectPreservation) assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelB", "prst", u"relaxedInset"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + assertXPathInsensitive(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:contourClr/a:srgbClr", "val", u"3333ff"); @@ -410,7 +410,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPictureEffectPreservation) assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:glow", "rad", u"228600"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + assertXPathInsensitive(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:glow/a:srgbClr", "val", u"267de6"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" @@ -427,7 +427,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPictureEffectPreservation) assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:sp3d", "extrusionH", u"76200"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + assertXPathInsensitive(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:sp3d/a:extrusionClr/a:srgbClr", "val", u"92d050"); @@ -1040,7 +1040,7 @@ CPPUNIT_TEST_FIXTURE(Test, testExportShadow) assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw", "dist" , u"109865"); assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw", "dir" , u"634411"); - assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr", "val" , u"000000"); + assertXPathInsensitive(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr", "val" , u"000000"); assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr/a:alpha", "val" , u"38000"); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx index b8a0496f9874..6837f39e7781 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx @@ -108,7 +108,7 @@ CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_TextOutline) assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:textOutline/w14:gradFill/w14:gsLst/w14:gs[2]/w14:schemeClr/w14:lumOff", "val", u"60000"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:textOutline/w14:gradFill/w14:gsLst/w14:gs[3]", "pos", u"0"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:textOutline/w14:gradFill/w14:gsLst/w14:gs[3]/w14:srgbClr", "val", u"0070C0"); + assertXPathInsensitive(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:textOutline/w14:gradFill/w14:gsLst/w14:gs[3]/w14:srgbClr", "val", u"0070C0"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:textOutline/w14:gradFill/w14:gsLst/w14:gs[4]", "pos", u"100000"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:textOutline/w14:gradFill/w14:gsLst/w14:gs[4]/w14:schemeClr", "val", u"accent4"); @@ -125,7 +125,7 @@ CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_TextOutline) assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w14:textOutline", "cmpd", u"sng"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w14:textOutline", "algn", u"ctr"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w14:textOutline/w14:solidFill/w14:srgbClr", "val", u"FF0000"); + assertXPathInsensitive(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w14:textOutline/w14:solidFill/w14:srgbClr", "val", u"FF0000"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w14:textOutline/w14:prstDash", "val", u"solid"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w14:textOutline/w14:bevel", 1); @@ -164,7 +164,7 @@ CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_TextFill) assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w14:textFill/w14:gradFill/w14:gsLst/w14:gs[1]/w14:schemeClr/w14:lumMod", "val", u"67000"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w14:textFill/w14:gradFill/w14:gsLst/w14:gs[2]", "pos", u"50000"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w14:textFill/w14:gradFill/w14:gsLst/w14:gs[2]/w14:srgbClr", "val", u"00B0F0"); + assertXPathInsensitive(pXmlDoc, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w14:textFill/w14:gradFill/w14:gsLst/w14:gs[2]/w14:srgbClr", "val", u"00B0F0"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w14:textFill/w14:gradFill/w14:gsLst/w14:gs[2]/w14:srgbClr/w14:alpha", "val", u"10000"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w14:textFill/w14:gradFill/w14:gsLst/w14:gs[2]/w14:srgbClr/w14:lumMod", "val", u"80000"); @@ -203,7 +203,7 @@ CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_Props3d_Ligatures_NumForm_NumSpacing assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:props3d/w14:extrusionClr/w14:schemeClr/w14:lumOff", "val", u"80000"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:props3d/w14:contourClr", 1); - assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:props3d/w14:contourClr/w14:srgbClr", "val", u"92D050"); + assertXPathInsensitive(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:props3d/w14:contourClr/w14:srgbClr", "val", u"92D050"); // Paragraph 2 - w14:ligatures assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w14:ligatures", 1); @@ -310,7 +310,7 @@ CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_Groupshapes) assertXPath(pXmlDoc, sPathShadow, "kx", u"0"); assertXPath(pXmlDoc, sPathShadow, "ky", u"0"); assertXPath(pXmlDoc, sPathShadow, "algn", u"l"); - assertXPath(pXmlDoc, sPathShadow+"/w14:srgbClr", "val", u"92D050"); + assertXPathInsensitive(pXmlDoc, sPathShadow+"/w14:srgbClr", "val", u"92D050"); assertXPath(pXmlDoc, sPathShadow+"/w14:srgbClr/w14:alpha", "val", u"40000"); // Reflection diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx index d7d42c12da2c..65db26850e9f 100644 --- a/test/source/xmltesttools.cxx +++ b/test/source/xmltesttools.cxx @@ -184,6 +184,14 @@ void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const char* rExpectedValue, std::u16string_view(aValue)); } +void XmlTestTools::assertXPathInsensitive(const xmlDocUniquePtr& pXmlDoc, const char* pXPath, const char* pAttribute, std::u16string_view rExpectedValue) +{ + OUString aValue = getXPath(pXmlDoc, pXPath, pAttribute).toAsciiLowerCase(); + OUString aExpectedValue = OUString(rExpectedValue).toAsciiLowerCase(); + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + pXmlDoc->name + ">, attribute '" + pAttribute + "' of '" + pXPath + "' incorrect case insensitive value. '" + aValue.toUtf8() + "' should be '" + aExpectedValue.toUtf8() + "'").getStr(), + aExpectedValue, aValue); +} + void XmlTestTools::assertXPathDoubleValue(const xmlDocUniquePtr& pXmlDoc, const char* pXPath, const char* pAttribute, double expectedValue, double delta) { OUString aValue = getXPath(pXmlDoc, pXPath, pAttribute);
