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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu May 27 10:46:41 UTC 2021


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx   |   35 +++++++++++++----------------
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx |    5 ----
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx |   14 +++--------
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |    4 ---
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx |    5 ----
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx  |   15 ++----------
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx  |    5 ----
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx  |    5 ----
 8 files changed, 28 insertions(+), 60 deletions(-)

New commits:
commit 1b82b81cd1f3377591068dea7b9a648b04370bbf
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu May 27 11:00:27 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu May 27 12:46:05 2021 +0200

    sw_ooxmlexport: just use exportonly here
    
    Change-Id: I37fe18528dbe821eb60c7b1d6c65039e2ae91b7c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116236
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index e77c741031b3..a9e21389009f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -243,26 +243,23 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testShapeInFloattable, "shape-in-floattable.
     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl", 1);
 }
 
-DECLARE_OOXMLEXPORT_TEST(testEmptyAnnotationMark, "empty-annotation-mark.docx")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testEmptyAnnotationMark, "empty-annotation-mark.docx")
 {
-    if (mbExported)
-    {
-        // Delete the word that is commented, and save again.
-        uno::Reference<text::XTextRange> xRun = getRun(getParagraph(1), 3);
-        CPPUNIT_ASSERT_EQUAL(OUString("with"), xRun->getString());
-        xRun->setString("");
-        uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-        xStorable->store();
-
-        // Then inspect the OOXML markup of the modified document model.
-        xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-        // There were two commentReference nodes.
-        assertXPath(pXmlDoc, "//w:commentReference", "id", "0");
-        // Empty comment range was not ignored on export, this was 1.
-        assertXPath(pXmlDoc, "//w:commentRangeStart", 0);
-        // Ditto.
-        assertXPath(pXmlDoc, "//w:commentRangeEnd", 0);
-    }
+    // Delete the word that is commented, and save again.
+    uno::Reference<text::XTextRange> xRun = getRun(getParagraph(1), 3);
+    CPPUNIT_ASSERT_EQUAL(OUString("with"), xRun->getString());
+    xRun->setString("");
+    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+    xStorable->store();
+
+    // Then inspect the OOXML markup of the modified document model.
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    // There were two commentReference nodes.
+    assertXPath(pXmlDoc, "//w:commentReference", "id", "0");
+    // Empty comment range was not ignored on export, this was 1.
+    assertXPath(pXmlDoc, "//w:commentRangeStart", 0);
+    // Ditto.
+    assertXPath(pXmlDoc, "//w:commentRangeEnd", 0);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testDropdownInCell, "dropdown-in-cell.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 9ff2a3db4e38..b2d81e45f9ae 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -136,11 +136,8 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER), nValue); // Paragraph properties are imported
 }
 
-DECLARE_OOXMLEXPORT_TEST(testFdo69548, "fdo69548.docx")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo69548, "fdo69548.docx")
 {
-    if (!mbExported)
-        return;
-
     // The problem was that the last space in target URL was removed
     CPPUNIT_ASSERT_EQUAL(OUString("#this_is_a_bookmark"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL"));
 }
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 3a8530733c76..f2718ad49c38 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -39,13 +39,11 @@ protected:
     }
 };
 
-DECLARE_OOXMLEXPORT_TEST(testTableCrossReference, "table_cross_reference.odt")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableCrossReference, "table_cross_reference.odt")
 {
     CPPUNIT_ASSERT_EQUAL(1, getPages());
     // tdf#42346: Cross references to tables were not saved
     // MSO uses simple bookmarks for referencing table caption, so we do the same by export
-    if (!mbExported)
-        return;
 
     // Check whether we have all the necessary bookmarks exported and imported back
     uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
@@ -212,14 +210,12 @@ DECLARE_OOXMLEXPORT_TEST(testTableCrossReference, "table_cross_reference.odt")
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(8), nIndex);
 }
 
-DECLARE_OOXMLEXPORT_TEST(testTableCrossReferenceCustomFormat,
-                         "table_cross_reference_custom_format.odt")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableCrossReferenceCustomFormat,
+                                    "table_cross_reference_custom_format.odt")
 {
     CPPUNIT_ASSERT_EQUAL(1, getPages());
     // tdf#42346: Cross references to tables were not saved
     // Check also captions with custom formatting
-    if (!mbExported)
-        return;
 
     // Check whether we have all the necessary bookmarks exported and imported back
     uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
@@ -347,14 +343,12 @@ DECLARE_OOXMLEXPORT_TEST(testTableCrossReferenceCustomFormat,
     }
 }
 
-DECLARE_OOXMLEXPORT_TEST(testObjectCrossReference, "object_cross_reference.odt")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testObjectCrossReference, "object_cross_reference.odt")
 {
     CPPUNIT_ASSERT_EQUAL(10, getShapes());
     CPPUNIT_ASSERT_EQUAL(2, getPages());
     // tdf#42346: Cross references to objects were not saved
     // MSO uses simple bookmarks for referencing table caption, so we do the same by export
-    if (!mbExported)
-        return;
 
     // Check whether we have all the necessary bookmarks exported and imported back
     uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 40bcaaa5875b..0c7c1984f421 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -526,13 +526,11 @@ DECLARE_OOXMLEXPORT_TEST(tdf124600b, "tdf124600b.docx")
     CPPUNIT_ASSERT(!bAllowOverlap2);
 }
 
-DECLARE_OOXMLEXPORT_TEST(testDateControl, "empty-date-control.odt")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDateControl, "empty-date-control.odt")
 {
     CPPUNIT_ASSERT_EQUAL(1, getPages());
     // Check that we exported the empty date control correctly
     // Date form field is converted to date content control.
-    if (!mbExported)
-        return ;
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 165f104c2f57..2b20c8aabc35 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -118,11 +118,8 @@ DECLARE_OOXMLEXPORT_TEST(testGutterLeft, "gutter-left.docx")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nGutterMargin);
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testGutterTop)
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGutterTop, "gutter-top.docx")
 {
-    load(mpTestDocumentPath, "gutter-top.docx");
-    save("Office Open XML Text", maTempFile);
-    mbExported = true;
     xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml");
     CPPUNIT_ASSERT(pXmlSettings);
     // Without the accompanying fix in place, this test would have failed with:
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 3dfd1af1a302..da74296687fd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -194,11 +194,8 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesParagraphProperties, "testTr
     assertXPathChildren(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pPrChange", 0);
 }
 
-DECLARE_OOXMLEXPORT_TEST(testMsoSpt180, "mso-spt180.docx")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testMsoSpt180, "mso-spt180.docx")
 {
-    if (!mbExported)
-        return;
-
     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     const uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xGroup->getByIndex(0), "CustomShapeGeometry");
     OUString aType;
@@ -1012,25 +1009,19 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testEmbeddedExcelChart, "EmbeddedExcelChart.
         "Excel.Chart.8");
 }
 
-DECLARE_OOXMLEXPORT_TEST(testTdf83227, "tdf83227.docx")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf83227, "tdf83227.docx")
 {
     // Bug document contains a rotated image, which is handled as a draw shape (not as a Writer image) on export.
-    if (!mbExported)
-        return;
-
     uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
     CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName("word/media/image1.png")));
     // This was also true, image was written twice.
     CPPUNIT_ASSERT_EQUAL(false, bool(xNameAccess->hasByName("word/media/image2.png")));
 }
 
-DECLARE_OOXMLEXPORT_TEST(testTdf103001, "tdf103001.docx")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf103001, "tdf103001.docx")
 {
     // The same image is featured in the header and in the body text, make sure
     // the header relation is still written, even when caching is enabled.
-    if (!mbExported)
-        return;
-
     uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
     // This failed: header reused the RelId of the body text, even if RelIds
     // are local to their stream.
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 1a3444ca923c..b07cd328e342 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -73,11 +73,8 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDmlShapeRelsize, "dml-shape-relsize.docx
     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "margin");
 }
 
-DECLARE_OOXMLEXPORT_TEST(testDmlPictureInTextframe, "dml-picture-in-textframe.docx")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDmlPictureInTextframe, "dml-picture-in-textframe.docx")
 {
-    if (!mbExported)
-        return;
-
     uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
     CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName("word/media/image1.gif")));
     // This was also true, image was written twice.
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 33edc6f9ed85..6f784e6174c1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -137,11 +137,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf109063, "tdf109063.docx")
     CPPUNIT_ASSERT_EQUAL(0, getShapes());
 }
 
-DECLARE_SW_ROUNDTRIP_TEST(testTdf108269, "tdf108269.docm", nullptr, DocmTest)
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf108269, "tdf108269.docm")
 {
-    if (!mbExported)
-        return;
-
     uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
     // This failed: VBA streams were not roundtripped via the doc-level
     // grab-bag.


More information about the Libreoffice-commits mailing list