[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 2 commits - chart2/qa sc/qa sw/qa test/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 12 21:09:53 UTC 2019
chart2/qa/extras/chart2export.cxx | 7 +++++--
sc/qa/unit/subsequent_export-test.cxx | 4 ++--
sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 18 ++++++++++++------
sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 10 +++++++---
sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 3 ++-
sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 3 ++-
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 4 +++-
test/source/xmltesttools.cxx | 3 +++
8 files changed, 36 insertions(+), 16 deletions(-)
New commits:
commit 449c8180a8b92023d725b7fa990421595960cc0d
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Apr 11 23:35:13 2019 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Apr 12 23:09:14 2019 +0200
f315fee54eee57e6e55e5fcacf2522534682c2ce follow-up: fix tdf#109310 unit test
The test should guarantee presense of w:val attribute of w:rStyle element.
Turns out we must not use w: namespace before attribute name; likely it
is true when attribute namespace is the same as of its element.
Change-Id: I28e2936b51f039473326c6debf4b5559e2baf24c
Reviewed-on: https://gerrit.libreoffice.org/70612
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/70681
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index edc8e8ef14cd..a4fed8cb3d16 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -483,7 +483,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf109310_endnoteStyleForMSO, "tdf109310_endnoteSty
xmlDocPtr pXmlDoc = parseExport("word/endnotes.xml");
if (!pXmlDoc)
return;
-// assertXPath(pXmlDoc, "/w:endnotes/w:endnote[@w:id='2']/w:p/w:r[1]/w:rPr/w:rStyle", "w:val"); // what does it test?
+ // Check w:rStyle element has w:val attribute - note that w: is not specified for attribute
+ assertXPath(pXmlDoc, "/w:endnotes/w:endnote[@w:id='2']/w:p/w:r[1]/w:rPr/w:rStyle", "val",
+ "EndnoteCharacters");
}
DECLARE_OOXMLEXPORT_TEST(testTdf103389, "tdf103389.docx")
commit e90664da377faf37b668416a4da16bc7f04870e7
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Apr 10 15:18:07 2019 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Apr 12 23:09:04 2019 +0200
XmlTestTools::getXPath now asserts that non-empty attribute exists
It turns out that this change revealed unit tests written incorrectly
(and untested), or maybe which became broken (not testing) because of
some previous assertXPath change? They incorrectly used 3-arg form of
it to check node content equality to passed string, while in fact, an
attribute was looked for with that name, and its empty return tested
to match default empty 4th argument.
Change-Id: If24e18518543102d115a22a6282e4cca9cf694e2
Reviewed-on: https://gerrit.libreoffice.org/70581
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/70680
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index d08dd31a8e19..f7085229afb9 100755
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -533,7 +533,10 @@ void Chart2ExportTest::testStockChart()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:stockChart/c:ser[1]/c:idx", "val", "1");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:stockChart/c:ser[1]/c:order", "val", "1");
- assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:stockChart/c:ser[1]/c:tx/c:strRef/c:strCache/c:pt/c:v", "Open");
+ assertXPathContent(
+ pXmlDoc,
+ "/c:chartSpace/c:chart/c:plotArea/c:stockChart/c:ser[1]/c:tx/c:strRef/c:strCache/c:pt/c:v",
+ "Open");
}
void Chart2ExportTest::testBarChart()
@@ -689,7 +692,7 @@ void Chart2ExportTest::testDoughnutChart()
xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
CPPUNIT_ASSERT(pXmlDoc);
- assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart", "1");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart");
}
void Chart2ExportTest::testDisplayUnits()
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index f3532e7278b7..787f3e43f13d 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -705,10 +705,10 @@ void ScExportTest::testCommentExportXLSX()
xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml");
CPPUNIT_ASSERT(pSheet);
- assertXPath(pSheet, "/x:comments/x:authors/x:author[1]", "BAKO");
+ assertXPathContent(pSheet, "/x:comments/x:authors/x:author[1]", "BAKO");
assertXPath(pSheet, "/x:comments/x:authors/x:author", 1);
- assertXPath(pSheet, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "Komentarz");
+ assertXPathContent(pSheet, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "Komentarz");
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 3af85d04c4d8..178702a62e4e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -706,8 +706,10 @@ DECLARE_OOXMLEXPORT_TEST(testParaAutoSpacing, "para-auto-spacing.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "beforeAutospacing","1");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "afterAutospacing","1");
- assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "beforeAutospacing","");
- assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "afterAutospacing","");
+ assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing",
+ "beforeAutospacing");
+ assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing",
+ "afterAutospacing");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "before","400");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "after","400");
}
@@ -870,14 +872,18 @@ DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, "table-theme-preservation.d
// check cell theme colors have been preserved
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFill", "accent6");
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFillShade", "");
+ assertXPathNoAttribute(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd",
+ "themeFillShade");
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFillTint", "33");
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFill", "accent6");
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFillShade", "");
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFillTint", "");
+ assertXPathNoAttribute(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd",
+ "themeFillShade");
+ assertXPathNoAttribute(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd",
+ "themeFillTint");
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFill", "accent6");
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillShade", "80");
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillTint", "");
+ assertXPathNoAttribute(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd",
+ "themeFillTint");
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "val", "horzStripe");
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeColor", "accent3");
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeTint", "33");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index d7f548dcb4de..3c04b4e3c2e8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -402,7 +402,7 @@ DECLARE_OOXMLEXPORT_TEST(testIndentation, "test_indentation.docx")
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
- assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:ind", "end", "");
+ assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:ind", "end");
}
DECLARE_OOXMLEXPORT_TEST(testChartInFooter, "chart-in-footer.docx")
@@ -564,7 +564,8 @@ DECLARE_OOXMLEXPORT_TEST(testOleObject, "test_ole_object.docx")
if (!pXmlDoc)
return;
- assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object/v:shape/v:imagedata", "o:title", "");
+ assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object/v:shape/v:imagedata",
+ "o:title");
assertXPath(pXmlDoc,
"/w:document/w:body/w:p[2]/w:r/w:object/o:OLEObject",
"DrawAspect",
@@ -884,7 +885,10 @@ DECLARE_OOXMLEXPORT_TEST(testFileWithInvalidImageLink, "FileWithInvalidImageLink
if (!pXmlDoc)
return;
- assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/pic:pic[1]/pic:blipFill[1]/a:blip[1]", "embed", "");
+ assertXPathNoAttribute(pXmlDoc,
+ "/w:document/w:body/w:p[2]/w:r[2]/w:drawing[1]/wp:inline[1]/"
+ "a:graphic[1]/a:graphicData[1]/pic:pic[1]/pic:blipFill[1]/a:blip[1]",
+ "embed");
}
DECLARE_OOXMLEXPORT_TEST(testContentTypeDOCX, "fdo80410.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 77953b1e6e40..07a63938ffe3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -866,7 +866,8 @@ DECLARE_OOXMLEXPORT_TEST(testfdo83048, "fdo83048.docx")
// Make sure Date is inside SDT tag.
// This will happen only if right SDT properties are exported.
- assertXPath(pXmlDoc, "/w:ftr/w:sdt/w:sdtContent/w:p[1]/w:sdt/w:sdtContent/w:r[1]/w:t", "1/2/2013");
+ assertXPathContent(pXmlDoc, "/w:ftr/w:sdt/w:sdtContent/w:p[1]/w:sdt/w:sdtContent/w:r[1]/w:t",
+ "1/2/2013");
}
DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-run.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index dc82f0578093..155624839efd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -834,7 +834,8 @@ DECLARE_OOXMLEXPORT_TEST(testAlignForShape,"Shape.docx")
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
- assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:align","1");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/"
+ "wp:anchor/wp:positionH/wp:align");
}
DECLARE_OOXMLEXPORT_TEST(testLineStyle_DashType, "LineStyle_DashType.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index fb26d25a50cd..edc8e8ef14cd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -483,7 +483,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf109310_endnoteStyleForMSO, "tdf109310_endnoteSty
xmlDocPtr pXmlDoc = parseExport("word/endnotes.xml");
if (!pXmlDoc)
return;
- assertXPath(pXmlDoc, "/w:endnotes/w:endnote[@w:id='2']/w:p/w:r[1]/w:rPr/w:rStyle", "w:val");
+// assertXPath(pXmlDoc, "/w:endnotes/w:endnote[@w:id='2']/w:p/w:r[1]/w:rPr/w:rStyle", "w:val"); // what does it test?
}
DECLARE_OOXMLEXPORT_TEST(testTdf103389, "tdf103389.docx")
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 7a6f035fc986..26c54daa7fdb 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -73,6 +73,9 @@ OUString XmlTestTools::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const
return OUString();
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
xmlChar * prop = xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()));
+ OString sAttAbsent = "In <" + OString(pXmlDoc->name) + ">, XPath '" + rXPath
+ + "' no attribute '" + rAttribute + "' exist";
+ CPPUNIT_ASSERT_MESSAGE(sAttAbsent.getStr(), prop);
OUString s(convert(prop));
xmlFree(prop);
xmlXPathFreeObject(pXmlObj);
More information about the Libreoffice-commits
mailing list