diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-01-14 12:22:38 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-01-20 12:02:15 +0100 |
commit | 0b40218a052d65c6d0276bafe041edf44733b3db (patch) | |
tree | 762f1c47bd22217fc8b1f2b0e1d3c544664f0542 /sw | |
parent | 3d60ad8c67e347f56400e3be05a3f1641f77c719 (diff) |
sw tests: audit uses of loadAndSave()
When it comes to changing import + import-export-import tests to do only
import-export instead, this is only safe if we assert the resulting
exported XML.
Replace calls to loadAndSave() with loadAndReload() when we want to
assert the doc model after an export.
Thanks to Justin for flagging this, luckily it seems there is only a
single test that fails after restoring the lost asserts
(and that has already been fixed).
(cherry picked from commit 60c0242bbc05be0a5accc28f17a688124717590e)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
Change-Id: I62cd4330c62d801dd9e6c7ef73decab3972c0b58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128648
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 8 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 8 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 4 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 2 |
8 files changed, 15 insertions, 15 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 985b378912f0..633aa6ddb4eb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -401,7 +401,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133735) CPPUNIT_TEST_FIXTURE(Test, testTdf134569_nestedTable) { - loadAndSave("tdf134569_nestedTable.docx"); + loadAndReload("tdf134569_nestedTable.docx"); // non-overridden w:after spacing in the table was pushing the document to the second page. CPPUNIT_ASSERT_EQUAL(1, getPages()); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 5fae2dab136d..a0960ae35c7f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -1406,7 +1406,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf88496) CPPUNIT_TEST_FIXTURE(Test, testTdf77417) { - loadAndSave("tdf77417.docx"); + loadAndReload("tdf77417.docx"); // MSO 2010 compatibility mode: terminating white spaces are ignored in tables. // This was 3 pages with the first invisible blank page. CPPUNIT_ASSERT_EQUAL(2, getPages()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 23bebc3775ca..a8e416951a8c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -158,7 +158,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123622, "tdf123622.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf78749) { - loadAndSave("tdf78749.docx"); + loadAndReload("tdf78749.docx"); //Shape lost the background image before, now check if it still has... auto xShape = getShape(1); uno::Reference<beans::XPropertySet> xShpProps(xShape, uno::UNO_QUERY); @@ -974,7 +974,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf124367, "tdf124367.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf95189) { - loadAndSave("tdf95189.docx"); + loadAndReload("tdf95189.docx"); { uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty<OUString>(xPara, "ListLabelString")); @@ -1045,7 +1045,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128889) CPPUNIT_TEST_FIXTURE(Test, testTdf132754) { - loadAndSave("tdf132754.docx"); + loadAndReload("tdf132754.docx"); { uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("0.0.0."), getProperty<OUString>(xPara, "ListLabelString")); @@ -1370,7 +1370,7 @@ CPPUNIT_TEST_FIXTURE(Test, testLineWidthRounding) CPPUNIT_TEST_FIXTURE(Test, testTdf108505) { - loadAndSave("tdf108505.docx"); + loadAndReload("tdf108505.docx"); uno::Reference<text::XTextRange> xParagraph = getParagraph(3); uno::Reference<text::XTextRange> xText = getRun(xParagraph, 1, "Wrong font when alone on the line"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 90bec94421f1..e4527d6c7b96 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -770,7 +770,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135329_lostImage, "tdf135329_lostImage.odt") CPPUNIT_TEST_FIXTURE(Test, testTdf136441_commentInFootnote) { - loadAndSave("tdf136441_commentInFootnote.odt"); + loadAndReload("tdf136441_commentInFootnote.odt"); // failed to load without error if footnote contained a comment. // (MS Word's UI doesn't allow adding comments to a footnote.) } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index b67962568ba8..1e6938bcecc4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -416,7 +416,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGutterTop) CPPUNIT_TEST_FIXTURE(Test, testCustomShapePresetExport) { - loadAndSave("testCustomShapePresetExport.odt"); + loadAndReload("testCustomShapePresetExport.odt"); // Check if the load failed. CPPUNIT_ASSERT(getPages()); @@ -483,7 +483,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf125936_numberingSuperscript, "tdf125936_numberin CPPUNIT_TEST_FIXTURE(Test, testTdf134619_numberingProps) { - loadAndSave("tdf134619_numberingProps.doc"); + loadAndReload("tdf134619_numberingProps.doc"); // Get the third paragraph's numbering style's 1st level's bullet size uno::Reference<text::XTextRange> xParagraph = getParagraph(3); auto xLevels = getProperty< uno::Reference<container::XIndexAccess> >(xParagraph, "NumberingRules"); @@ -498,7 +498,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134619_numberingProps) CPPUNIT_TEST_FIXTURE(Test, testTdf134951_duplicates) { - loadAndSave("tdf134951_duplicates.odt"); + loadAndReload("tdf134951_duplicates.odt"); CPPUNIT_ASSERT_EQUAL(3, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<text::XEndnotesSupplier> xEndnotesSupplier(mxComponent, uno::UNO_QUERY); @@ -680,7 +680,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRtlGutter) CPPUNIT_TEST_FIXTURE(Test, testTdf140572_docDefault_superscript) { - loadAndSave("tdf140572_docDefault_superscript.docx"); + loadAndReload("tdf140572_docDefault_superscript.docx"); // A round-trip was crashing. // Without the fix, everything was DFLT_ESC_AUTO_SUPER (default superscript) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 436d481da9f2..e0b9db36e980 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1054,7 +1054,7 @@ CPPUNIT_TEST_FIXTURE(Test, testEmbeddedExcelChart) CPPUNIT_TEST_FIXTURE(Test, testTdf83227) { - loadAndSave("tdf83227.docx"); + loadAndReload("tdf83227.docx"); // Bug document contains a rotated image, which is handled as a draw shape (not as a Writer image) on export. 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"))); @@ -1064,7 +1064,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf83227) CPPUNIT_TEST_FIXTURE(Test, testTdf103001) { - loadAndSave("tdf103001.docx"); + loadAndReload("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. uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 9c9604cd9c8b..61372e9e803e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -78,7 +78,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDmlShapeRelsize) CPPUNIT_TEST_FIXTURE(Test, testDmlPictureInTextframe) { - loadAndSave("dml-picture-in-textframe.docx"); + loadAndReload("dml-picture-in-textframe.docx"); 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 4416edc4ef69..99d4b0112a60 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -141,7 +141,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf109063, "tdf109063.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf108269) { - loadAndSave("tdf108269.docm"); + loadAndReload("tdf108269.docm"); 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. |