sw/qa/extras/odfexport/odfexport.cxx | 54 ++++-- sw/qa/extras/odfexport/odfexport2.cxx | 69 +++++--- sw/qa/extras/odfexport/odfexport3.cxx | 36 ++-- sw/qa/extras/odfexport/odfexport4.cxx | 90 +++++++---- sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 18 +- sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 6 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 24 +- sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 30 ++- sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 30 ++- sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 21 +- sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 69 +++++--- sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 54 ++++-- sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 12 - sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 30 ++- sw/qa/extras/ooxmlexport/ooxmlexport19.cxx | 21 +- sw/qa/extras/ooxmlexport/ooxmlexport2.cxx | 48 +++-- sw/qa/extras/ooxmlexport/ooxmlexport20.cxx | 45 +++-- sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 3 sw/qa/extras/ooxmlexport/ooxmlexport23.cxx | 36 ++-- sw/qa/extras/ooxmlexport/ooxmlexport24.cxx | 18 +- sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 21 +- sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 21 +- sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 27 ++- sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 18 +- sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 3 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 6 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 12 - sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx | 3 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 180 ++++++++++++++-------- sw/qa/extras/ooxmlexport/ooxmlw14export.cxx | 30 ++- sw/qa/extras/rtfexport/rtfexport.cxx | 66 +++++--- sw/qa/extras/rtfexport/rtfexport6.cxx | 15 + sw/qa/extras/rtfexport/rtfexport7.cxx | 21 +- sw/qa/extras/rtfexport/rtfexport8.cxx | 3 sw/qa/extras/ww8export/ww8export.cxx | 54 ++++-- sw/qa/extras/ww8export/ww8export2.cxx | 45 +++-- sw/qa/extras/ww8export/ww8export3.cxx | 60 ++++--- sw/qa/extras/ww8export/ww8export4.cxx | 3 sw/qa/inc/swmodeltestbase.hxx | 3 sw/qa/unit/swmodeltestbase.cxx | 6 40 files changed, 868 insertions(+), 443 deletions(-)
New commits: commit 56b3a36b87c0acbc4be4af70372fa85598f7fc00 Author: Xisco Fauli <[email protected]> AuthorDate: Mon Nov 17 16:51:03 2025 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Nov 18 08:50:23 2025 +0100 SwModelTestBase: drop loadAndReload in preparation for a follow-up commit Change-Id: Ie54874d02c35d543b35f195358c6d6ecb85e3627 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194111 Reviewed-by: Xisco Fauli <[email protected]> Tested-by: Jenkins diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index cca5ad70ec7e..eb070f6cce9d 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -79,7 +79,8 @@ CPPUNIT_TEST_FIXTURE(Test, testMathObjectFlatExport) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Cache::Writer::OLE_Objects::set(1, pBatch); pBatch->commit(); - loadAndReload("2_MathType3.docx"); + createSwDoc("2_MathType3.docx"); + saveAndReload(mpFilter); uno::Reference<util::XModifiable> xModifiable(mxComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(!xModifiable->isModified()); @@ -194,7 +195,8 @@ void testTdf43569_CheckIfFieldParse() // instead of insertion of the pair of two field-marks: <field:fieldmark-start> + <field:fieldmark-end>. CPPUNIT_TEST_FIXTURE(Test, testTdf43569) { - loadAndReload("tdf43569_conditionalfield.doc"); + createSwDoc("tdf43569_conditionalfield.doc"); + saveAndReload(mpFilter); // check if our parser is valid testTdf43569_CheckIfFieldParse(); @@ -209,14 +211,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf43569) CPPUNIT_TEST_FIXTURE(Test, testTdf130314) { - loadAndReload("tdf130314.docx"); + createSwDoc("tdf130314.docx"); + saveAndReload(mpFilter); // Without the fix in place, this test would have hung CPPUNIT_ASSERT_EQUAL(2, getPages()); } CPPUNIT_TEST_FIXTURE(Test, testTdf133487) { - loadAndReload("MadeByLO7.odt"); + createSwDoc("MadeByLO7.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(3, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); @@ -233,7 +237,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133487) CPPUNIT_TEST_FIXTURE(Test, testTdf141467) { - loadAndReload("Formcontrol needs high z-index.odt"); + createSwDoc("Formcontrol needs high z-index.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); @@ -265,7 +270,8 @@ DECLARE_ODFEXPORT_TEST(testTdf139126, "tdf139126.odt") CPPUNIT_TEST_FIXTURE(Test, testTdf125877) { - loadAndReload("tdf95806.docx"); + createSwDoc("tdf95806.docx"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<text::XTextTablesSupplier> xSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xSupplier->getTextTables(), uno::UNO_QUERY); @@ -282,7 +288,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf125877) CPPUNIT_TEST_FIXTURE(Test, testTdf150149) { - loadAndReload("tdf150149.fodt"); + createSwDoc("tdf150149.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // This was 0 (lost table header in multi-column section) @@ -329,7 +336,8 @@ DECLARE_ODFEXPORT_TEST(testTdf103567, "tdf103567.odt") CPPUNIT_TEST_FIXTURE(Test, testUserFieldDecl) { - loadAndReload("user-field-decl.odt"); + createSwDoc("user-field-decl.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); // Without the accompanying fix in place, this test would have failed with 'Expected: 2; @@ -340,7 +348,8 @@ CPPUNIT_TEST_FIXTURE(Test, testUserFieldDecl) CPPUNIT_TEST_FIXTURE(Test, testUserFieldDeclFly) { - loadAndReload("user-field-decl-fly.odt"); + createSwDoc("user-field-decl-fly.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); @@ -513,7 +522,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSHA1Wrong) CPPUNIT_TEST_FIXTURE(Test, testOOoxmlEmbedded) { - loadAndReload("oooxml_embedded.sxw"); + createSwDoc("oooxml_embedded.sxw"); + saveAndReload(mpFilter); uno::Reference<text::XTextEmbeddedObjectsSupplier> xTEOSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XNameAccess> xAccess(xTEOSupplier->getEmbeddedObjects()); uno::Sequence<OUString> aSeq(xAccess->getElementNames()); @@ -587,7 +597,8 @@ DECLARE_ODFEXPORT_TEST(testTdf140437, "tdf140437.odt") CPPUNIT_TEST_FIXTURE(Test, testTdf131621) { - loadAndReload("tdf131621.ott"); + createSwDoc("tdf131621.ott"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(12, getShapes()); //Crash test, Check number of pages CPPUNIT_ASSERT_EQUAL( 1, getPages() ); @@ -595,7 +606,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf131621) CPPUNIT_TEST_FIXTURE(Test, testTdf135144) { - loadAndReload("tdf135144.docx"); + createSwDoc("tdf135144.docx"); + saveAndReload(mpFilter); //Crashes at import time after roundtrip CPPUNIT_ASSERT_EQUAL(3, getPages()); CPPUNIT_ASSERT_EQUAL(4, getShapes()); @@ -637,7 +649,8 @@ DECLARE_ODFEXPORT_TEST(testFdo38244, "fdo38244.odt") CPPUNIT_TEST_FIXTURE(Test, testSenderInitials) { - loadAndReload("sender-initials.fodt"); + createSwDoc("sender-initials.fodt"); + saveAndReload(mpFilter); // Test sender-initial properties (both annotation metadata and text field) uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); @@ -809,7 +822,8 @@ DECLARE_ODFEXPORT_TEST(testTextframeGradient, "textframe-gradient.odt") CPPUNIT_TEST_FIXTURE(Test, testDuplicateCrossRefHeadingBookmark) { - loadAndReload("CrossRefHeadingBookmark.fodt"); + createSwDoc("CrossRefHeadingBookmark.fodt"); + saveAndReload(mpFilter); // the file contains invalid duplicate heading cross reference bookmarks // but we have to round trip them, tdf#94804 @@ -914,7 +928,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo58949) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Filter::Microsoft::Import::MathTypeToMath::set(false, pBatch); pBatch->commit(); - loadAndReload("fdo58949.docx"); + createSwDoc("fdo58949.docx"); + saveAndReload(mpFilter); /* * The problem was that the exporter didn't insert "Obj102" to the @@ -949,7 +964,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo58949) CPPUNIT_TEST_FIXTURE(Test, testTdf134987) { - loadAndReload("tdf134987.docx"); + createSwDoc("tdf134987.docx"); + saveAndReload(mpFilter); uno::Reference<text::XTextEmbeddedObjectsSupplier> xTEOSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XNameAccess> xAccess(xTEOSupplier->getEmbeddedObjects()); uno::Sequence<OUString> aSeq(xAccess->getElementNames()); @@ -1223,7 +1239,8 @@ CPPUNIT_TEST_FIXTURE(Test, testProtectionKey) CPPUNIT_TEST_FIXTURE(Test, testTdf128188) { - loadAndReload("footnote-collect-at-end-of-section.fodt"); + createSwDoc("footnote-collect-at-end-of-section.fodt"); + saveAndReload(mpFilter); SwDoc* pDoc = getSwDoc(); SwFootnoteIdxs const& rFootnotes(pDoc->GetFootnoteIdxs()); // Section1 @@ -1256,7 +1273,8 @@ DECLARE_ODFEXPORT_TEST(testFdo43807, "fdo43807.odt") CPPUNIT_TEST_FIXTURE(Test, testTdf103091) { - loadAndReload("tdf103091.fodt"); + createSwDoc("tdf103091.fodt"); + saveAndReload(mpFilter); // check that all conditional paragraph style conditions are imported uno::Reference<container::XNameAccess> xParaStyles(getStyles(u"ParagraphStyles"_ustr)); uno::Reference<beans::XPropertySet> xStyle1(xParaStyles->getByName( diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 7c9de9b2f41e..8d09dc96b867 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -81,7 +81,8 @@ DECLARE_ODFEXPORT_TEST(testTdf77961, "tdf77961.odt") CPPUNIT_TEST_FIXTURE(Test, testTdf106733) { - loadAndReload("tdf106733.fodt"); + createSwDoc("tdf106733.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); @@ -110,7 +111,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_page) return; // fo:hyphenation-keep="page" defined in direct paragraph formatting - loadAndReload("tdf132599_page.fodt"); + createSwDoc("tdf132599_page.fodt"); + saveAndReload(mpFilter); // This was 2 (not truncated hyphenated line) CPPUNIT_ASSERT_EQUAL(3, getPages()); } @@ -122,7 +124,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_auto) return; // fo:hyphenation-keep="auto" defined in direct paragraph formatting - loadAndReload("tdf132599_auto.fodt"); + createSwDoc("tdf132599_auto.fodt"); + saveAndReload(mpFilter); // not truncated hyphenated line CPPUNIT_ASSERT_EQUAL(2, getPages()); } @@ -134,7 +137,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_spread) return; // fo:hyphenation-keep="page" loext:hyphenation-keep-type="spread" - loadAndReload("tdf132599_spread.fodt"); + createSwDoc("tdf132599_spread.fodt"); + saveAndReload(mpFilter); // shift last line of right page, resulting 3 pages CPPUNIT_ASSERT_EQUAL(3, getPages()); } @@ -146,7 +150,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_spread_left_page) return; // fo:hyphenation-keep="page" loext:hyphenation-keep-type="spread" - loadAndReload("tdf132599_spread-left-page.fodt"); + createSwDoc("tdf132599_spread-left-page.fodt"); + saveAndReload(mpFilter); // do not shift last line of left page // This was 4 (shifted last line of left page, when it's hyphenated) CPPUNIT_ASSERT_EQUAL(3, getPages()); @@ -160,7 +165,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_column) // last line of the left column is shifted, according to // fo:hyphenation-keep="page" loext:hyphenation-keep-type="column" - loadAndReload("tdf132599_column.fodt"); + createSwDoc("tdf132599_column.fodt"); + saveAndReload(mpFilter); // shift last line of the first column, resulting 3 pages CPPUNIT_ASSERT_EQUAL(3, getPages()); } @@ -173,7 +179,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_page_in_not_last_column) // last line of the not last column is not shifted, according to // fo:hyphenation-keep="page" loext:hyphenation-keep-type="page" - loadAndReload("tdf132599_page_in_not_last_column.fodt"); + createSwDoc("tdf132599_page_in_not_last_column.fodt"); + saveAndReload(mpFilter); // do not shift last line of the first column, resulting 2 pages CPPUNIT_ASSERT_EQUAL(2, getPages()); } @@ -186,7 +193,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_page_in_last_column) // last line of the last column is shifted, according to // fo:hyphenation-keep="page" loext:hyphenation-keep-type="page" - loadAndReload("tdf132599_page_in_last_column.fodt"); + createSwDoc("tdf132599_page_in_last_column.fodt"); + saveAndReload(mpFilter); // shift last line of the first page, resulting 3 pages CPPUNIT_ASSERT_EQUAL(3, getPages()); } @@ -199,7 +207,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_always) // last full line of the paragraph column is not hyphenated // fo:hyphenation-keep="page" loext:hyphenation-keep-type="always" - loadAndReload("tdf132599_always.fodt"); + createSwDoc("tdf132599_always.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); @@ -214,7 +223,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_page_in_table) // last full line of the table is not hyphenated on page 1 // fo:hyphenation-keep="page" loext:hyphenation-keep-type="" - loadAndReload("tdf132599_page_in_table.fodt"); + createSwDoc("tdf132599_page_in_table.fodt"); + saveAndReload(mpFilter); // This was 2 (not handling hyphenation-keep in tables) CPPUNIT_ASSERT_EQUAL(3, getPages()); @@ -229,7 +239,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_page_in_default_paragraph_style) return; // fo:hyphenation-keep="page" defined in default paragraph style - loadAndReload("tdf160518_page_in_default_paragraph_style.fodt"); + createSwDoc("tdf160518_page_in_default_paragraph_style.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(3, getPages()); } @@ -240,7 +251,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_auto_in_default_paragraph_style) return; // fo:hyphenation-keep="auto" defined in default paragraph style - loadAndReload("tdf160518_auto_in_default_paragraph_style.fodt"); + createSwDoc("tdf160518_auto_in_default_paragraph_style.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getPages()); } @@ -251,7 +263,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_page_in_text_body_style) return; // fo:hyphenation-keep="page" defined in text body style - loadAndReload("tdf160518_page_in_text_body_style.fodt"); + createSwDoc("tdf160518_page_in_text_body_style.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(3, getPages()); } @@ -262,7 +275,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_auto_in_text_body_style) return; // fo:hyphenation-keep="auto" defined in text body style - loadAndReload("tdf160518_auto_in_text_body_style.fodt"); + createSwDoc("tdf160518_auto_in_text_body_style.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getPages()); } @@ -273,7 +287,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf165354_page) return; // fo:hyphenation-keep="page" defined in direct paragraph formatting - loadAndReload("tdf165354_page.fodt"); + createSwDoc("tdf165354_page.fodt"); + saveAndReload(mpFilter); // This was 3 in tdf132599, but now 2, shifting only the last hyphenated word, // not the full line, because of loext:hyphenation-keep-line=true CPPUNIT_ASSERT_EQUAL(2, getPages()); @@ -281,7 +296,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf165354_page) CPPUNIT_TEST_FIXTURE(Test, testTdf158885_compound_remain) { - loadAndReload("tdf158885_compound-remain.fodt"); + createSwDoc("tdf158885_compound-remain.fodt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); assertXPath(pXmlDoc, "//style:style[@style:family='paragraph']/style:text-properties[@loext:hyphenation-compound-remain-char-count='3']", 1); @@ -323,7 +339,8 @@ DECLARE_ODFEXPORT_TEST(testReferenceLanguage, "referencelanguage.odt") CPPUNIT_TEST_FIXTURE(Test, testRubyPosition) { - loadAndReload("ruby-position.odt"); + createSwDoc("ruby-position.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); @@ -346,7 +363,8 @@ DECLARE_ODFEXPORT_TEST(testAllowOverlap, "allow-overlap.odt") CPPUNIT_TEST_FIXTURE(Test, testSignatureLineProperties) { - loadAndReload("signatureline-properties.fodt"); + createSwDoc("signatureline-properties.fodt"); + saveAndReload(mpFilter); uno::Reference<drawing::XShape> xShape = getShape(1); CPPUNIT_ASSERT(xShape.is()); @@ -519,7 +537,8 @@ DECLARE_ODFEXPORT_TEST(tdf118502, "tdf118502.odt") CPPUNIT_TEST_FIXTURE(Test, tdf99631) { - loadAndReload("tdf99631.docx"); + createSwDoc("tdf99631.docx"); + saveAndReload(mpFilter); // check import of VisualArea settings of the embedded XLSX OLE objects xmlDocUniquePtr pXmlDoc = parseExport(u"Object 1/settings.xml"_ustr); assertXPathContent(pXmlDoc, "//config:config-item[@config:name='VisibleAreaWidth']", u"4516"); @@ -533,7 +552,8 @@ CPPUNIT_TEST_FIXTURE(Test, tdf99631) CPPUNIT_TEST_FIXTURE(Test, tdf163575) { // crashes/assert at export time - loadAndReload("tdf163575.docx"); + createSwDoc("tdf163575.docx"); + saveAndReload(mpFilter); } DECLARE_ODFEXPORT_TEST(testTdf159923, "tdf159923.fodt") @@ -550,7 +570,8 @@ DECLARE_ODFEXPORT_TEST(testTdf159923_stretched, "tdf159923_stretched.fodt") CPPUNIT_TEST_FIXTURE(Test, tdf145871) { - loadAndReload("tdf145871.odt"); + createSwDoc("tdf145871.odt"); + saveAndReload(mpFilter); uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); @@ -564,7 +585,8 @@ CPPUNIT_TEST_FIXTURE(Test, tdf145871) CPPUNIT_TEST_FIXTURE(Test, tdf128504) { - loadAndReload("tdf128504.docx"); + createSwDoc("tdf128504.docx"); + saveAndReload(mpFilter); uno::Reference<text::XTextRange> xPara = getParagraph(6); uno::Reference<beans::XPropertySet> xRun(getRun(xPara,1), uno::UNO_QUERY); OUString unVisitedStyleName = getProperty<OUString>(xRun, u"UnvisitedCharStyleName"_ustr); @@ -705,7 +727,8 @@ DECLARE_ODFEXPORT_TEST(testPageContentBottom, "page-content-bottom.odt") CPPUNIT_TEST_FIXTURE(Test, tdf124470) { - loadAndReload("tdf124470TableAndEmbeddedUsedFonts.odt"); + createSwDoc("tdf124470TableAndEmbeddedUsedFonts.odt"); + saveAndReload(mpFilter); // Table styles were exported out of place, inside font-face-decls. // Without the fix in place, this will fail already in ODF validation: // "content.xml[2,2150]: Error: tag name "style:style" is not allowed. Possible tag names are: <font-face>" diff --git a/sw/qa/extras/odfexport/odfexport3.cxx b/sw/qa/extras/odfexport/odfexport3.cxx index 82fcc59aae2e..5c5565f6c2f7 100644 --- a/sw/qa/extras/odfexport/odfexport3.cxx +++ b/sw/qa/extras/odfexport/odfexport3.cxx @@ -547,7 +547,8 @@ CPPUNIT_TEST_FIXTURE(Test, testBtlrFrame) CPPUNIT_TEST_FIXTURE(Test, testTdf129520) { - loadAndReload("tdf129520.docx"); + createSwDoc("tdf129520.docx"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); CPPUNIT_ASSERT_EQUAL(u"M"_ustr, getParagraph(1)->getString()); @@ -633,7 +634,8 @@ DECLARE_ODFEXPORT_TEST(testMasterPageWithDrawingPage, "sw_hatch.odt") CPPUNIT_TEST_FIXTURE(Test, testPageStyleBackgroundFullSizeOOo) { - loadAndReload("pagestyle_background_ooo33.odt"); + createSwDoc("pagestyle_background_ooo33.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(3, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); // Standard @@ -727,7 +729,8 @@ CPPUNIT_TEST_FIXTURE(Test, testPageStyleBackgroundFullSizeOOo) CPPUNIT_TEST_FIXTURE(Test, testPageStyleBackgroundFullSizeLO64) { - loadAndReload("pagestyle_background_lo64.odt"); + createSwDoc("pagestyle_background_lo64.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(6, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); // Standard @@ -908,7 +911,8 @@ CPPUNIT_TEST_FIXTURE(Test, testPageStyleBackgroundFullSizeLO64) CPPUNIT_TEST_FIXTURE(Test, testPageStyleBackgroundFullSizeLO70) { - loadAndReload("pagestyle_background_lo70.odt"); + createSwDoc("pagestyle_background_lo70.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(6, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); // Standard @@ -1089,7 +1093,8 @@ CPPUNIT_TEST_FIXTURE(Test, testPageStyleBackgroundFullSizeLO70) CPPUNIT_TEST_FIXTURE(Test, testFillBitmapUnused) { - loadAndReload("fillbitmap3.odt"); + createSwDoc("fillbitmap3.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(4, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); // nav_5f_home and all its references are completely gone @@ -1508,7 +1513,8 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt") CPPUNIT_TEST_FIXTURE(Test, testTableStyles3) { - loadAndReload("table_styles_3.odt"); + createSwDoc("table_styles_3.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // This test checks if default valued attributes aren't exported. xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); @@ -1698,7 +1704,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTableStyles4) CPPUNIT_TEST_FIXTURE(Test, testTableStyles5) { - loadAndReload("table_styles_5.odt"); + createSwDoc("table_styles_5.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Test if cell styles doesn't have a style:parent-style-name attribute. xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); @@ -1771,7 +1778,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTableStyles5) CPPUNIT_TEST_FIXTURE(Test, testTdf145226) { - loadAndReload("tdf145226.fodt"); + createSwDoc("tdf145226.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); @@ -1800,7 +1808,8 @@ DECLARE_ODFEXPORT_TEST(testTdf101710, "tdf101710.odt") CPPUNIT_TEST_FIXTURE(Test, testTdf129568) { - loadAndReload("tdf129568.fodt"); + createSwDoc("tdf129568.fodt"); + saveAndReload(mpFilter); // Test that export doesn't fail, and that style is imported and in use. uno::Reference<style::XStyle> xStyle( getStyles(u"CellStyles"_ustr)->getByName(u"Default Style.1"_ustr), uno::UNO_QUERY); @@ -1810,7 +1819,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf129568) CPPUNIT_TEST_FIXTURE(Test, testTdf129568ui) { - loadAndReload("tdf129568-ui.fodt"); + createSwDoc("tdf129568-ui.fodt"); + saveAndReload(mpFilter); // Same as above, but styles referenced by UI name. uno::Reference<style::XStyle> xStyle( getStyles(u"CellStyles"_ustr)->getByName(u"Default Style.1"_ustr), uno::UNO_QUERY); @@ -1820,7 +1830,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf129568ui) CPPUNIT_TEST_FIXTURE(Test, testTdf164712) { - loadAndReload("tdf164712.odt"); + createSwDoc("tdf164712.odt"); + saveAndReload(mpFilter); auto xText = getParagraph(1)->getText(); CPPUNIT_ASSERT(xText.is()); auto xCursor(xText->createTextCursorByRange(getParagraph(1))); @@ -1906,7 +1917,8 @@ DECLARE_ODFEXPORT_TEST(testArabicZero5Numbering, "arabic-zero5-numbering.docx") CPPUNIT_TEST_FIXTURE(Test, testImageMimetype) { - loadAndReload("image-mimetype.odt"); + createSwDoc("image-mimetype.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Test that the loext:mimetype attribute is written for exported images, tdf#109202 diff --git a/sw/qa/extras/odfexport/odfexport4.cxx b/sw/qa/extras/odfexport/odfexport4.cxx index e7391f1ed17a..95dc8bed1a48 100644 --- a/sw/qa/extras/odfexport/odfexport4.cxx +++ b/sw/qa/extras/odfexport/odfexport4.cxx @@ -49,7 +49,8 @@ public: CPPUNIT_TEST_FIXTURE(Test, tdf135942) { - loadAndReload("nestedTableInFooter.odt"); + createSwDoc("nestedTableInFooter.odt"); + saveAndReload(mpFilter); // All table autostyles should be collected, including nested, and must not crash. CPPUNIT_ASSERT_EQUAL(1, getPages()); @@ -65,7 +66,8 @@ CPPUNIT_TEST_FIXTURE(Test, tdf150927) { // Similar to tdf135942 - loadAndReload("table-in-frame-in-table-in-header-base.odt"); + createSwDoc("table-in-frame-in-table-in-header-base.odt"); + saveAndReload(mpFilter); // All table autostyles should be collected, including nested, and must not crash. CPPUNIT_ASSERT_EQUAL(1, getPages()); @@ -85,7 +87,8 @@ CPPUNIT_TEST_FIXTURE(Test, testPersonalMetaData) officecfg::Office::Common::Security::Scripting::KeepDocUserInfoOnSaving::set(true, pBatch); pBatch->commit(); - loadAndReload("personalmetadata.odt"); + createSwDoc("personalmetadata.odt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"meta.xml"_ustr); assertXPath(pXmlDoc, "/office:document-meta/office:meta/meta:initial-creator", 1); assertXPath(pXmlDoc, "/office:document-meta/office:meta/meta:creation-date", 1); @@ -110,7 +113,8 @@ CPPUNIT_TEST_FIXTURE(Test, testPersonalMetaData) officecfg::Office::Common::Security::Scripting::KeepDocUserInfoOnSaving::set(false, pBatch); pBatch->commit(); - loadAndReload("personalmetadata.odt"); + createSwDoc("personalmetadata.odt"); + saveAndReload(mpFilter); pXmlDoc = parseExport(u"meta.xml"_ustr); assertXPath(pXmlDoc, "/office:document-meta/office:meta/meta:initial-creator", 0); assertXPath(pXmlDoc, "/office:document-meta/office:meta/meta:creation-date", 0); @@ -163,7 +167,8 @@ CPPUNIT_TEST_FIXTURE(Test, tdf151100) { // Similar to tdf135942 - loadAndReload("tdf151100.docx"); + createSwDoc("tdf151100.docx"); + saveAndReload(mpFilter); // All table autostyles should be collected, including nested, and must not crash. CPPUNIT_ASSERT_EQUAL(1, getPages()); @@ -265,7 +270,8 @@ DECLARE_ODFEXPORT_TEST(testTdf143793_noBodyWrapping, "tdf143793_noBodyWrapping.o CPPUNIT_TEST_FIXTURE(Test, testTdf137199) { - loadAndReload("tdf137199.docx"); + createSwDoc("tdf137199.docx"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(u">1<"_ustr, getProperty<OUString>(getParagraph(1), u"ListLabelString"_ustr)); @@ -327,7 +333,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf57317_autoListName) CPPUNIT_TEST_FIXTURE(Test, testListFormatDocx) { - loadAndReload("listformat.docx"); + createSwDoc("listformat.docx"); + saveAndReload(mpFilter); // Ensure in resulting ODT we also have not just prefix/suffix, but custom delimiters CPPUNIT_ASSERT_EQUAL(u">1<"_ustr, getProperty<OUString>(getParagraph(1), u"ListLabelString"_ustr)); @@ -513,7 +520,8 @@ CPPUNIT_TEST_FIXTURE(Test, testStyleLink) CPPUNIT_TEST_FIXTURE(Test, tdf120972) { - loadAndReload("table_number_format_3.docx"); + createSwDoc("table_number_format_3.docx"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); OUString cDecimal(SvtSysLocale().GetLocaleData().getNumDecimalSep()[0]); @@ -819,7 +827,8 @@ DECLARE_ODFEXPORT_TEST(testTdf78510, "WordTest_edit.odt") CPPUNIT_TEST_FIXTURE(Test, testParagraphMarkerMarkupRoundtrip) { - loadAndReload("ParagraphMarkerMarkup.fodt"); + createSwDoc("ParagraphMarkerMarkup.fodt"); + saveAndReload(mpFilter); // Test that the markup stays at save-and-reload xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); OUString autostyle = getXPath(pXmlDoc, "//office:body/office:text/text:p", "marker-style-name"); @@ -869,7 +878,8 @@ CPPUNIT_TEST_FIXTURE(Test, testCommentStyles) CPPUNIT_TEST_FIXTURE(Test, testTdf150408_IsLegal) { - loadAndReload("IsLegal.fodt"); + createSwDoc("IsLegal.fodt"); + saveAndReload(mpFilter); // Second level's numbering should use Arabic numbers for first level reference auto xPara = getParagraph(1); @@ -992,7 +1002,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159438) { // Given a text with bookmarks, where an end of one bookmark is the position of another, // and the start of a third - loadAndReload("bookmark_order.fodt"); + createSwDoc("bookmark_order.fodt"); + saveAndReload(mpFilter); auto xPara = getParagraph(1); // Check that the order of runs is correct (bookmarks don't overlap) @@ -1080,7 +1091,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159438) CPPUNIT_TEST_FIXTURE(Test, testTdf160700) { // Given a document with an empty numbered paragraph, and a cross-reference to it - loadAndReload("tdf160700.odt"); + createSwDoc("tdf160700.odt"); + saveAndReload(mpFilter); // Refresh fields and ensure cross-reference to numbered para is okay auto xTextFieldsSupplier(mxComponent.queryThrow<text::XTextFieldsSupplier>()); @@ -1112,7 +1124,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf160253_ordinary_numbering) // endnote, which has a paragraph in another list. // Before the fix, this already failed with // Error: "list2916587379" is referenced by an IDREF, but not defined. - loadAndReload("tdf160253_ordinary_numbering.fodt"); + createSwDoc("tdf160253_ordinary_numbering.fodt"); + saveAndReload(mpFilter); // Make sure that the fourth paragraph has correct number - it was "1." before the fix CPPUNIT_ASSERT_EQUAL(u"3."_ustr, @@ -1132,7 +1145,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf160253_outline_numbering) // an endnote, which has a paragraph in a list. // Before the fix, this already failed with // Error: "list2916587379" is referenced by an IDREF, but not defined. - loadAndReload("tdf160253_outline_numbering.fodt"); + createSwDoc("tdf160253_outline_numbering.fodt"); + saveAndReload(mpFilter); // Make sure that the third paragraph has correct number - it was "1" before the fix CPPUNIT_ASSERT_EQUAL(u"2"_ustr, @@ -1148,7 +1162,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTableInFrameAnchoredToPage) { // Given a table in a frame anchored to a page: // it must not assert on export because of missing format for an exported table - loadAndReload("table_in_frame_to_page.fodt"); + createSwDoc("table_in_frame_to_page.fodt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); auto AutoStyleUsedIn = [this, &pXmlDoc](const OString& path, const char* attr) -> OString { @@ -1173,7 +1188,8 @@ CPPUNIT_TEST_FIXTURE(Test, testDeletedTableAutostylesExport) { // Given a document with deleted table: // it must not assert on export because of missing format for an exported table - loadAndReload("deleted_table.fodt"); + createSwDoc("deleted_table.fodt"); + saveAndReload(mpFilter); } DECLARE_ODFEXPORT_TEST(testTdf160877, "tdf160877.odt") @@ -1196,7 +1212,8 @@ CPPUNIT_TEST_FIXTURE(Test, testMidnightRedlineDatetime) // make sure that it succeeds export and import validation. Before the fix, this failed: // - Error: "2001-01-01" does not satisfy the "dateTime" type // because "2001-01-01T00:00:00" became "2001-01-01" on roundtrip. - loadAndReload("midnight_redline.fodt"); + createSwDoc("midnight_redline.fodt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); assertXPathContent(pXmlDoc, @@ -1209,7 +1226,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122452) { // FIXME: Error: element "text:insertion" was found where no element may occur skipValidation(); - loadAndReload("tdf122452.doc"); + createSwDoc("tdf122452.doc"); + saveAndReload(mpFilter); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Without the fix in place this fails with: @@ -1221,7 +1239,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122452) CPPUNIT_TEST_FIXTURE(Test, testTdf159027) { - loadAndReload("tdf159027.odt"); + createSwDoc("tdf159027.odt"); + saveAndReload(mpFilter); SwDoc* pDoc = getSwDoc(); pDoc->getIDocumentFieldsAccess().UpdateFields(true); @@ -1292,7 +1311,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121119_runtime_update) CPPUNIT_TEST_FIXTURE(Test, testTdf163703) { // Given a document with italics autostyle in a comment - loadAndReload("italics-in-comment.fodt"); + createSwDoc("italics-in-comment.fodt"); + saveAndReload(mpFilter); auto xFields( mxComponent.queryThrow<text::XTextFieldsSupplier>()->getTextFields()->createEnumeration()); @@ -1340,7 +1360,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf163703) CPPUNIT_TEST_FIXTURE(Test, testTdf36709) { // Verifies that loext:text-indent correctly round-trips - loadAndReload("tdf36709.fodt"); + createSwDoc("tdf36709.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); @@ -1366,7 +1387,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf36709) CPPUNIT_TEST_FIXTURE(Test, testTdf163913) { // Verifies that loext:left-margin and loext:right-margin correctly round-trip - loadAndReload("tdf163913.fodt"); + createSwDoc("tdf163913.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); @@ -1526,7 +1548,8 @@ CPPUNIT_TEST_FIXTURE(Test, testMsWordUlTrailSpace) CPPUNIT_TEST_FIXTURE(Test, testTdf71583) { // Verifies that loext:text-indent correctly round-trips - loadAndReload("tdf71583.odt"); + createSwDoc("tdf71583.odt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); assertXPathNodeName(pXmlDoc, "//office:body/office:text/text:p/*[1]", "page-count-range"); } @@ -1534,7 +1557,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf71583) CPPUNIT_TEST_FIXTURE(Test, testTdf166011) { // Verifies that style:script-type correctly round-trips - loadAndReload("tdf166011.fodt"); + createSwDoc("tdf166011.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); @@ -1547,7 +1571,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf166011) CPPUNIT_TEST_FIXTURE(Test, testTdf166011ee) { // Verifies that style:script-type correctly round-trips with Edit Engine - loadAndReload("tdf166011ee.fodt"); + createSwDoc("tdf166011ee.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); @@ -1561,7 +1586,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf168817) { // A ruby text with a hyperlink // Without the fix, it failed an assertion on save, and produced invalid XML that couldn't load - loadAndReload("ruby+hyperlink.fodt"); + createSwDoc("ruby+hyperlink.fodt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // Check that only one instance of respective elements are produced assertXPath(pXmlDoc, "//text:p", 1); @@ -1580,7 +1606,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf164677) // correctly roundtrip. Before the fix, export code didn't see the difference between sections' // properties, and generated a single section autostyle, so all the sections got identical // properties after reload: - loadAndReload("colored-sections-separators.fodt"); + createSwDoc("colored-sections-separators.fodt"); + saveAndReload(mpFilter); auto xTextSections = mxComponent.queryThrow<text::XTextSectionsSupplier>()->getTextSections(); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTextSections->getElementNames().getLength()); @@ -1648,7 +1675,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf37128ConvertStartEndOnResave) // Older versions of LO always stored fo:text-align left/right as // start/end, respectively. Make sure documents produced by older // versions of LO convert these values to left/right. - loadAndReload("tdf37128-start-end-to-left-right.fodt"); + createSwDoc("tdf37128-start-end-to-left-right.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); @@ -1674,7 +1702,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf118350StartEndPreserved) { // Check that fo:text-align start/end round-trip correctly for // documents made by newer versions of LO. - loadAndReload("tdf118350-start-end-preserved.fodt"); + createSwDoc("tdf118350-start-end-preserved.fodt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); @@ -1698,7 +1727,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf118350StartEndPreserved) CPPUNIT_TEST_FIXTURE(Test, testTdf162120StyleWritingModeAutomaticSerialization) { - loadAndReload("tdf162120-style-writing-mode-automatic.fodt"); + createSwDoc("tdf162120-style-writing-mode-automatic.fodt"); + saveAndReload(mpFilter); auto pStylesDoc = parseExport(u"styles.xml"_ustr); assertXPath(pStylesDoc, "//style:paragraph-properties[@style:writing-mode-automatic]", 1); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index cbe938154726..8e77294687eb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -158,7 +158,8 @@ CPPUNIT_TEST_FIXTURE(Test, testShapeInFloattable) CPPUNIT_TEST_FIXTURE(Test, testEmptyAnnotationMark) { - loadAndReload("empty-annotation-mark.docx"); + createSwDoc("empty-annotation-mark.docx"); + saveAndReload(mpFilter); // Delete the word that is commented, and save again. uno::Reference<text::XTextRange> xRun = getRun(getParagraph(1), 3); CPPUNIT_ASSERT_EQUAL(u"with"_ustr, xRun->getString()); @@ -334,7 +335,8 @@ DECLARE_OOXMLEXPORT_TEST(testNumberingFont, "numbering-font.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf106541_noinheritChapterNumbering) { - loadAndReload("tdf106541_noinheritChapterNumbering.odt"); + createSwDoc("tdf106541_noinheritChapterNumbering.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // in LO, it appears that styles based on the Chapter Numbering style explicitly set the // numbering style/outline level to 0 by default, and that LO prevents inheriting directly from "Outline" style. @@ -774,7 +776,8 @@ DECLARE_OOXMLEXPORT_TEST(testEffectExtentMargin, "effectextent-margin.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf88583) { - loadAndReload("tdf88583.odt"); + createSwDoc("tdf88583.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(getParagraph(1), u"FillStyle"_ustr)); CPPUNIT_ASSERT_EQUAL(Color(0x00cc00), getProperty<Color>(getParagraph(1), u"FillColor"_ustr)); @@ -896,7 +899,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf44986, "tdf44986.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf118682) { - loadAndReload("tdf118682.fodt"); + createSwDoc("tdf118682.fodt"); + saveAndReload(mpFilter); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); @@ -924,7 +928,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf118682) CPPUNIT_TEST_FIXTURE(Test, testTdf133163) { - loadAndReload("tdf133163.fodt"); + createSwDoc("tdf133163.fodt"); + saveAndReload(mpFilter); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); @@ -951,7 +956,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133163) CPPUNIT_TEST_FIXTURE(Test, testTdf166102) { - loadAndReload("tdf166102.fodt"); + createSwDoc("tdf166102.fodt"); + saveAndReload(mpFilter); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 0111c0a6f584..1855bdbe8a64 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -102,7 +102,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSmartart) CPPUNIT_TEST_FIXTURE(Test, testFdo69548) { - loadAndReload("fdo69548.docx"); + createSwDoc("fdo69548.docx"); + saveAndReload(mpFilter); // The problem was that the last space in target URL was removed CPPUNIT_ASSERT_EQUAL(u"#this_is_a_bookmark"_ustr, getProperty<OUString>(getRun(getParagraph(1), 1), u"HyperLinkURL"_ustr)); } @@ -451,7 +452,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133735) CPPUNIT_TEST_FIXTURE(Test, testTdf134569_nestedTable) { - loadAndReload("tdf134569_nestedTable.docx"); + createSwDoc("tdf134569_nestedTable.docx"); + saveAndReload(mpFilter); // 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 e2f9e8efaa20..190fc1188fa5 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -76,14 +76,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf90906_colAutoB, "tdf90906_colAutoB.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf92524_autoColor) { - loadAndReload("tdf92524_autoColor.doc"); + createSwDoc("tdf92524_autoColor.doc"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(getParagraph(1), u"FillStyle"_ustr)); CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(getParagraph(1), u"ParaBackColor"_ustr)); } CPPUNIT_TEST_FIXTURE(Test, testTdf116436_rowFill) { - loadAndReload("tdf116436_rowFill.odt"); + createSwDoc("tdf116436_rowFill.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -100,7 +102,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121665_back2backColumnBreaks, "tdf121665_back2ba CPPUNIT_TEST_FIXTURE(Test, testTdf126795_TabsRelativeToIndent0) { - loadAndReload("tdf126795_TabsRelativeToIndent0.odt"); + createSwDoc("tdf126795_TabsRelativeToIndent0.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Sequence< style::TabStop > stops = getProperty< uno::Sequence<style::TabStop> >(getParagraph( 2 ), u"ParaTabStops"_ustr); CPPUNIT_ASSERT_EQUAL( sal_Int32(1), stops.getLength()); @@ -110,7 +113,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126795_TabsRelativeToIndent0) CPPUNIT_TEST_FIXTURE(Test, testTdf126795_TabsRelativeToIndent1) { - loadAndReload("tdf126795_TabsRelativeToIndent1.odt"); + createSwDoc("tdf126795_TabsRelativeToIndent1.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Sequence< style::TabStop > stops = getProperty< uno::Sequence<style::TabStop> >(getParagraph( 2 ), u"ParaTabStops"_ustr); CPPUNIT_ASSERT_EQUAL( sal_Int32(1), stops.getLength()); @@ -147,7 +151,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf124384, "tdf124384.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf121456_tabsOffset) { - loadAndReload("tdf121456_tabsOffset.odt"); + createSwDoc("tdf121456_tabsOffset.odt"); + saveAndReload(mpFilter); for (int i=2; i<8; i++) { uno::Sequence< style::TabStop > stops = getProperty< uno::Sequence<style::TabStop> >(getParagraph( i ), u"ParaTabStops"_ustr); @@ -458,7 +463,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113547, "tdf113547.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf113399) { - loadAndReload("tdf113399.doc"); + createSwDoc("tdf113399.doc"); + saveAndReload(mpFilter); // 0 padding was not preserved // In LO 0 is the default, but in OOXML format the default is 254 / 127 uno::Reference<beans::XPropertySet> xPropSet(getShape(1), uno::UNO_QUERY); @@ -579,7 +585,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104354_firstParaInSection, "tdf104354_firstParaI CPPUNIT_TEST_FIXTURE(Test, testPageBreak_after) { - loadAndReload("pageBreak_after.odt"); + createSwDoc("pageBreak_after.odt"); + saveAndReload(mpFilter); // The problem was that the page breakAfter put the empty page BEFORE the table xmlDocUniquePtr pDump = parseLayoutDump(); assertXPath(pDump, "/root/page[1]/body/tab", 1); @@ -706,7 +713,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf119760_positionCellBorder, "tdf119760_positionCe CPPUNIT_TEST_FIXTURE(Test, testTdf98620_environmentBiDi) { - loadAndReload("tdf98620_environmentBiDi.odt"); + createSwDoc("tdf98620_environmentBiDi.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getPages()); CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, getProperty<sal_Int16>( getParagraph(1), u"WritingMode"_ustr )); CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_RIGHT), getProperty<sal_Int32>( getParagraph(1), u"ParaAdjust"_ustr )); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index fedcbf31e53a..7fdd9880333c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -32,7 +32,8 @@ public: CPPUNIT_TEST_FIXTURE(Test, testTableCrossReference) { - loadAndReload("table_cross_reference.odt"); + createSwDoc("table_cross_reference.odt"); + saveAndReload(mpFilter); 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 @@ -204,7 +205,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTableCrossReference) CPPUNIT_TEST_FIXTURE(Test, testTableCrossReferenceCustomFormat) { - loadAndReload("table_cross_reference_custom_format.odt"); + createSwDoc("table_cross_reference_custom_format.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // tdf#42346: Cross references to tables were not saved // Check also captions with custom formatting @@ -337,7 +339,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTableCrossReferenceCustomFormat) CPPUNIT_TEST_FIXTURE(Test, testObjectCrossReference) { - loadAndReload("object_cross_reference.odt"); + createSwDoc("object_cross_reference.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(10, getShapes()); CPPUNIT_ASSERT_EQUAL(2, getPages()); // tdf#42346: Cross references to objects were not saved @@ -734,7 +737,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTd112202) CPPUNIT_TEST_FIXTURE(Test, testTdf79435_legacyInputFields) { - loadAndReload("tdf79435_legacyInputFields.doc"); + createSwDoc("tdf79435_legacyInputFields.doc"); + saveAndReload(mpFilter); //using .doc input file to verify cross-format compatibility. uno::Reference<text::XFormField> xFormField = getProperty<uno::Reference<text::XFormField>>( getRun(getParagraph(5), 3), u"Bookmark"_ustr); @@ -953,7 +957,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf117137, "tdf117137.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf138780) { - loadAndReload("tdf138780.odt"); + createSwDoc("tdf138780.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Paragraphs were not part of a numbering anymore after roundtrip. uno::Reference<beans::XPropertySet> xPara1(getParagraph(1), uno::UNO_QUERY); @@ -1021,7 +1026,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122563) CPPUNIT_TEST_FIXTURE(Test, testTdf94628) { - loadAndReload("tdf94628.docx"); + createSwDoc("tdf94628.docx"); + saveAndReload(mpFilter); uno::Reference<beans::XPropertySet> xPropertySet( getStyles(u"NumberingStyles"_ustr)->getByName(u"WWNum1"_ustr), uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xLevels( @@ -1817,7 +1823,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf81100) CPPUNIT_TEST_FIXTURE(Test, testTdf88496) { - loadAndReload("tdf88496.docx"); + createSwDoc("tdf88496.docx"); + saveAndReload(mpFilter); // Switch off repeating header, there is no place for it. // Now there are only 3 pages with complete table content // instead of a 51-page long table only with header. @@ -1834,7 +1841,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf88496) CPPUNIT_TEST_FIXTURE(Test, testTdf77417) { - loadAndReload("tdf77417.docx"); + createSwDoc("tdf77417.docx"); + saveAndReload(mpFilter); // 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()); @@ -2139,7 +2147,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf101122_noFillForCustomShape) // CPPUNIT_TEST_FIXTURE(Test, testTdf124678_case1) { - loadAndReload("tdf124678_no_leading_paragraph.odt"); + createSwDoc("tdf124678_no_leading_paragraph.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getPages()); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT_EQUAL_MESSAGE("First page header text", u""_ustr, @@ -2155,7 +2164,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf124678_case1) // CPPUNIT_TEST_FIXTURE(Test, testTdf124678_case2) { - loadAndReload("tdf124678_with_leading_paragraph.odt"); + createSwDoc("tdf124678_with_leading_paragraph.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getPages()); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT_EQUAL_MESSAGE("First page header text", u""_ustr, diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index f6871744f6ab..1b659f16afb3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -109,7 +109,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf155690, "tdf155690.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf121374_sectionHF) { - loadAndReload("tdf121374_sectionHF.odt"); + createSwDoc("tdf121374_sectionHF.odt"); + saveAndReload(mpFilter); uno::Reference<beans::XPropertySet> xPageStyle(getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); uno::Reference<text::XTextRange> xFooterText = getProperty< uno::Reference<text::XTextRange> >(xPageStyle, u"FooterText"_ustr); CPPUNIT_ASSERT_EQUAL( u"footer"_ustr, xFooterText->getString() ); @@ -120,7 +121,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121374_sectionHF) CPPUNIT_TEST_FIXTURE(Test, testTdf121374_sectionHF2) { - loadAndReload("tdf121374_sectionHF2.doc"); + createSwDoc("tdf121374_sectionHF2.doc"); + saveAndReload(mpFilter); uno::Reference<beans::XPropertySet> xPageStyle(getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); uno::Reference<text::XTextRange> xHeaderText = getProperty< uno::Reference<text::XTextRange> >(xPageStyle, u"HeaderText"_ustr); CPPUNIT_ASSERT( xHeaderText->getString().startsWith("virkamatka-anomus") ); @@ -369,7 +371,8 @@ DECLARE_OOXMLEXPORT_TEST(testBtlrShape, "btlr-textbox.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf127316_autoEscapement) { - loadAndReload("tdf127316_autoEscapement.odt"); + createSwDoc("tdf127316_autoEscapement.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // This should be roughly .8*35% of the ORIGINAL(non-reduced) size. However, during export the // proportional height has to be changed into direct formatting, which then changes the relative percent. @@ -412,7 +415,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf99602_charStyleSubscript, "tdf99602_charStyleSub CPPUNIT_TEST_FIXTURE(Test, testTdf99602_charStyleSubscript2) { - loadAndReload("tdf99602_charStyleSubscript2.odt"); + createSwDoc("tdf99602_charStyleSubscript2.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // *_In styles_*, don't let the proportionality/escapement affect the fontsize - otherwise it starts doubling up, // so instead just throw away the values and use the default settings instead - meaning fontsize is unaffected. @@ -524,7 +528,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf118947_tableStyle2, "tdf118947_tableStyle2.docx" CPPUNIT_TEST_FIXTURE(Test, tdf123912_protectedForm) { - loadAndReload("tdf123912_protectedForm.odt"); + createSwDoc("tdf123912_protectedForm.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL_MESSAGE("Compatibility: Protect form", true, @@ -548,7 +553,8 @@ DECLARE_OOXMLEXPORT_TEST(tdf124600b, "tdf124600b.docx") CPPUNIT_TEST_FIXTURE(Test, testDateControl) { - loadAndReload("empty-date-control.odt"); + createSwDoc("empty-date-control.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Check that we exported the empty date control correctly // Date form field is converted to date content control. @@ -580,7 +586,8 @@ CPPUNIT_TEST_FIXTURE(Test, testDateControl) CPPUNIT_TEST_FIXTURE(Test, testTdf121867) { - loadAndReload("tdf121867.odt"); + createSwDoc("tdf121867.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); SwEditShell* pEditShell = getSwDocShell()->GetEditShell(); CPPUNIT_ASSERT(pEditShell); @@ -656,7 +663,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123435, "tdf123435.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf116371) { - loadAndReload("tdf116371.odt"); + createSwDoc("tdf116371.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Make sure the rotation is exported correctly, and size not distorted @@ -997,7 +1005,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf78657) CPPUNIT_TEST_FIXTURE(Test, testBtlrFrame) { - loadAndReload("btlr-frame.odt"); + createSwDoc("btlr-frame.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY); @@ -1314,7 +1323,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf127579) CPPUNIT_TEST_FIXTURE(Test, testTdf128304) { - loadAndReload("tdf128304.odt"); + createSwDoc("tdf128304.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(4, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); css::text::WritingMode eMode; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 7bfcb49cd7d3..951f8d361011 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -83,7 +83,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128197) CPPUNIT_TEST_FIXTURE(Test, testTdf135595_HFtableWrap) { - loadAndReload("tdf135595_HFtableWrap.odt"); + createSwDoc("tdf135595_HFtableWrap.odt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nRowHeight = getXPath(pXmlDoc, "//page[1]/header/tab/row/infos/bounds", "height").toInt32(); // tdf#77794: always force bLayoutInCell from false to true for MSO2013+ @@ -159,7 +160,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123622, "tdf123622.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf78749) { - loadAndReload("tdf78749.docx"); + createSwDoc("tdf78749.docx"); + saveAndReload(mpFilter); //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); @@ -423,7 +425,8 @@ CPPUNIT_TEST_FIXTURE(Test, testChicagoNumberingFootnote) CPPUNIT_TEST_FIXTURE(Test, testListNotCountedIndent) { - loadAndReload("list_notcounted_indent.fodt"); + createSwDoc("list_notcounted_indent.fodt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:numPr/w:numId", "val", u"0"); // wrong: 720 @@ -460,7 +463,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf87569d, "tdf87569_drawingml.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf130610) { - loadAndReload("tdf130610_bold_in_2_styles.ott"); + createSwDoc("tdf130610_bold_in_2_styles.ott"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // check character properties { @@ -517,7 +521,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf78352, "tdf78352.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf81567) { - loadAndReload("tdf81567.odt"); + createSwDoc("tdf81567.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); CPPUNIT_ASSERT_EQUAL(2, getShapes()); @@ -613,7 +618,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults, "tdf108350_noFontdefaults CPPUNIT_TEST_FIXTURE(Test, testTdf123116_oversizedRowSplit) { - loadAndReload("tdf123116_oversizedRowSplit.odt"); + createSwDoc("tdf123116_oversizedRowSplit.odt"); + saveAndReload(mpFilter); // Intentionally require a very non-backward-compatible, natural continuation of the table // instead of an ugly "page break" like MS Word does (and LO used to do). CPPUNIT_ASSERT_EQUAL_MESSAGE("Row splits over 4 pages", 4, getPages()); @@ -632,7 +638,8 @@ DECLARE_OOXMLEXPORT_TEST(testPageContentBottom, "page-content-bottom.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf129522_removeShadowStyle) { - loadAndReload("tdf129522_removeShadowStyle.odt"); + createSwDoc("tdf129522_removeShadowStyle.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference< container::XNameAccess > paragraphStyles = getStyles(u"ParagraphStyles"_ustr); uno::Reference< beans::XPropertySet > xStyleProps(paragraphStyles->getByName(u"Shadow"_ustr), uno::UNO_QUERY_THROW); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 0cf9cd9c666a..5813100cd917 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -38,7 +38,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf123621) CPPUNIT_TEST_FIXTURE(Test, testTdf131540) { - loadAndReload("tdf131540.odt"); + createSwDoc("tdf131540.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); // There are 2 OLEs test if one of them moved on save: @@ -107,7 +108,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf131801) CPPUNIT_TEST_FIXTURE(Test, testTdf133334_followPgStyle) { - loadAndReload("tdf133334_followPgStyle.odt"); + createSwDoc("tdf133334_followPgStyle.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getPages()); } @@ -178,7 +180,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123381, "tdf123381.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf123401) { - loadAndReload("tdf123401.fodt"); + createSwDoc("tdf123401.fodt"); + saveAndReload(mpFilter); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); @@ -224,7 +227,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf116394) CPPUNIT_TEST_FIXTURE(Test, testTdf123356) { - loadAndReload("tdf123356.fodt"); + createSwDoc("tdf123356.fodt"); + saveAndReload(mpFilter); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); @@ -241,7 +245,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf123356) CPPUNIT_TEST_FIXTURE(Test, testTdf136404) { - loadAndReload("tdf136404.fodt"); + createSwDoc("tdf136404.fodt"); + saveAndReload(mpFilter); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); @@ -295,7 +300,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138739, "tdf138739.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf166436) { // Without the fix in place, this test would have crashed at import time - loadAndReload("tdf166436.docx"); + createSwDoc("tdf166436.docx"); + saveAndReload(mpFilter); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); CPPUNIT_ASSERT(xFieldsAccess->hasElements()); @@ -303,7 +309,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf166436) CPPUNIT_TEST_FIXTURE(Test, testTdf123390) { - loadAndReload("tdf123390.fodt"); + createSwDoc("tdf123390.fodt"); + saveAndReload(mpFilter); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); @@ -324,7 +331,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf123390) CPPUNIT_TEST_FIXTURE(Test, testTdf123354) { - loadAndReload("tdf123354.fodt"); + createSwDoc("tdf123354.fodt"); + saveAndReload(mpFilter); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); @@ -345,7 +353,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf123354) CPPUNIT_TEST_FIXTURE(Test, testTdf123384) { - loadAndReload("tdf123384.fodt"); + createSwDoc("tdf123384.fodt"); + saveAndReload(mpFilter); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); @@ -515,7 +524,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122648) CPPUNIT_TEST_FIXTURE(Test, testTdf98000_changePageStyle) { - loadAndReload("tdf98000_changePageStyle.odt"); + createSwDoc("tdf98000_changePageStyle.odt"); + saveAndReload(mpFilter); uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); @@ -529,7 +539,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf98000_changePageStyle) CPPUNIT_TEST_FIXTURE(Test, testTdf145998_unnecessaryPageStyles) { - loadAndReload("tdf145998_unnecessaryPageStyles.odt"); + createSwDoc("tdf145998_unnecessaryPageStyles.odt"); + saveAndReload(mpFilter); // Sanity check - always good to test when dealing with page styles and breaks. CPPUNIT_ASSERT_EQUAL(5, getPages()); @@ -561,7 +572,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145998_unnecessaryPageStyles) CPPUNIT_TEST_FIXTURE(Test, testTdf136929_framesOfParagraph) { - loadAndReload("tdf136929_framesOfParagraph.odt"); + createSwDoc("tdf136929_framesOfParagraph.odt"); + saveAndReload(mpFilter); // Before this fix, the image was placed in the footer instead of in the text body - messing everything up. CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 5, getPages() ); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -580,14 +592,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf136589_paraHadField, "tdf136589_paraHadField.doc CPPUNIT_TEST_FIXTURE(Test, testTdf133370_columnBreak) { - loadAndReload("tdf133370_columnBreak.odt"); + createSwDoc("tdf133370_columnBreak.odt"); + saveAndReload(mpFilter); // Since non-DOCX formats ignores column breaks in non-column situations, don't export to docx. CPPUNIT_ASSERT_EQUAL(1, getPages()); } CPPUNIT_TEST_FIXTURE(Test, testTdf134649_pageBreak) { - loadAndReload("tdf134649_pageBreak.fodt"); + createSwDoc("tdf134649_pageBreak.fodt"); + saveAndReload(mpFilter); // This was 1 (missing page break between tables). CPPUNIT_ASSERT_EQUAL(2, getPages()); } @@ -607,7 +621,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c14, "tdf135343_column CPPUNIT_TEST_FIXTURE(Test, testTdf135973) { - loadAndReload("tdf135973.odt"); + createSwDoc("tdf135973.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); { uno::Reference<beans::XPropertySet> xPara(getParagraph(2), uno::UNO_QUERY); @@ -670,7 +685,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121669_equalColumns, "tdf121669_equalColumns.doc CPPUNIT_TEST_FIXTURE(Test, testTdf132149_pgBreak) { - loadAndReload("tdf132149_pgBreak.odt"); + createSwDoc("tdf132149_pgBreak.odt"); + saveAndReload(mpFilter); // This 5 page document is designed to visually exaggerate the problems // of emulating LO's followed-by-page-style into MSWord's sections. // While much has been improved, there are extra pages present, which still need fixing. @@ -699,7 +715,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132149_pgBreak) CPPUNIT_TEST_FIXTURE(Test, testTdf132149_pgBreakB) { - loadAndReload("tdf132149_pgBreakB.odt"); + createSwDoc("tdf132149_pgBreakB.odt"); + saveAndReload(mpFilter); // This 5 page document is designed to visually exaggerate the problems // of emulating LO's followed-by-page-style into MSWord's sections. xmlDocUniquePtr pDump = parseLayoutDump(); @@ -712,7 +729,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132149_pgBreakB) CPPUNIT_TEST_FIXTURE(Test, testTdf132149_pgBreak2) { - loadAndReload("tdf132149_pgBreak2.odt"); + createSwDoc("tdf132149_pgBreak2.odt"); + saveAndReload(mpFilter); // This 3 page document is designed to visually exaggerate the problems // of emulating LO's followed-by-page-style into MSWord's sections. @@ -727,7 +745,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132149_pgBreak2) CPPUNIT_TEST_FIXTURE(Test, testTdf136952_pgBreak3B) { - loadAndReload("tdf136952_pgBreak3B.odt"); + createSwDoc("tdf136952_pgBreak3B.odt"); + saveAndReload(mpFilter); // This 4 page document is designed to visually exaggerate the problems // of emulating LO's followed-by-page-style into MSWord's sections. xmlDocUniquePtr pDump = parseLayoutDump(); @@ -844,14 +863,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134609_gridAfter, "tdf134609_gridAfter.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf135329_lostImage) { - loadAndReload("tdf135329_lostImage.odt"); + createSwDoc("tdf135329_lostImage.odt"); + saveAndReload(mpFilter); // the character-anchored image was being skipped, since searchNext didn't notice it. uno::Reference<beans::XPropertySet> xImageProps(getShape(2), uno::UNO_QUERY_THROW); } CPPUNIT_TEST_FIXTURE(Test, testTdf136441_commentInFootnote) { - loadAndReload("tdf136441_commentInFootnote.odt"); + createSwDoc("tdf136441_commentInFootnote.odt"); + saveAndReload(mpFilter); // failed to load without error if footnote contained a comment. // (MS Word's UI doesn't allow adding comments to a footnote.) } @@ -885,7 +906,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138345_charStyleHighlight, "tdf138345_charStyleH CPPUNIT_TEST_FIXTURE(Test, testTdf125268) { - loadAndReload("tdf125268.odt"); + createSwDoc("tdf125268.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); const uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1), 1, u"Hello"_ustr), uno::UNO_QUERY); // Without the fix in place, this test would have failed with @@ -1079,7 +1101,8 @@ CPPUNIT_TEST_FIXTURE(Test, testImageSpaceSettings) CPPUNIT_TEST_FIXTURE(Test, testTdf137295) { - loadAndReload("tdf137295.doc"); + createSwDoc("tdf137295.doc"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Without the fix in place, the test would have failed with diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 26232b800d15..1af0e19e5397 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -40,7 +40,8 @@ public: CPPUNIT_TEST_FIXTURE(Test, testTdf143860NonPrimitiveCustomShape) { - loadAndReload("tdf143860_NonPrimitiveCustomShape.odt"); + createSwDoc("tdf143860_NonPrimitiveCustomShape.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); // The document has a custom shape of type non-primitive without handles. Make sure that the shape @@ -88,7 +89,8 @@ CPPUNIT_TEST_FIXTURE(Test, testWrapPolygonLineShape) CPPUNIT_TEST_FIXTURE(Test, testWrapPolygonCustomShape) { - loadAndReload("tdf142433_WrapPolygonCustomShape.odt"); + createSwDoc("tdf142433_WrapPolygonCustomShape.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Document has 4-point star with contour wrap. Error was, that the enhanced path was written @@ -171,7 +173,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134219ContourWrap_stroke_shadow) CPPUNIT_TEST_FIXTURE(Test, testTdf123569_rotWriterImage) { - loadAndReload("tdf123569_rotWriterImage_46deg.odt"); + createSwDoc("tdf123569_rotWriterImage_46deg.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(2, getPages()); uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY); @@ -217,7 +220,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf66039, "tdf66039.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf142486_FrameShadow) { - loadAndReload("tdf142486_FrameShadow.odt"); + createSwDoc("tdf142486_FrameShadow.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); @@ -238,7 +242,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf142486_FrameShadow) CPPUNIT_TEST_FIXTURE(Test, testTdf136059) { - loadAndReload("tdf136059.odt"); + createSwDoc("tdf136059.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Contour has not been exported!", true, @@ -431,7 +436,8 @@ CPPUNIT_TEST_FIXTURE(Test, testGutterTop) CPPUNIT_TEST_FIXTURE(Test, testCustomShapePresetExport) { - loadAndReload("testCustomShapePresetExport.odt"); + createSwDoc("testCustomShapePresetExport.odt"); + saveAndReload(mpFilter); // Check if the load failed. CPPUNIT_ASSERT(getPages()); @@ -503,7 +509,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf125936_numberingSuperscript, "tdf125936_numberin CPPUNIT_TEST_FIXTURE(Test, testTdf134619_numberingProps) { - loadAndReload("tdf134619_numberingProps.doc"); + createSwDoc("tdf134619_numberingProps.doc"); + saveAndReload(mpFilter); // 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, u"NumberingRules"_ustr); @@ -518,7 +525,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134619_numberingProps) CPPUNIT_TEST_FIXTURE(Test, testTdf134951_duplicates) { - loadAndReload("tdf134951_duplicates.odt"); + createSwDoc("tdf134951_duplicates.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(3, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<text::XEndnotesSupplier> xEndnotesSupplier(mxComponent, uno::UNO_QUERY); @@ -556,7 +564,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf135773_numberingShading) CPPUNIT_TEST_FIXTURE(Test, testTdf140336_paraNoneShading) { - loadAndReload("tdf140336_paraNoneShading.odt"); + createSwDoc("tdf140336_paraNoneShading.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Before the fix, the background from a style was exported to dis-inheriting paragraphs/styles. CPPUNIT_ASSERT_EQUAL(sal_uInt32(COL_AUTO), getProperty<sal_uInt32>(getParagraph(1), u"ParaBackColor"_ustr)); @@ -569,7 +578,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf140336_paraNoneShading) CPPUNIT_TEST_FIXTURE(Test, testTdf141173_missingFrames) { - loadAndReload("tdf141173_missingFrames.rtf"); + createSwDoc("tdf141173_missingFrames.rtf"); + saveAndReload(mpFilter); // Without the fix in place, almost all of the text and textboxes were missing. // Without the fix, there were only 2 shapes (mostly unseen). CPPUNIT_ASSERT_EQUAL(14, getShapes()); @@ -591,7 +601,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf142404_tabOverMarginC15, "tdf142404_tabOverMargi CPPUNIT_TEST_FIXTURE(Test, testTdf142404_tabOverSpacingC15) { - loadAndReload("tdf142404_tabOverSpacingC15.odt"); + createSwDoc("tdf142404_tabOverSpacingC15.odt"); + saveAndReload(mpFilter); // Although TabOverMargin no longer applies to compatibilityMode 15 DOCX files, // it still applies to a tab over the paragraph end (inside text boundaries). // The original 3-page ODT saved as DOCX would fit on one page in MS Word 2010, but 3 in Word 2013. @@ -684,7 +695,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146171_invalid_change_date) CPPUNIT_TEST_FIXTURE(Test, testTdf139580) { - loadAndReload("tdf139580.odt"); + createSwDoc("tdf139580.odt"); + saveAndReload(mpFilter); // Without the fix in place, this test would have crashed at export time CPPUNIT_ASSERT_EQUAL(2, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); @@ -749,7 +761,8 @@ CPPUNIT_TEST_FIXTURE(Test, testRtlGutter) CPPUNIT_TEST_FIXTURE(Test, testTdf140572_docDefault_superscript) { - loadAndReload("tdf140572_docDefault_superscript.docx"); + createSwDoc("tdf140572_docDefault_superscript.docx"); + saveAndReload(mpFilter); // A round-trip was crashing. // Without the fix, everything was DFLT_ESC_AUTO_SUPER (default superscript) @@ -783,7 +796,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf136841, "tdf136841.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf138953) { - loadAndReload("croppedAndRotated.odt"); + createSwDoc("croppedAndRotated.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Make sure the rotation is exported correctly, and size not distorted @@ -798,7 +812,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf138953) CPPUNIT_TEST_FIXTURE(Test, testTdf118535) { - loadAndReload("tdf118535.odt"); + createSwDoc("tdf118535.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getShapes()); CPPUNIT_ASSERT_EQUAL(2, getPages()); uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL()); @@ -1066,7 +1081,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf139549) CPPUNIT_TEST_FIXTURE(Test, testTdf143726) { - loadAndReload("Simple-TOC.odt"); + createSwDoc("Simple-TOC.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlStyles = parseExport(u"word/styles.xml"_ustr); CPPUNIT_ASSERT(pXmlStyles); @@ -1077,7 +1093,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143726) CPPUNIT_TEST_FIXTURE(Test, testTdf152153) { - loadAndReload("embedded_images.odt"); + createSwDoc("embedded_images.odt"); + saveAndReload(mpFilter); uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), @@ -1097,7 +1114,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152153) CPPUNIT_TEST_FIXTURE(Test, testTdf152152) { - loadAndReload("artistic_effects.docx"); + createSwDoc("artistic_effects.docx"); + saveAndReload(mpFilter); uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 192d8c6c80c0..f3c0ddacadc9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -209,7 +209,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf139759_commentHighlightBackground, "tdf139759_co CPPUNIT_TEST_FIXTURE(Test, testTdf135906) { - loadAndReload("tdf135906.docx"); + createSwDoc("tdf135906.docx"); + saveAndReload(mpFilter); // just test round-tripping. The document was exported as corrupt and didn't re-load. } @@ -594,7 +595,8 @@ DECLARE_OOXMLEXPORT_TEST(TestWPGZOrder, "testWPGZOrder.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf148720) { - loadAndReload("tdf148720.odt"); + createSwDoc("tdf148720.odt"); + saveAndReload(mpFilter); xmlDocUniquePtr pLayout = parseLayoutDump(); const char* sShapeXPaths[] = @@ -991,7 +993,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146955) CPPUNIT_TEST_FIXTURE(Test, testTdf144668) { - loadAndReload("tdf144668.odt"); + createSwDoc("tdf144668.odt"); + saveAndReload(mpFilter); uno::Reference<beans::XPropertySet> xPara1(getParagraph(1, u"level1"_ustr), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(u"[0001]"_ustr, getProperty<OUString>(xPara1, u"ListLabelString"_ustr)); @@ -1143,7 +1146,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149089, "tdf149089.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf139128) { - loadAndReload("tdf139128.odt"); + createSwDoc("tdf139128.odt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); CPPUNIT_ASSERT(pXmlDoc); // Without the accompanying fix in place, this test would have failed with: diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index a84ad54ac5b4..c92dd7a582f4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -680,14 +680,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150966_regularInset) CPPUNIT_TEST_FIXTURE(Test, testTdf152636_lostPageBreak) { - loadAndReload("tdf152636_lostPageBreak.odt"); + createSwDoc("tdf152636_lostPageBreak.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getPages()); } CPPUNIT_TEST_FIXTURE(Test, testTdf152636_lostPageBreak2) { - loadAndReload("tdf152636_lostPageBreak2.docx"); + createSwDoc("tdf152636_lostPageBreak2.docx"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(2, getPages()); } @@ -711,7 +713,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtDuplicatedId) CPPUNIT_TEST_FIXTURE(Test, testImageCropping) { - loadAndReload("crop-roundtrip.docx"); + createSwDoc("crop-roundtrip.docx"); + saveAndReload(mpFilter); // the image has no cropping after roundtrip, because it has been physically cropped // NB: this test should be fixed when the core feature to show image cropped when it @@ -750,7 +753,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152200) CPPUNIT_TEST_FIXTURE(Test, testTdf126477) { - loadAndReload("embedded_chart.odt"); + createSwDoc("embedded_chart.odt"); + saveAndReload(mpFilter); uno::Reference<text::XTextEmbeddedObjectsSupplier> xTEOSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XNameAccess> xAccess(xTEOSupplier->getEmbeddedObjects()); @@ -775,7 +779,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126477) CPPUNIT_TEST_FIXTURE(Test, testTdf152425) { - loadAndReload("tdf152425.docx"); + createSwDoc("tdf152425.docx"); + saveAndReload(mpFilter); // Check that "List Number" and "List 5" styles don't get merged const OUString Para3Style = getProperty<OUString>(getParagraph(3), u"ParaStyleName"_ustr); @@ -789,7 +794,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152425) CPPUNIT_TEST_FIXTURE(Test, testTdf153104) { - loadAndReload("tdf153104.docx"); + createSwDoc("tdf153104.docx"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); OUString numId = getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:numPr/w:numId", "val"); @@ -811,7 +817,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf153104) CPPUNIT_TEST_FIXTURE(Test, testTdf153128) { - loadAndReload("tdf153128.docx"); + createSwDoc("tdf153128.docx"); + saveAndReload(mpFilter); calcLayout(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nFirstLineHeight @@ -828,7 +835,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf153128) CPPUNIT_TEST_FIXTURE(Test, testExportingUnknownStyleInRedline) { // This must not fail assertions - loadAndReload("UnknownStyleInRedline.docx"); + createSwDoc("UnknownStyleInRedline.docx"); + saveAndReload(mpFilter); // Check that the original unknown style name "UnknownStyle" is roundtripped // (maybe this is wrong, because Word does not do this). xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); @@ -838,7 +846,8 @@ CPPUNIT_TEST_FIXTURE(Test, testExportingUnknownStyleInRedline) CPPUNIT_TEST_FIXTURE(Test, testTdf148026) { - loadAndReload("tdf148026.fodt"); + createSwDoc("tdf148026.fodt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 @@ -850,7 +859,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148026) CPPUNIT_TEST_FIXTURE(Test, testTdf153664) { - loadAndReload("Table-of-Figures.odt"); + createSwDoc("Table-of-Figures.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlStyles = parseExport(u"word/styles.xml"_ustr); CPPUNIT_ASSERT(pXmlStyles); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx index 1e5552b7a4b5..b6fd0c873259 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx @@ -99,7 +99,8 @@ DECLARE_OOXMLEXPORT_TEST(testFdo80555, "fdo80555.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf104418) { - loadAndReload("tdf104418.odt"); + createSwDoc("tdf104418.odt"); + saveAndReload(mpFilter); // Problem was that <w:hideMark> cell property was ignored. uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), @@ -217,7 +218,8 @@ DECLARE_OOXMLEXPORT_TEST(testFdo85542, "fdo85542.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf65955) { - loadAndReload("tdf65955.odt"); + createSwDoc("tdf65955.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), @@ -240,7 +242,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf65955) CPPUNIT_TEST_FIXTURE(Test, testTdf65955_2) { - loadAndReload("tdf65955_2.odt"); + createSwDoc("tdf65955_2.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), @@ -662,7 +665,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf99140) CPPUNIT_TEST_FIXTURE(Test, testTableMarginAdjustment) { - loadAndReload("table.fodt"); + createSwDoc("table.fodt"); + saveAndReload(mpFilter); // Writer, (new) Word: margin 0 means table border starts at 0 // (old) Word: margin 0 means paragraph in table starts at 0 @@ -750,7 +754,8 @@ DECLARE_OOXMLEXPORT_TEST(testTableCellMargin, "table-cell-margin.docx") CPPUNIT_TEST_FIXTURE(Test, TestPuzzleExport) { - loadAndReload("TestPuzzleExport.odt"); + createSwDoc("TestPuzzleExport.odt"); + saveAndReload(mpFilter); // See tdf#148342 for details // Create a metafile auto pMeta = getSwDocShell()->GetPreviewMetaFile(); @@ -979,7 +984,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf138093) CPPUNIT_TEST_FIXTURE(Test, testTdf138093B) { - loadAndReload("tdf138093B.docx"); + createSwDoc("tdf138093B.docx"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); assertXPath(pXmlDoc, "//w:sdt", 3); @@ -1138,7 +1144,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf156372, "tdf156372.doc") CPPUNIT_TEST_FIXTURE(Test, testTdf156548) { // Given a document using two bookmarks with similar names longer than 40 characters - loadAndReload("longBookmarkName.fodt"); + createSwDoc("longBookmarkName.fodt"); + saveAndReload(mpFilter); // After the export, the names must be no longer than 40 characters; they must be unique; // and the hyperlinks must use the same names, to still point to the correct targets: diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index f5d9efc4f516..96fb290dd764 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -43,7 +43,8 @@ public: CPPUNIT_TEST_FIXTURE(Test, testPageGraphicBackground) { - loadAndReload("page-graphic-background.odt"); + createSwDoc("page-graphic-background.odt"); + saveAndReload(mpFilter); validate(maTempFile.GetFileName(), mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // No idea how the graphic background should be exported (seems there is no @@ -180,7 +181,8 @@ CPPUNIT_TEST_FIXTURE(Test, testZoom) CPPUNIT_TEST_FIXTURE(Test, defaultTabStopNotInStyles) { - loadAndReload("empty.odt"); + createSwDoc("empty.odt"); + saveAndReload(mpFilter); validate(maTempFile.GetFileName(), mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // The default tab stop was mistakenly exported to a style. @@ -258,7 +260,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo38244) CPPUNIT_TEST_FIXTURE(Test, testCommentsNested) { - loadAndReload("comments-nested.odt"); + createSwDoc("comments-nested.odt"); + saveAndReload(mpFilter); validate(maTempFile.GetFileName(), mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<beans::XPropertySet> xOuter = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), u"TextField"_ustr); @@ -270,20 +273,23 @@ CPPUNIT_TEST_FIXTURE(Test, testCommentsNested) CPPUNIT_TEST_FIXTURE(Test, testMathEscape) { - loadAndReload("math-escape.docx"); + createSwDoc("math-escape.docx"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(u"\{ \[ \] \( \) \}"_ustr, getFormula(getRun(getParagraph(1), 1))); } // Saving left and right for parentheses when importing not from the m:t tag (docx) CPPUNIT_TEST_FIXTURE(Test, testTdf158023Export) { - loadAndReload("tdf158023_export.docx"); + createSwDoc("tdf158023_export.docx"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(u"left [ right ] left ( right ) left lbrace right rbrace"_ustr, getFormula(getRun(getParagraph(1), 1))); } CPPUNIT_TEST_FIXTURE(Test, testFdo51034) { - loadAndReload("fdo51034.odt"); + createSwDoc("fdo51034.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // The problem was that the 'l' param of the HYPERLINK field was parsed with = "#", not += "#". CPPUNIT_ASSERT_EQUAL(u"http://Www.google.com/#a"_ustr, getProperty<OUString>(getRun(getParagraph(1), 1), u"HyperLinkURL"_ustr)); @@ -336,7 +342,8 @@ DECLARE_OOXMLEXPORT_TEST(testMathMatrix, "math-matrix.docx") CPPUNIT_TEST_FIXTURE(Test, testMathMso2k7) { - loadAndReload("math-mso2k7.docx"); + createSwDoc("math-mso2k7.docx"); + saveAndReload(mpFilter); CHECK_FORMULA(u"A \"=\" \u03C0 {r} ^ {2}"_ustr, getFormula(getRun(getParagraph(1), 1))); // TODO check the stack/binom difference // CHECK_FORMULA( "{left (x+a right )} ^ {n} = sum from {k=0} to {n} {left (binom {n} {k} right ) {x} ^ {k} {a} ^ {n-k}}", @@ -434,7 +441,8 @@ DECLARE_OOXMLEXPORT_TEST(testMathVerticalStacks, "math-vertical_stacks.docx") CPPUNIT_TEST_FIXTURE(Test, testTable) { - loadAndReload("table.odt"); + createSwDoc("table.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Make sure we write qFormat for well-known style names. xmlDocUniquePtr pXmlDocCT = parseExport(u"word/styles.xml"_ustr); @@ -517,7 +525,8 @@ DECLARE_OOXMLEXPORT_TEST(testTableBorders, "table-borders.docx") CPPUNIT_TEST_FIXTURE(Test, testFdo51550) { - loadAndReload("fdo51550.odt"); + createSwDoc("fdo51550.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); // The problem was that we lacked the fallback to export the replacement @@ -558,7 +567,8 @@ DECLARE_OOXMLEXPORT_TEST(test1Table1Page, "1-table-1-page.docx") CPPUNIT_TEST_FIXTURE(Test, testTextFrames) { - loadAndReload("textframes.odt"); + createSwDoc("textframes.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // The frames were simply missing, so let's check if all 3 frames were imported back. CPPUNIT_ASSERT_EQUAL(3, getShapes()); @@ -665,7 +675,8 @@ DECLARE_OOXMLEXPORT_TEST(testMathLiteral, "math-literal.docx") CPPUNIT_TEST_FIXTURE(Test, testFdo48557) { - loadAndReload("fdo48557.odt"); + createSwDoc("fdo48557.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); // Inner margins of the textframe wasn't exported. @@ -858,7 +869,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo66543) CPPUNIT_TEST_FIXTURE(Test, testN822175) { - loadAndReload("n822175.odt"); + createSwDoc("n822175.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY); @@ -891,7 +903,8 @@ DECLARE_OOXMLEXPORT_TEST(testFdo66773, "fdo66773.docx") CPPUNIT_TEST_FIXTURE(Test, testFdo58577) { - loadAndReload("fdo58577.odt"); + createSwDoc("fdo58577.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // The second frame was simply missing, so let's check if both frames were imported back. CPPUNIT_ASSERT_EQUAL(2, getShapes()); @@ -899,7 +912,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo58577) CPPUNIT_TEST_FIXTURE(Test, testBnc581614) { - loadAndReload("bnc581614.doc"); + createSwDoc("bnc581614.doc"); + saveAndReload(mpFilter); uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xFrame, u"FillStyle"_ustr)); } @@ -985,7 +999,8 @@ DECLARE_OOXMLEXPORT_TEST(testFdo66781, "fdo66781.docx") CPPUNIT_TEST_FIXTURE(Test, testFdo60990) { - loadAndReload("fdo60990.odt"); + createSwDoc("fdo60990.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); // The shape had no background, no paragraph adjust and no font color. @@ -1168,7 +1183,8 @@ DECLARE_OOXMLEXPORT_TEST(testBnc837302, "bnc837302.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf162070Export) { - loadAndReload("tdf162070_export.docx"); + createSwDoc("tdf162070_export.docx"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(u"{P} rsub {\"abs\"} \"~\" {B} rsub {0} \u00B2"_ustr, getFormula(getRun(getParagraph(1), 1))); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx index b4906a7a49be..43e5812f452d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx @@ -350,7 +350,8 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo79969_xlsm) CPPUNIT_TEST_FIXTURE(Test, testfdo80522) { - loadAndReload("fdo80522.docx"); + createSwDoc("fdo80522.docx"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"[Content_Types].xml"_ustr); assertXPath(pXmlDoc, @@ -371,7 +372,8 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo80522) CPPUNIT_TEST_FIXTURE(Test, testfdo80523_pptm) { - loadAndReload("fdo80523_pptm.docx"); + createSwDoc("fdo80523_pptm.docx"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"[Content_Types].xml"_ustr); assertXPath(pXmlDoc, @@ -392,7 +394,8 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo80523_pptm) CPPUNIT_TEST_FIXTURE(Test, testfdo80523_sldm) { - loadAndReload("fdo80523_sldm.docx"); + createSwDoc("fdo80523_sldm.docx"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"[Content_Types].xml"_ustr); assertXPath(pXmlDoc, @@ -632,7 +635,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf89774) CPPUNIT_TEST_FIXTURE(Test, testSectionProtection) { - loadAndReload("sectionprot.odt"); + createSwDoc("sectionprot.odt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr/w:formProt", "val", u"true"); assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:formProt", "val", u"false"); @@ -753,7 +757,8 @@ CPPUNIT_TEST_FIXTURE(Test, tdf89991_revisionView) CPPUNIT_TEST_FIXTURE(Test, tdf122201_editUnprotectedText) { - loadAndReload("tdf122201_editUnprotectedText.odt"); + createSwDoc("tdf122201_editUnprotectedText.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); // get the document @@ -774,7 +779,8 @@ CPPUNIT_TEST_FIXTURE(Test, tdf122201_editUnprotectedText) CPPUNIT_TEST_FIXTURE(Test, testSectionHeader) { - loadAndReload("sectionprot.odt"); + createSwDoc("sectionprot.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // this test must not be zero @@ -783,7 +789,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSectionHeader) CPPUNIT_TEST_FIXTURE(Test, testTdf146491) { - loadAndReload("tdf146491.odt"); + createSwDoc("tdf146491.odt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // This was 12 - a page style was unnecessarily created for every section. assertXPath(pXmlDoc, "//w:footerReference", 1); @@ -791,7 +798,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146491) CPPUNIT_TEST_FIXTURE(Test, testOO47778_1) { - loadAndReload("ooo47778-3.odt"); + createSwDoc("ooo47778-3.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(5, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); @@ -800,7 +808,8 @@ CPPUNIT_TEST_FIXTURE(Test, testOO47778_1) CPPUNIT_TEST_FIXTURE(Test, testOO47778_2) { - loadAndReload("ooo47778-4.odt"); + createSwDoc("ooo47778-4.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); @@ -817,7 +826,8 @@ CPPUNIT_TEST_FIXTURE(Test, testOO47778_2) CPPUNIT_TEST_FIXTURE(Test, testOO67471) { - loadAndReload("ooo67471-2.odt"); + createSwDoc("ooo67471-2.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); assertXPathContent(pXmlDoc, "(//w:t)[2]", u"B"); @@ -825,7 +835,8 @@ CPPUNIT_TEST_FIXTURE(Test, testOO67471) CPPUNIT_TEST_FIXTURE(Test, testKDE302504) { - loadAndReload("kde302504-1.odt"); + createSwDoc("kde302504-1.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); @@ -834,7 +845,8 @@ CPPUNIT_TEST_FIXTURE(Test, testKDE302504) CPPUNIT_TEST_FIXTURE(Test, testKDE216114) { - loadAndReload("kde216114-1.odt"); + createSwDoc("kde216114-1.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); @@ -843,7 +855,8 @@ CPPUNIT_TEST_FIXTURE(Test, testKDE216114) CPPUNIT_TEST_FIXTURE(Test, testOO72950) { - loadAndReload("ooo72950-1.odt"); + createSwDoc("ooo72950-1.odt"); + saveAndReload(mpFilter); CPPUNIT_ASSERT_EQUAL(1, getPages()); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); assertXPath(pXmlDoc, "//w:tbl", 1); @@ -1150,7 +1163,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf158971) CPPUNIT_TEST_FIXTURE(Test, testTdf158451) { //Without the test, crash occurs when document loads - loadAndReload("tdf158451.docx"); + createSwDoc("tdf158451.docx"); + saveAndReload(mpFilter); //Asserts document contains grouped shapes with Anchor = "As Character" CPPUNIT_ASSERT_EQUAL(1, getPages()); CPPUNIT_ASSERT_EQUAL(1, getShapes()); @@ -1168,7 +1182,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160827, "tdf160827.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf159110) { // Given a text with an URL with multiple spaces - loadAndReload("multi_space_url.fodt"); + createSwDoc("multi_space_url.fodt"); + saveAndReload(mpFilter); static constexpr OUString sExpectedURL = u"http://www.example.org/path%20%20with%20%20spaces"_ustr; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 5ee973c1ebb6..6024dfffe028 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -953,7 +953,8 @@ CPPUNIT_TEST_FIXTURE(Test, testEmptyObjectRange) CPPUNIT_TEST_FIXTURE(Test, testTdf161509) { - loadAndReload("special_styles.docx"); + createSwDoc("special_styles.docx"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlStyles = parseExport(u"word/styles.xml"_ustr); CPPUNIT_ASSERT(pXmlStyles); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport23.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport23.cxx index 3ea202f33aa0..df1dd494377f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport23.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport23.cxx @@ -148,7 +148,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf124367, "tdf124367.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf95189) { - loadAndReload("tdf95189.docx"); + createSwDoc("tdf95189.docx"); + saveAndReload(mpFilter); { uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(u"1"_ustr, getProperty<OUString>(xPara, u"ListLabelString"_ustr)); @@ -219,7 +220,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128889) CPPUNIT_TEST_FIXTURE(Test, testTdf132754) { - loadAndReload("tdf132754.docx"); + createSwDoc("tdf132754.docx"); + saveAndReload(mpFilter); { uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(u"0.0.0."_ustr, getProperty<OUString>(xPara, u"ListLabelString"_ustr)); @@ -622,7 +624,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160518_ODT_compatible, CPPUNIT_TEST_FIXTURE(Test, testTdf160518_page_in_default_paragraph_style) { // default paragraph style contains hyphenation settings - loadAndReload("tdf160518_page_in_default_paragraph_style.fodt"); + createSwDoc("tdf160518_page_in_default_paragraph_style.fodt"); + saveAndReload(mpFilter); xmlDocUniquePtr pXmlDoc = parseExport(u"word/settings.xml"_ustr); assertXPath(pXmlDoc, "/w:settings/w:compat/w:compatSetting[@w:name='useWord2013TrackBottomHyphenation']", @@ -634,7 +637,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf160518_page_in_default_paragraph_style) -e ... etc. - the rest is truncated
