[Libreoffice-commits] core.git: sw/qa

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sun Nov 17 02:18:39 UTC 2019


 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

New commits:
commit 8e7d89295c0b9e0515baab88d99c05ac293ac645
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Nov 16 22:57:18 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Nov 17 03:17:48 2019 +0100

    tdf#128820: improve unit test to not depend on opening bad file failing
    
    ... also test exported XML directly
    
    Change-Id: I50237593dd111e7c7974452769c8d49c22012713
    Reviewed-on: https://gerrit.libreoffice.org/83005
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 8178d249d399..c8c95d1cd132 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -146,6 +146,26 @@ DECLARE_OOXMLEXPORT_TEST(testTdf124367, "tdf124367.docx")
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128820, "tdf128820.fodt")
 {
     // Import of exported DOCX failed because of wrong namespase used for wsp element
+    // Now test the exported XML, in case we stop failing opening invalid files
+    xmlDocPtr pXml = parseExport("word/document.xml");
+    CPPUNIT_ASSERT(pXml);
+    // The parent wpg:wgp element has three children: wpg:cNvGrpSpPr, wpg:grpSpPr, and wpg:wsp
+    // (if we start legitimately exporting additional children, this needs to be adjusted to check
+    // all those, to make sure we don't export wrong elements).
+    assertXPathChildren(pXml,
+                        "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+                        "wp:inline/a:graphic/a:graphicData/wpg:wgp",
+                        3);
+    assertXPath(pXml,
+                "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/"
+                "a:graphic/a:graphicData/wpg:wgp/wpg:cNvGrpSpPr");
+    assertXPath(pXml,
+                "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/"
+                "a:graphic/a:graphicData/wpg:wgp/wpg:grpSpPr");
+    // This one was pic:wsp instead of wps:wsp
+    assertXPath(pXml,
+                "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/"
+                "a:graphic/a:graphicData/wpg:wgp/wps:wsp");
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list