From 29224bf7305ab8ba103be145effc8ac467ffcfd6 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 31 May 2023 17:54:00 +0200 Subject: SwModelTestBase: simplify code a bit and rename reload method to saveAndReload to unify code and use it everywhere Change-Id: I7c0f4e8d2feb7a0f9ca28df4b6dddd7a11b2e57e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152455 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/qa/core/draw/draw.cxx | 2 +- sw/qa/core/unocore/unocore.cxx | 4 ++-- sw/qa/extras/globalfilter/globalfilter.cxx | 36 ++++++++++++++--------------- sw/qa/extras/htmlexport/htmlexport.cxx | 10 ++++---- sw/qa/extras/layout/layout3.cxx | 2 +- sw/qa/extras/odfexport/odfexport2.cxx | 2 +- sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 2 +- sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 4 ++-- sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 12 +++++----- sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 2 +- sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 4 ++-- sw/qa/extras/ooxmlexport/ooxmlexport19.cxx | 4 ++-- sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 2 +- sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 6 ++--- sw/qa/extras/rtfexport/rtfexport2.cxx | 4 ++-- sw/qa/extras/rtfexport/rtfexport3.cxx | 12 +++++----- sw/qa/extras/rtfexport/rtfexport4.cxx | 6 ++--- sw/qa/extras/rtfexport/rtfexport6.cxx | 4 ++-- sw/qa/extras/rtfexport/rtfexport7.cxx | 2 +- sw/qa/extras/txtimport/txtimport.cxx | 3 +-- sw/qa/extras/uiwriter/uiwriter.cxx | 2 +- sw/qa/extras/uiwriter/uiwriter2.cxx | 10 ++++---- sw/qa/extras/uiwriter/uiwriter4.cxx | 6 ++--- sw/qa/extras/uiwriter/uiwriter5.cxx | 19 +++++++-------- sw/qa/extras/uiwriter/uiwriter6.cxx | 14 +++++------ sw/qa/extras/uiwriter/uiwriter7.cxx | 2 +- sw/qa/extras/uiwriter/uiwriter8.cxx | 6 ++--- sw/qa/extras/ww8export/ww8export.cxx | 4 ++-- sw/qa/extras/ww8export/ww8export2.cxx | 14 +++++------ sw/qa/extras/ww8export/ww8export3.cxx | 10 ++++---- sw/qa/extras/ww8export/ww8export4.cxx | 2 +- sw/qa/inc/swmodeltestbase.hxx | 12 +++------- sw/qa/unit/swmodeltestbase.cxx | 37 +++++++++++++++--------------- 33 files changed, 127 insertions(+), 134 deletions(-) diff --git a/sw/qa/core/draw/draw.cxx b/sw/qa/core/draw/draw.cxx index b77a4ea65d94..0cb50649a652 100644 --- a/sw/qa/core/draw/draw.cxx +++ b/sw/qa/core/draw/draw.cxx @@ -112,7 +112,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTdf107727FrameBorder) createSwDoc("tdf107727_FrameBorder.odt"); // Export to RTF and reload - reload("Rich Text Format", nullptr); + saveAndReload("Rich Text Format"); // Get frame without border and inspect it. uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index 342ca6c2eaab..55b37c749436 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -871,7 +871,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testParagraphMarkerODFExport) createSwDoc("paragraph-marker.docx"); // When saving that as ODT + reload: - reload("writer8", nullptr); + saveAndReload("writer8"); // Then make sure that it still has the correct color: xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -890,7 +890,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testParagraphMarkerFormattedRun) createSwDoc("paragraph-marker-formatted-run.docx"); // When saving that as ODT + reload: - reload("writer8", nullptr); + saveAndReload("writer8"); // Then make sure that the numbering portion is still non-bold, matching Word: xmlDocUniquePtr pXmlDoc = parseLayoutDump(); diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index f58f4f0b507e..37f112dc624f 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -110,7 +110,7 @@ void Test::testEmbeddedGraphicRoundtrip() createSwDoc("document_with_two_images.odt"); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check whether graphic exported well after it was swapped out const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -166,7 +166,7 @@ void Test::testLinkedGraphicRT() const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTextDoc); @@ -220,7 +220,7 @@ void Test::testImageWithSpecialID() createSwDoc("images_with_special_IDs.odt"); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check whether graphic exported well const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -303,7 +303,7 @@ void Test::testGraphicShape() createSwDoc("graphic_shape.odt"); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check whether graphic exported well const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -397,7 +397,7 @@ void Test::testMultipleIdenticalGraphics() createSwDoc("multiple_identical_graphics.odt"); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check whether graphic exported well const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -441,7 +441,7 @@ void Test::testCharHighlightBody() const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); const uno::Reference< text::XTextRange > xPara = getParagraph(1); // Both highlight and background @@ -524,7 +524,7 @@ void Test::testCharStyleHighlight() const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); uno::Reference xCharStyle; getStyles("CharacterStyles")->getByName("charBackground") >>= xCharStyle; @@ -588,7 +588,7 @@ void Test::testCharHighlightODF() } } - reload("writer8", nullptr); + saveAndReload("writer8"); xPara.set(getParagraph(1)); for (int i = 1; i <= 4; ++i) @@ -688,7 +688,7 @@ void Test::testMSCharBackgroundEditing() rOpt.SetCharBackground2Highlighting(); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check whether background was exported as highlighting xPara.set(getParagraph(1)); @@ -739,7 +739,7 @@ void Test::testCharBackgroundToHighlighting() rOpt.SetCharBackground2Highlighting(); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check highlight color const uno::Reference< text::XTextRange > xPara = getParagraph(1); @@ -920,7 +920,7 @@ void Test::testNestedFieldmark() verifyNestedFieldmark(rFilterName.first + ", load", mxComponent); // Export the document and import again - reload(rFilterName.first, nullptr); + saveAndReload(rFilterName.first); verifyNestedFieldmark(rFilterName.first + " exported-reload", mxComponent); } @@ -979,7 +979,7 @@ void Test::testODF13() officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - reload("writer8", nullptr); + saveAndReload("writer8"); // check XML xmlDocUniquePtr pContentXml = parseExport("content.xml"); @@ -1168,7 +1168,7 @@ void Test::testBulletAsImage() } // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); { uno::Reference xPara(getParagraph(1)); @@ -1773,7 +1773,7 @@ void Test::testTextFormField() const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check the document after round trip SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -1826,7 +1826,7 @@ void Test::testCheckBoxFormField() const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check the document after round trip SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -1879,7 +1879,7 @@ void Test::testDropDownFormField() const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check the document after round trip SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -1954,7 +1954,7 @@ void Test::testDateFormField() const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check the document after round trip if (rFilterName == "writer8") @@ -2138,7 +2138,7 @@ void Test::testDateFormFieldCharacterFormatting() const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check - reload(rFilterName, nullptr); + saveAndReload(rFilterName); // Check the document after round trip if (rFilterName == "writer8") diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index b492f133dc63..5713128b01b5 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -699,7 +699,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfOleData) createSwDoc("reqif-ole-data.xhtml"); verify(); setFilterOptions("xhtmlns=reqif-xhtml"); - reload(mpFilter, "reqif-ole-data.xhtml"); + saveAndReload("HTML (StarWriter)"); verify(); } @@ -755,7 +755,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfOleImg) createSwDoc("reqif-ole-img.xhtml"); verify(); setFilterOptions("xhtmlns=reqif-xhtml"); - reload(mpFilter, "reqif-ole-img.xhtml"); + saveAndReload("HTML (StarWriter)"); verify(); } @@ -982,7 +982,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfOle2) createSwDoc("reqif-ole2.xhtml"); verify(); setFilterOptions("xhtmlns=reqif-xhtml"); - reload(mpFilter, "reqif-ole2.xhtml"); + saveAndReload(mpFilter); verify(); } @@ -1945,7 +1945,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testShapeAsImageHtml) xDrawPageSupplier->getDrawPage()->add(xShape); // When exporting to plain HTML: - reload("HTML (StarWriter)", ""); + saveAndReload("HTML (StarWriter)"); // Without the accompanying fix in place, this test would have failed with: // - Expected: @@ -2359,7 +2359,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testClearingBreak) createSwWebDoc("clearing-break.html"); // Then make sure that the clear property of the break is not ignored: verify(); - reload(mpFilter, "clearing-break.html"); + saveAndReload("HTML (StarWriter)"); // Make sure that the clear property of the break is not ignored during export: verify(); } diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index b69de83b6ce2..9d4d53be5d39 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -63,7 +63,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf134463) CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf117188) { createSwDoc("tdf117188.docx"); - reload("writer8", "tdf117188.odt"); + saveAndReload("writer8"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); OUString sWidth = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "width"); OUString sHeight = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "height"); diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index f101dbd5a19f..ec88381e39fe 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -660,7 +660,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf57317_autoListName) // This was failing with a duplicate auto numbering style name of L1 instead of a unique name, // thus it was showing the same info as before the bullet modification. - reload(mpFilter, ""); + saveAndReload("writer8"); xPara.set(getParagraph(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara, "ListLabelString")); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 491626ff7812..f6c1b84fcec9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -107,7 +107,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121659_loseColumnBrNextToShape) // (messing also the shape position), and eliminated during the second import, // losing the 2-column text layout. As a workaround, split the paragraph // moving the column break into the fourth paragraph instead of losing it. - reload("Office Open XML Text", "tdf121659_loseColumnBrNextToShape.docx"); + saveAndReload("Office Open XML Text"); bool bBreakOnPara3 = getProperty(getParagraph(3), "BreakType") == style::BreakType_COLUMN_BEFORE; bool bBreakOnPara4 = getProperty(getParagraph(4), "BreakType") == style::BreakType_COLUMN_BEFORE; CPPUNIT_ASSERT(bBreakOnPara3 || bBreakOnPara4); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 8fea20074208..204ab670dd6a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -431,7 +431,7 @@ CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote) uno::UNO_QUERY); xTextContentAppend->appendTextContent(xFootnote, {}); - reload("Office Open XML Text", ""); + saveAndReload("Office Open XML Text"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Without the accompanying fix in place, this test would have failed with: @@ -459,7 +459,7 @@ CPPUNIT_TEST_FIXTURE(Test, testChicagoNumberingFootnote) uno::UNO_QUERY); xTextContentAppend->appendTextContent(xFootnote, {}); - reload("Office Open XML Text", ""); + saveAndReload("Office Open XML Text"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Without the accompanying fix in place, this test would have failed with: diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 6d501548ad25..502a8d9c6797 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -158,7 +158,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134219ContourWrap_glow_rotate) // Test fails on reload without fix with left: expected 1461 actual 2455; right: expected 1302 // actual 4177; top: expected 1522 actual 2457; bottom: expected 1296, actual 4179 verify(); - reload(mpFilter, "tdf143219ContourWrap_glow_rotate.docx"); + saveAndReload("Office Open XML Text"); verify(); } @@ -182,7 +182,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134219ContourWrap_stroke_shadow) // Test after reload would fail without fix with // left, top: expected 318 actual 635; right, bottom: expected 1164 actual 2434 verify(); - reload(mpFilter, "tdf143219ContourWrap_stroke_shadow.docx"); + saveAndReload("Office Open XML Text"); verify(); } @@ -655,7 +655,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTextframeHyperlink) // FIXME: After save&reload, the text frame should still be a text frame, and the above test should still work. // (Currently the Writer text frame becomes a text box (shape based)). See tdf#140961 - reload(mpFilter, "docxopenhyperlinkbox.docx"); + saveAndReload("Office Open XML Text"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // DML @@ -672,7 +672,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146171_invalid_change_date) // disable and check only the conversion of the invalid (zeroed) change date // 0000-00-00T00:00:00Z, resulting loss of change tracking during ODF roundtrip // reload("writer8", "tdf146171.odt"); - reload("Office Open XML Text", "tdf146171.docx"); + saveAndReload("Office Open XML Text"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // This was 0 @@ -728,7 +728,7 @@ CPPUNIT_TEST_FIXTURE(Test, testEffectExtentLineWidth) // - Actual : 561 // i.e. the upper spacing was too large, the last line of the text moved below the shape. verify(); - reload(mpFilter, "effect-extent-line-width.docx"); + saveAndReload("Office Open XML Text"); verify(); } @@ -741,7 +741,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRtlGutter) CPPUNIT_ASSERT(getProperty(xStandard, "RtlGutter")); // When saving back to DOCX: - reload(mpFilter, "rtl-gutter.docx"); + saveAndReload("Office Open XML Text"); // Then make sure the section's gutter is still RTL: xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 7088fc6ba0e8..8473d8c6eb6b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -1042,7 +1042,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148455_2, "tdf148455_2.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf147978enhancedPathABVW) { createSwDoc("tdf147978_enhancedPath_commandABVW.odt"); - reload("Office Open XML Text", nullptr); + saveAndReload("Office Open XML Text"); // Make sure the new implemented export for commands A,B,V and W use the correct arc between // the given two points, here the short one. for (sal_Int16 i = 1 ; i <= 4; ++i) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index c1682a130f80..0b66396d556e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -55,7 +55,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150197_predefinedNumbering) CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(getParagraph(1), "ListLabelString")); - reload("Office Open XML Text", ""); + saveAndReload("Office Open XML Text"); CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(getParagraph(1), "ListLabelString")); } @@ -516,7 +516,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf76022_textboxWrap) CPPUNIT_ASSERT_EQUAL_MESSAGE("Did you make wrapping sane/interoperable?", 1, getPages()); // When saving to DOCX, the table should obey the fly wrapping - reload("Office Open XML Text", ""); + saveAndReload("Office Open XML Text"); // The fly takes up the whole page, so the table needs to shift down to the next page. CPPUNIT_ASSERT_EQUAL(2, getPages()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx index 059d652d0a33..2a4e3ee83a4f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx @@ -275,7 +275,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf8255) }; createSwDoc("tdf8255.docx"); verify(); - reload(mpFilter, "tdf8255.docx"); + saveAndReload("Office Open XML Text"); verify(); } @@ -633,7 +633,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf99140) }; createSwDoc("tdf99140.docx"); verify(); - reload(mpFilter, "tdf99140.docx"); + saveAndReload("Office Open XML Text"); verify(); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 3e1bffa299e8..253c76c13818 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -752,7 +752,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN779642) }; createSwDoc("n779642.docx"); verify(); - reload(mpFilter, "n779642.docx"); + saveAndReload("Office Open XML Text"); verify(); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 0dbad12503bf..402c2ddcc04a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -136,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109063) }; createSwDoc("tdf109063.docx"); verify(); - reload(mpFilter, "tdf109063.docx"); + saveAndReload("Office Open XML Text"); verify(); } @@ -883,7 +883,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf79329) }; createSwDoc("tdf79329.docx"); verify(); - reload(mpFilter, "tdf79329.docx"); + saveAndReload("Office Open XML Text"); verify(); } @@ -1208,7 +1208,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf107889) }; createSwDoc("tdf107889.docx"); verify(); - reload(mpFilter, "tdf107889.docx"); + saveAndReload("Office Open XML Text"); verify(); } #endif diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index c96b90883232..1998262deca4 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -307,7 +307,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo48023) createSwDoc("fdo48023.rtf"); verify(); - reload(mpFilter, "fdo48023.rtf"); + saveAndReload("Rich Text Format"); verify(); } @@ -341,7 +341,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo44211) createSwDoc("fdo44211.rtf"); verify(); - reload(mpFilter, "fdo44211.rtf"); + saveAndReload("Rich Text Format"); verify(); } diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 8b5e2489a001..ba74645841e2 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -316,7 +316,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNestedHyperlink) // assertion failed // - Expression: xComponent.is() // i.e. the RTF output was not well-formed, loading failed. - reload(mpFilter, "nested-hyperlink.rtf"); + saveAndReload("Rich Text Format"); // Then make sure both hyperlinks are have the correct URLs. uno::Reference xParagraph = getParagraph(1); @@ -442,7 +442,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDontBreakWrappedTables) } // When saving to rtf: - reload(mpFilter, "dont-break-wrapped-tables.rtf"); + saveAndReload("Rich Text Format"); // Then make sure \nobrkwrptbl is not written: SwDoc* pDoc = getSwDoc(); @@ -466,7 +466,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRtlGutter) // Then make sure the section's gutter is still RTL: // Without the accompanying fix in place, this test would have failed as \rtlgutter was missing. verify(); - reload(mpFilter, "rtl-gutter.rtf"); + saveAndReload("Rich Text Format"); verify(); } @@ -498,7 +498,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorder) } // When saving that document to RTF: - reload(mpFilter, "negative-page-border.rtf"); + saveAndReload("Rich Text Format"); // Then make sure that the border distance is negative, so the first line of body text appears // on top of the page border: @@ -533,7 +533,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf127806) CPPUNIT_ASSERT_EQUAL(static_cast(600), aSize.Height); CPPUNIT_ASSERT_EQUAL(static_cast(635), aSize.Width); - reload(mpFilter, "tdf127806.rtf"); + saveAndReload("Rich Text Format"); CPPUNIT_ASSERT_EQUAL(1, getShapes()); // FIXME: We lost one shape on export, that's sucks xImage = getShape(1); @@ -611,7 +611,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableExport) xFrame->setPropertyValue("RightMargin", uno::Any(static_cast(71))); // When saving to RTF: - reload(mpFilter, "floating-table.rtf"); + saveAndReload("Rich Text Format"); // Then make sure the floating table is there & has the expected properties: uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 0213d0b893b7..56ff343487ef 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -572,7 +572,7 @@ DECLARE_RTFEXPORT_TEST(testTdf116358, "tdf116358.rtf") CPPUNIT_TEST_FIXTURE(Test, testGutterLeft) { createSwDoc("gutter-left.rtf"); - reload(mpFilter, "gutter-left.rtf"); + saveAndReload("Rich Text Format"); uno::Reference xPageStyle; getStyles("PageStyles")->getByName("Standard") >>= xPageStyle; sal_Int32 nGutterMargin{}; @@ -587,7 +587,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGutterLeft) CPPUNIT_TEST_FIXTURE(Test, testGutterTop) { createSwDoc("gutter-top.rtf"); - reload(mpFilter, "gutter-left.rtf"); + saveAndReload("Rich Text Format"); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xSettings( xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); @@ -625,7 +625,7 @@ CPPUNIT_TEST_FIXTURE(Test, testClearingBreak) createSwDoc("clearing-break.rtf"); // Then make sure that the clear property of the break is not ignored: verify(); - reload(mpFilter, "clearing-break.rtf"); + saveAndReload("Rich Text Format"); // Make sure that the clear property of the break is not ignored during export: verify(); } diff --git a/sw/qa/extras/rtfexport/rtfexport6.cxx b/sw/qa/extras/rtfexport/rtfexport6.cxx index ffe786097541..051ad343ec30 100644 --- a/sw/qa/extras/rtfexport/rtfexport6.cxx +++ b/sw/qa/extras/rtfexport/rtfexport6.cxx @@ -80,7 +80,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo72031) createSwDoc("fdo72031.rtf"); verify(); - reload(mpFilter, "fdo72031.rtf"); + saveAndReload("Rich Text Format"); verify(); } @@ -461,7 +461,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testChicagoNumberingFootnote) uno::UNO_QUERY); xTextContentAppend->appendTextContent(xFootnote, {}); - reload("Rich Text Format", ""); + saveAndReload("Rich Text Format"); xFootnotesSupplier.set(mxComponent, uno::UNO_QUERY); sal_uInt16 nExpected = style::NumberingType::SYMBOL_CHICAGO; auto nActual diff --git a/sw/qa/extras/rtfexport/rtfexport7.cxx b/sw/qa/extras/rtfexport/rtfexport7.cxx index ab1e63a22e65..11eaadee6a88 100644 --- a/sw/qa/extras/rtfexport/rtfexport7.cxx +++ b/sw/qa/extras/rtfexport/rtfexport7.cxx @@ -253,7 +253,7 @@ CPPUNIT_TEST_FIXTURE(Test, testHyperlinkWithoutURL) // Change the hyperlink, so its URL is empty. uno::Reference xRun(getRun(getParagraph(1), 2), uno::UNO_QUERY); xRun->setPropertyValue("HyperLinkURL", uno::Any(OUString())); - reload(mpFilter, "gutter-left.rtf"); + saveAndReload("Rich Text Format"); SvMemoryStream aMemoryStream; SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ); aStream.ReadStream(aMemoryStream); diff --git a/sw/qa/extras/txtimport/txtimport.cxx b/sw/qa/extras/txtimport/txtimport.cxx index 10a4e54d429c..99cb15b16ad2 100644 --- a/sw/qa/extras/txtimport/txtimport.cxx +++ b/sw/qa/extras/txtimport/txtimport.cxx @@ -212,8 +212,7 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf70423) OUString aResStr = s.makeStringAndClear(); pWrtShell->Insert(aResStr); - save("Text", "maTempFile"); //Saving the resulting file - reload(mpFilter, "Text"); //Reloading the file again + saveAndReload("Text"); //Reloading the file again // Without the fix, this test would have failed with: // - Expected: 1 diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index dbfbf3eb8535..5aa79b9577a9 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1280,7 +1280,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo85554) xDrawPage->add(xShape); // Save it and load it back. - reload("writer8", "fdo85554.odt"); + saveAndReload("writer8"); // This was 1, we lost a shape on export. CPPUNIT_ASSERT_EQUAL(2, getShapes()); diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 1833b1220dbd..a09d7b6fb780 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -75,7 +75,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground) getProperty(getParagraph(3), "ParaStyleName")); // Save it and load it back. - reload("writer8", "tdf47471_paraStyleBackgroundRT.odt"); + saveAndReload("writer8"); CPPUNIT_ASSERT_EQUAL(Color(0xdedce6), getProperty(getParagraph(2), "FillColor")); // on round-trip, the paragraph style name was lost @@ -124,7 +124,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat) "height", "260"); // save it to DOCX - reload("Office Open XML Text", "tdf117923.docx"); + saveAndReload("Office Open XML Text"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); pViewShell = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); @@ -2275,7 +2275,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_round_trip) createSwDoc("tdf76817.fodt"); // save it to DOCX - reload("Office Open XML Text", "tdf76817.docx"); + saveAndReload("Office Open XML Text"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); SwViewShell* pViewShell @@ -2582,7 +2582,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRTLparaStyle_LocaleArabic) createSwDoc(); // new, empty doc - everything defaults to RTL with Arabic locale // Save it and load it back. - reload("Office Open XML Text", "tdf116404_paraStyleFrameDir.docx"); + saveAndReload("Office Open XML Text"); uno::Reference xPageStyle( getStyles("ParagraphStyles")->getByName("Default Paragraph Style"), uno::UNO_QUERY_THROW); @@ -2695,7 +2695,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122942) const auto& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast(2), rFormats.size()); - reload("writer8", "tdf122942.odt"); + saveAndReload("writer8"); pDoc = getSwDoc(); const auto& rFormats2 = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast(2), rFormats2.size()); diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index b19f8a9d5a0a..d5acadd55569 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -611,7 +611,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96479) // Actually not needed, but the bug symptom of a missing bookmark // occurred because a broken bookmark was saved and loading silently // dropped the broken bookmark! - reload("writer8", "testTdf96479.odt"); + saveAndReload("writer8"); pDoc = getSwDoc(); // Lookup "replacement" bookmark @@ -1364,7 +1364,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf91292) xPropertySet->setPropertyValue("FillStyle", uno::Any(drawing::FillStyle_NONE)); // Save it and load it back. - reload("Office Open XML Text", "tdf91292_paraBackground.docx"); + saveAndReload("Office Open XML Text"); xPropertySet.set(getParagraph(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL_MESSAGE("No background color", drawing::FillStyle_NONE, @@ -2149,7 +2149,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testCreateDocxAnnotation) dispatchCommand(mxComponent, ".uno:InsertAnnotation", aPropertyValues); // Save it as DOCX & load it again - reload("Office Open XML Text", "create-docx-annotation.docx"); + saveAndReload("Office Open XML Text"); // get the annotation uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index 00cc35e13998..ec76c2589317 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -223,7 +223,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf140982) CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsum dolor sit amet..."), getParagraph(1)->getString()); // Save it and load it back. - reload("writer8", "tdf115815.odt"); + saveAndReload("writer8"); // Test comment range feature on tracked deletion. uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); @@ -966,7 +966,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDocxAttributeTableExport) xShape->setPropertyValue("HoriOrientRelation", uno::Any(static_cast(0))); } // save it to docx - reload("Office Open XML Text", "floating-table-position.docx"); + saveAndReload("Office Open XML Text"); uno::Reference xShape(getShape(1), uno::UNO_QUERY); @@ -2099,7 +2099,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletionWithExport) assertXPath(pXmlDoc, "//page[1]//body/tab"); // Save it and load it back. - reload("writer8", "tdf60382_tracked_table_deletion.odt"); + saveAndReload("writer8"); pDoc = getSwDoc(); // accept the deletion of the content of the first cell @@ -2155,7 +2155,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletionWithDOCXExport) // Save it to a DOCX and load it back. // Exporting change tracking of the row wasn't supported. // Also Manage Changes for the import. - reload("Office Open XML Text", "tdf79069_tracked_table_deletion.docx"); + saveAndReload("Office Open XML Text"); pDoc = getSwDoc(); // accept the deletion of the content of the first cell @@ -2589,7 +2589,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150673_RedlineTableColumnDeletionWi assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2); // Save it and load it back. - reload("writer8", "tdf150673_tracked_column_deletion.odt"); + saveAndReload("writer8"); pDoc = getSwDoc(); // accept the deletion of the content of the first cell @@ -2675,7 +2675,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableColumnDeletionWithDOCXExpo // Save it to a DOCX and load it back. // Exporting change tracking of the cell wasn't supported. // Also Manage Changes for the import. - reload("Office Open XML Text", "tdf79069_tracked_table_deletion.docx"); + saveAndReload("Office Open XML Text"); pDoc = getSwDoc(); // accept the deletion of the content of the first cell @@ -2685,6 +2685,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableColumnDeletionWithDOCXExpo // table column was deleted // (working export/import of HasTextChangesOnly of table cells) + discardDumpedLayout(); pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "//page[1]//body/tab"); assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 1); @@ -2752,7 +2753,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletionWithReject) assertXPath(pXmlDoc, "//page[1]//body/tab"); // Save it and load it back. - reload("writer8", "tdf60382_tracked_table_deletion.odt"); + saveAndReload("writer8"); pDoc = getSwDoc(); // reject the deletion of the content of the first cell @@ -2869,7 +2870,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145089_RedlineTableRowInsertionDOCX dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {}); // save it to DOCX - reload("Office Open XML Text", "tdf145089.docx"); + saveAndReload("Office Open XML Text"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); SwViewShell* pViewShell = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); @@ -3057,7 +3058,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145091) CPPUNIT_ASSERT(pEditShell->GetRedlineCount() > 0); // save it to DOCX - reload("Office Open XML Text", "tdf145091.docx"); + saveAndReload("Office Open XML Text"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); SwViewShell* pViewShell = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index eb770a05682f..3c7f616a5be3 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -658,7 +658,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113790) pWrtShell->Paste(aClipboard); // Save it as DOCX & load it again - reload("Office Open XML Text", "tdf113790.docx"); + saveAndReload("Office Open XML Text"); CPPUNIT_ASSERT(dynamic_cast(mxComponent.get())); } @@ -750,7 +750,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115013) pWrtShell->InsertField2(aField); } // Save it as DOCX & load it again - reload("Office Open XML Text", "mm-field.docx"); + saveAndReload("Office Open XML Text"); pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -2285,7 +2285,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testInsertPdf) dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs); // Save and load cycle - reload("writer8", "testInsertPdf.odt"); + saveAndReload("writer8"); uno::Reference xShape = getShape(1); // Assert that we have a replacement graphics @@ -2321,7 +2321,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf143760WrapContourToOff) CPPUNIT_ASSERT_EQUAL(false, getProperty(getShape(1), "SurroundContour")); // Without fix this had failed, because the shape was written to file with contour. - reload("Office Open XML Text", "tdf143760_ContourToWrapOff.docx"); + saveAndReload("Office Open XML Text"); CPPUNIT_ASSERT_EQUAL(false, getProperty(getShape(1), "SurroundContour")); } @@ -2345,7 +2345,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testHatchFill) xDrawPage->add(xShape); // Save it as DOCX and load it again. - reload("Office Open XML Text", "hatchFill.docx"); + saveAndReload("Office Open XML Text"); CPPUNIT_ASSERT_EQUAL(1, getShapes()); // tdf#127989 Without fix this had failed, because the background of the hatch was not set as 'no background'. @@ -2400,7 +2400,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testCrashOnExit) CPPUNIT_ASSERT_EQUAL(true, xProperties->getPropertyValue("TextBox").get()); // save and reload - reload("writer8", "tdf142715_.odt"); + saveAndReload("writer8"); // Before the fix this crashed here and could not reopen. CPPUNIT_ASSERT_MESSAGE("Crash on exit, isn't it?", mxComponent); @@ -2421,7 +2421,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testCaptionShape) xDrawPage->add(xShape); // Save it as DOCX and load it again. - reload("Office Open XML Text", "captionshape.docx"); + saveAndReload("Office Open XML Text"); // Without fix in place, the shape was lost on export. CPPUNIT_ASSERT_EQUAL(1, getShapes()); diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index 2fa255ddd86d..c3b70c8cad08 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -2129,7 +2129,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testEmbeddedDataSource) xConnection->close(); // Reload: should still have a component and a data source, too. - reload("writer8", "embedded-data-source.odt"); + saveAndReload("writer8"); CPPUNIT_ASSERT(mxComponent.is()); CPPUNIT_ASSERT(xDatabaseContext->hasByName("calc-data-source")); diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 610bdf9c8bf7..f56546ec10cc 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -589,7 +589,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf135014) dispatchCommand(mxComponent, ".uno:StyleNewByExample", aArgs2); // Without the fix in place, this test would have failed here - reload("Office Open XML Text", "tdf135014.docx"); + saveAndReload("Office Open XML Text"); xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='NewNumberingStyle']/w:qFormat", 1); @@ -2452,7 +2452,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf97899) getParagraph(3, "c"); // Save it as DOCX & load it again - reload("Office Open XML Text", "tdf97899-tmp.docx"); + saveAndReload("Office Open XML Text"); uno::Reference xNumberingRules = getProperty>(getParagraph(1), "NumberingRules"); CPPUNIT_ASSERT(xNumberingRules->getCount()); @@ -2607,7 +2607,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf73483) CPPUNIT_ASSERT_EQUAL(OUString("Right Page"), pWrtShell->GetCurPageStyle()); // Make sure that the page break with page style survives ODF save-and-reload - reload("writer8", "pageBreakWithPageStyle.odt"); + saveAndReload("writer8"); xmlDocUniquePtr pXml = parseExport("content.xml"); CPPUNIT_ASSERT(pXml); diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 03b7de1a5d51..616df9bb9189 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -749,7 +749,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf112346) }; createSwDoc("tdf112346.doc"); verify(); - reload(mpFilter, "tdf112346.doc"); + saveAndReload("MS Word 97"); verify(); } @@ -1515,7 +1515,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf94386) SfxRequest aRequest(FN_ENVELOP, SfxCallMode::SYNCHRON, aSet); SW_MOD()->ExecOther(aRequest); } - reload(mpFilter, "tdf94386.odt"); + saveAndReload("MS Word 97"); // check that the first and next page use different page styles uno::Reference xModel(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 8c652bb68c6f..51544b956abe 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -99,7 +99,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128700_relativeTableWidth) // This also resulted in a layout loop when flys were allowed to split in footers. createSwDoc("tdf128700_relativeTableWidth.doc"); verify(); - reload(mpFilter, "tdf128700_relativeTableWidth.doc"); + saveAndReload("MS Word 97"); verify(); } @@ -299,7 +299,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf80635_pageRightRTL) }; createSwDoc("tdf80635_pageRightRTL.doc"); verify(); - reload(mpFilter, "tdf80635_pageRightRTL.doc"); + saveAndReload("MS Word 97"); verify(); } @@ -312,7 +312,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf80635_marginRTL) }; createSwDoc("tdf80635_marginRightRTL.doc"); verify(); - reload(mpFilter, "tdf80635_marginRightRTL.doc"); + saveAndReload("MS Word 97"); verify(); } @@ -329,7 +329,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf80635_marginLeft) }; createSwDoc("tdf80635_marginLeft.doc"); verify(); - reload(mpFilter, "tdf80635_marginLeft.doc"); + saveAndReload("MS Word 97"); verify(); } @@ -344,7 +344,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf80635_pageLeft) }; createSwDoc("tdf80635_pageLeft.doc"); verify(); - reload(mpFilter, "tdf80635_pageLeft.doc"); + saveAndReload("MS Word 97"); verify(); } @@ -383,7 +383,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf107773) }; createSwDoc("tdf107773.doc"); verify(); - reload(mpFilter, "tdf107773.doc"); + saveAndReload("MS Word 97"); verify(); } @@ -1146,7 +1146,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlExport) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When saving that document to DOC and loading it back: - reload("MS Word 97", ""); + saveAndReload("MS Word 97"); // Then make sure the dummy character at the end is filtered out: OUString aBodyText = getBodyText(); diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 7cbc2e256943..3f80ff8dcc9d 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -191,7 +191,7 @@ DECLARE_WW8EXPORT_TEST(testGutterLeft, "gutter-left.doc") CPPUNIT_TEST_FIXTURE(Test, testGutterTop) { createSwDoc("gutter-top.doc"); - reload(mpFilter, "gutter-top.doc"); + saveAndReload("MS Word 97"); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xSettings( xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); @@ -251,7 +251,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testArabicZeroNumberingFootnote) uno::UNO_QUERY); xTextContentAppend->appendTextContent(xFootnote, {}); - reload("MS Word 97", ""); + saveAndReload("MS Word 97"); xFootnotesSupplier.set(mxComponent, uno::UNO_QUERY); sal_uInt16 nExpected = style::NumberingType::ARABIC_ZERO; auto nActual = getProperty(xFootnotesSupplier->getFootnoteSettings(), "NumberingType"); @@ -281,7 +281,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testChicagoNumberingFootnote) uno::UNO_QUERY); xTextContentAppend->appendTextContent(xFootnote, {}); - reload("MS Word 97", ""); + saveAndReload("MS Word 97"); xFootnotesSupplier.set(mxComponent, uno::UNO_QUERY); sal_uInt16 nExpected = style::NumberingType::SYMBOL_CHICAGO; auto nActual = getProperty(xFootnotesSupplier->getFootnoteSettings(), "NumberingType"); @@ -872,7 +872,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRtlGutter) // Then make sure the section's gutter is still RTL: // Without the accompanying fix in place, this test would have failed as the SPRM was missing. verify(); - reload(mpFilter, "rtl-gutter.doc"); + saveAndReload("MS Word 97"); verify(); } @@ -1096,7 +1096,7 @@ CPPUNIT_TEST_FIXTURE(Test, testClearingBreak) createSwDoc("clearing-break.doc"); // Then make sure that the clear property of the break is not ignored: verify(); - reload(mpFilter, "clearing-break.doc"); + saveAndReload("MS Word 97"); // Make sure that the clear property of the break is not ignored during export: verify(); } diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index 9b0f1f321b7b..7e3042aefab2 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -131,7 +131,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDontBreakWrappedTables) } // When saving to doc: - reload(mpFilter, "dont-break-wrapped-tables.doc"); + saveAndReload("MS Word 97"); // Then make sure the compat flag is serialized: SwDoc* pDoc = getSwDoc(); diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index b58c487c066d..097ffbacb7a0 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -261,12 +261,12 @@ protected: void header(); - void reload(const OUString& pFilter, const char* pName, const char* pPassword = nullptr); + void saveAndReload(const OUString& pFilter, const char* pPassword = nullptr); /// Combines load() and save(). void loadAndSave(const char* pName, const char* pPassword = nullptr); - /// Combines load() and reload(). + /// Combines load() and saveAndReload(). void loadAndReload(const char* pName); void finish(); @@ -327,13 +327,7 @@ protected: void emulateTyping(SwXTextDocument& rTextDoc, const std::u16string_view& rStr); private: - void loadURL(OUString const& rURL, const char* pName, const char* pPassword); - - void load(const char* pName, const char* pPassword = nullptr) - { - return loadURL(createFileURL(OUString::createFromAscii(pName)), pName, pPassword); - - } + void loadURL(OUString const& rURL, const char* pPassword = nullptr); }; /** diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index e4d701fdf7ca..da3a0c40d92e 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -67,7 +67,7 @@ void SwModelTestBase::executeImportTest(const char* filename, const char* pPassw maTempFile.EnableKillingFile(false); header(); std::unique_ptr const pChanges(preTest(filename)); - load(filename, pPassword); + loadURL(createFileURL(OUString::createFromAscii(filename)), pPassword); verify(); finish(); maTempFile.EnableKillingFile(); @@ -78,10 +78,10 @@ void SwModelTestBase::executeLoadVerifyReloadVerify(const char* filename, const maTempFile.EnableKillingFile(false); header(); std::unique_ptr const pChanges(preTest(filename)); - load(filename, pPassword); + loadURL(createFileURL(OUString::createFromAscii(filename)), pPassword); verify(); postLoad(filename); - reload(mpFilter, filename, pPassword); + saveAndReload(mpFilter, pPassword); verify(); finish(); maTempFile.EnableKillingFile(); @@ -92,9 +92,9 @@ void SwModelTestBase::executeLoadReloadVerify(const char* filename, const char* maTempFile.EnableKillingFile(false); header(); std::unique_ptr const pChanges(preTest(filename)); - load(filename, pPassword); + loadURL(createFileURL(OUString::createFromAscii(filename)), pPassword); postLoad(filename); - reload(mpFilter, filename, pPassword); + saveAndReload(mpFilter, pPassword); verify(); finish(); maTempFile.EnableKillingFile(); @@ -456,13 +456,12 @@ uno::Reference SwModelTestBase::getTextFrameByName(const OUStri void SwModelTestBase::header() {} -void SwModelTestBase::loadURL(OUString const& rURL, const char* pName, const char* pPassword) +void SwModelTestBase::loadURL(OUString const& rURL, const char* pPassword) { // Output name at load time, so in the case of a hang, the name of the hanging input file is visible. if (!isExported()) { - if (pName) - std::cout << pName << ":\n"; + std::cout << rURL << ":\n"; mnStartTime = osl_getGlobalTimer(); } @@ -474,25 +473,25 @@ void SwModelTestBase::loadURL(OUString const& rURL, const char* pName, const cha calcLayout(); } -void SwModelTestBase::reload(const OUString& pFilter, const char* pName, const char* pPassword) +void SwModelTestBase::saveAndReload(const OUString& pFilter, const char* pPassword) { save(pFilter, pPassword); mbExported = true; - loadURL(maTempFile.GetURL(), pName, pPassword); + loadURL(maTempFile.GetURL(), pPassword); } void SwModelTestBase::loadAndSave(const char* pName, const char* pPassword) { - load(pName, pPassword); + loadURL(createFileURL(OUString::createFromAscii(pName)), pPassword); save(mpFilter); mbExported = true; } void SwModelTestBase::loadAndReload(const char* pName) { - load(pName); - reload(mpFilter, pName); + loadURL(createFileURL(OUString::createFromAscii(pName))); + saveAndReload(mpFilter); } void SwModelTestBase::finish() @@ -529,9 +528,9 @@ xmlDocUniquePtr SwModelTestBase::parseExportedFile() void SwModelTestBase::createSwDoc(const char* pName, const char* pPassword) { if (!pName) - loadURL("private:factory/swriter", pName, nullptr); + loadURL("private:factory/swriter"); else - load(pName, pPassword); + loadURL(createFileURL(OUString::createFromAscii(pName)), pPassword); uno::Reference xServiceInfo(mxComponent, uno::UNO_QUERY_THROW); CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextDocument")); @@ -540,9 +539,9 @@ void SwModelTestBase::createSwDoc(const char* pName, const char* pPassword) void SwModelTestBase::createSwWebDoc(const char* pName) { if (!pName) - loadURL("private:factory/swriter/web", pName, nullptr); + loadURL("private:factory/swriter/web"); else - load(pName); + loadURL(createFileURL(OUString::createFromAscii(pName))); uno::Reference xServiceInfo(mxComponent, uno::UNO_QUERY_THROW); CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.WebDocument")); @@ -551,9 +550,9 @@ void SwModelTestBase::createSwWebDoc(const char* pName) void SwModelTestBase::createSwGlobalDoc(const char* pName) { if (!pName) - loadURL("private:factory/swriter/GlobalDocument", pName, nullptr); + loadURL("private:factory/swriter/GlobalDocument"); else - load(pName); + loadURL(createFileURL(OUString::createFromAscii(pName))); uno::Reference xServiceInfo(mxComponent, uno::UNO_QUERY_THROW); CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.GlobalDocument")); -- cgit