summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-01-14 12:22:38 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-01-14 20:18:44 +0100
commit60c0242bbc05be0a5accc28f17a688124717590e (patch)
tree2ee321fa92f0f04de7f58a3370e91a43a5d2167f /sw
parente9da6bdabaf2e5b49c78e7ba54243f8f33622b15 (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). Change-Id: I62cd4330c62d801dd9e6c7ef73decab3972c0b58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128411 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport10.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx8
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport15.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport16.cxx8
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport17.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx4
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport6.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx2
9 files changed, 16 insertions, 16 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 857accd57f7d..c9551657acfd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -421,7 +421,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 e4e35971bc72..3626cb841dee 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 447f8d1db526..6aca6b02939e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -428,7 +428,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());
@@ -495,7 +495,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");
@@ -510,7 +510,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);
@@ -692,7 +692,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/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index ce7cf64c9eed..87c3b9b05f28 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -50,7 +50,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135164_cancelledNumbering, "tdf135164_cancelledN
CPPUNIT_TEST_FIXTURE(Test, testTdf135906)
{
- loadAndSave("tdf135906.docx");
+ loadAndReload("tdf135906.docx");
// just test round-tripping. The document was exported as corrupt and didn't re-load.
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 740c814430fc..bc4dc3ec75df 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1060,7 +1060,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")));
@@ -1070,7 +1070,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 89b3aded5f0e..0882c6d71007 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 2b1d603b2fb5..54b60d36dded 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -142,7 +142,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.