sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 3 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 3 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 4 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 11 - sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 8 - sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 3 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 6 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 15 +- sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 27 ++- sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 12 + sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 3 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 3 sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx | 3 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 156 ++++++++++++++-------- sw/qa/extras/ooxmlexport/ooxmlw14export.cxx | 30 ++-- sw/qa/inc/swmodeltestbase.hxx | 1 16 files changed, 188 insertions(+), 100 deletions(-)
New commits: commit b30c68faacd8f970a8df8cd4283a3121f5d7fe53 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Nov 25 20:14:32 2021 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Nov 26 08:44:16 2021 +0100 sw: remove remaining uses of DECLARE_OOXMLEXPORT_EXPORTONLY_TEST See commit a226cec52e536c46e03f57a5f1f7931abbeb0cdd (CppunitTest_sw_rtfimport: convert one testcase to use CPPUNIT_TEST_FIXTURE(), 2019-11-05) for motivation. Change-Id: I45ca8709afb434cbd0c093a105fa560d0175f8b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125849 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 3b818ce98b57..ea347118e83b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -271,8 +271,9 @@ CPPUNIT_TEST_FIXTURE(Test, testShapeInFloattable) assertXPath(pXmlDoc, "/w:document/w:body/w:tbl", 1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testEmptyAnnotationMark, "empty-annotation-mark.docx") +CPPUNIT_TEST_FIXTURE(Test, testEmptyAnnotationMark) { + loadAndReload("empty-annotation-mark.docx"); // Delete the word that is commented, and save again. uno::Reference<text::XTextRange> xRun = getRun(getParagraph(1), 3); CPPUNIT_ASSERT_EQUAL(OUString("with"), xRun->getString()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 985b378912f0..a390cb5d4713 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -376,8 +376,9 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx") CPPUNIT_ASSERT(aTocString.startsWithIgnoreAsciiCase( "15" ) ); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73389,"fdo73389.docx") +CPPUNIT_TEST_FIXTURE(Test, testFdo73389) { + loadAndSave("fdo73389.docx"); // The width of the inner table was too large. The first fix still converted // the "auto" table width to a fixed one. The second fix used variable width. // The recent fix uses fixed width again, according to the fixed width cells. diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 1416f59fcbc6..b856edff8d9d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -211,9 +211,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTableCrossReference) CPPUNIT_ASSERT_EQUAL(sal_uInt16(8), nIndex); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableCrossReferenceCustomFormat, - "table_cross_reference_custom_format.odt") +CPPUNIT_TEST_FIXTURE(Test, testTableCrossReferenceCustomFormat) { + loadAndReload("table_cross_reference_custom_format.odt"); CPPUNIT_ASSERT_EQUAL(1, getPages()); // tdf#42346: Cross references to tables were not saved // Check also captions with custom formatting diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 23bebc3775ca..e4e35971bc72 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -1381,9 +1381,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108505) getProperty<OUString>(xText, "CharFontName")); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorHeightFromTopMarginHasHeader, - "tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx") +CPPUNIT_TEST_FIXTURE(Test, testRelativeAnchorHeightFromTopMarginHasHeader) { + loadAndReload("tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx"); // tdf#123324 The height was set relative to page print area top, // but this was handled relative to page height. // Note: page print area top = margin + header height. @@ -1392,9 +1392,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorHeightFromTopMarginHasHead assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "height", "2551"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorHeightFromTopMarginNoHeader, - "tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx") +CPPUNIT_TEST_FIXTURE(Test, testRelativeAnchorHeightFromTopMarginNoHeader) { + loadAndReload("tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx"); // tdf#123324 The height was set relative from top margin, but this was handled relative from page height. // Note: the MSO Word margin = LO margin + LO header height. // In this case the header does not exist, so MSO Word margin and LO Writer margin are the same. @@ -1407,8 +1407,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorHeightFromTopMarginNoHeade assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "height", "2551"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf64531,"tdf64531.docx") +CPPUNIT_TEST_FIXTURE(Test, testTdf64531) { + loadAndReload("tdf64531.docx"); xmlDocUniquePtr pXmlDoc= parseExport("word/document.xml"); OString sPathToTabs= "/w:document/w:body/w:sdt/w:sdtContent/w:p[2]/w:pPr/w:tabs/"; assertXPath(pXmlDoc, sPathToTabs+"w:tab[1]", "pos","720"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index b67962568ba8..d98671d9ff82 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -73,9 +73,9 @@ protected: } }; -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf143860NonPrimitiveCustomShape, - "tdf143860_NonPrimitiveCustomShape.odt") +CPPUNIT_TEST_FIXTURE(Test, testTdf143860NonPrimitiveCustomShape) { + loadAndReload("tdf143860_NonPrimitiveCustomShape.odt"); 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 @@ -121,9 +121,9 @@ CPPUNIT_TEST_FIXTURE(Test, testWrapPolygonLineShape) CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nXCoord); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testWrapPolygonCustomShape, - "tdf142433_WrapPolygonCustomShape.odt") +CPPUNIT_TEST_FIXTURE(Test, testWrapPolygonCustomShape) { + loadAndReload("tdf142433_WrapPolygonCustomShape.odt"); 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 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index c711a6b2a10b..c991bdf87f13 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -48,8 +48,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135164_cancelledNumbering, "tdf135164_cancelledN CPPUNIT_ASSERT_EQUAL(OUString("i"), getProperty<OUString>(xPara, "ListLabelString")); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf135906, "tdf135906.docx") +CPPUNIT_TEST_FIXTURE(Test, testTdf135906) { + loadAndSave("tdf135906.docx"); // just test round-tripping. The document was exported as corrupt and didn't re-load. } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index f9285288b3ae..3b204274ad5b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -818,8 +818,9 @@ CPPUNIT_TEST_FIXTURE(Test, testFootnoteParagraphTag) assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]/w:p/w:r/w:footnoteRef", 1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSpacingLineRule,"table_lineRule.docx") +CPPUNIT_TEST_FIXTURE(Test, testSpacingLineRule) { + loadAndReload("table_lineRule.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "lineRule", "auto"); } @@ -1016,8 +1017,9 @@ CPPUNIT_TEST_FIXTURE(Test, testCrashWhileSave) CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:ftr/w:tbl/w:tr/w:tc[1]/w:p[1]/w:pPr/w:pStyle", "val").match("Normal")); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.docx") +CPPUNIT_TEST_FIXTURE(Test, testFileOpenInputOutputError) { + loadAndReload("floatingtbl_with_formula.docx"); // Docx containing Floating table with formula was giving "General input/output error" while opening in LibreOffice xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pStyle", "val", "Normal"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 5858eec46524..0bead93d1d8a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -204,8 +204,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTrackChangesParagraphProperties) assertXPathChildren(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pPrChange", 0); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testMsoSpt180, "mso-spt180.docx") +CPPUNIT_TEST_FIXTURE(Test, testMsoSpt180) { + loadAndReload("mso-spt180.docx"); uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); const uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xGroup->getByIndex(0), "CustomShapeGeometry"); OUString aType; @@ -257,8 +258,9 @@ DECLARE_OOXMLEXPORT_TEST(testTableRowDataDisplayedTwice,"table-row-data-displaye CPPUNIT_ASSERT_EQUAL(2, getPages()); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73556,"fdo73556.docx") +CPPUNIT_TEST_FIXTURE(Test, testFdo73556) { + loadAndSave("fdo73556.docx"); /* * The file contains a table with 3 columns * the gridcols are as follows: {1210, 1331, 1210} @@ -314,16 +316,18 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo76741) assertXPath(pXmlDoc, "//w:tblW", "type", "dxa"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73541,"fdo73541.docx") +CPPUNIT_TEST_FIXTURE(Test, testFdo73541) { + loadAndSave("fdo73541.docx"); // fdo#73541: The mirrored margins were not imported and mapped correctly in Page Layout // Hence <w:mirrorMargins /> tag was not exported back in settings.xml xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml"); assertXPath(pXmlDoc, "/w:settings/w:mirrorMargins"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo106029,"fdo106029.docx") +CPPUNIT_TEST_FIXTURE(Test, testFdo106029) { + loadAndSave("fdo106029.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml"); assertXPath(pXmlDoc, "/w:settings/w:compat/w:doNotExpandShiftReturn"); } @@ -534,8 +538,9 @@ CPPUNIT_TEST_FIXTURE(Test, testNumberedLists_StartingWithZero) assertXPath(pXmlDoc, "w:numbering/w:abstractNum[1]/w:lvl[1]/w:start", 0); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageBreak,"fdo74566.docx") +CPPUNIT_TEST_FIXTURE(Test, testPageBreak) { + loadAndReload("fdo74566.docx"); /* Break to next page was written into wrong paragraph as <w:pageBreakBefore />. * LO was not preserving Page Break as <w:br w:type="page" />. * Now after fix , LO writes Page Break as the new paragraph and also diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 081ac3252d31..cbd6e13f340d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -234,8 +234,9 @@ CPPUNIT_TEST_FIXTURE(Test, testFDO77890 ) assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:br", "type", "page"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testNumberedList,"NumberedList.docx") +CPPUNIT_TEST_FIXTURE(Test, testNumberedList) { + loadAndReload("NumberedList.docx"); //fdo74150:In document.xml, for pStyle = "NumberedList1", iLvl and numId was not preserved xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr[1]/w:pStyle", "val", "NumberedList1"); @@ -471,8 +472,9 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo78420) } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageBreakInFirstPara,"fdo77727.docx") +CPPUNIT_TEST_FIXTURE(Test, testPageBreakInFirstPara) { + loadAndReload("fdo77727.docx"); /* Break to next page was not exported if it is in first paragraph of the section. * Now after fix , LO writes Next Page Break and also preserves <w:br> tag. */ @@ -490,8 +492,9 @@ CPPUNIT_TEST_FIXTURE(Test, testFDO78284) "image/png"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78384,"fdo78384.docx") +CPPUNIT_TEST_FIXTURE(Test, testFDO78384) { + loadAndReload("fdo78384.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:rFonts","ascii","Wingdings"); } @@ -621,8 +624,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123262_textFootnoteSeparators, "tdf123262_textFo CPPUNIT_ASSERT( !getStyles("PageStyles")->hasByName("Converted1") ); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79668,"fdo79668.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo79668) { + loadAndReload("fdo79668.docx"); // fdo#79668: Document was Crashing on DebugUtil build while Saving // because of repeated attribute value in same element. xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); @@ -632,8 +636,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79668,"fdo79668.docx") assertXPath ( pXmlDoc, "/w:document/w:body/w:p[9]/w:pPr/w:pPrChange/w:pPr/w:shd", "fill", "FFFFFF" ); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78907,"fdo78907.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo78907) { + loadAndReload("fdo78907.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/w:br", "type", "page" ); @@ -641,8 +646,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78907,"fdo78907.docx") assertXPath ( pXmlDoc1, "/w:ftr[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl", 0 ); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(tdf118702,"tdf118702.odt") +CPPUNIT_TEST_FIXTURE(Test, tdf118702) { + loadAndReload("tdf118702.odt"); CPPUNIT_ASSERT_EQUAL(2, getPages()); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:sectPr/w:type", "val", "nextPage" ); @@ -904,8 +910,9 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo79969_xlsm) "Excel.SheetMacroEnabled.12"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80522,"fdo80522.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo80522) { + loadAndReload("fdo80522.docx"); xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, @@ -927,8 +934,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80522,"fdo80522.docx") "Word.DocumentMacroEnabled.12"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80523_pptm,"fdo80523_pptm.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo80523_pptm) { + loadAndReload("fdo80523_pptm.docx"); xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, @@ -950,8 +958,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80523_pptm,"fdo80523_pptm.docx") "PowerPoint.ShowMacroEnabled.12"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80523_sldm,"fdo80523_sldm.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo80523_sldm) { + loadAndReload("fdo80523_sldm.docx"); xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 9c9604cd9c8b..a13d3bba2373 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -124,8 +124,9 @@ DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, "dml-textshape.docx") } // testDmlTextshapeB was only made export-only because as an import-export test it failed for an unknown reason -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDmlTextshapeB, "dml-textshapeB.docx") +CPPUNIT_TEST_FIXTURE(Test, testDmlTextshapeB) { + loadAndReload("dml-textshapeB.docx"); uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(3), uno::UNO_QUERY); // Connector was incorrectly shifted towards the top left corner, X was 192, Y was -5743. @@ -888,8 +889,9 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo69616) CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[1]/mc:AlternateContent/mc:Fallback/w:pict/v:group", "coordorigin").match("696,725")); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignForShape,"Shape.docx") +CPPUNIT_TEST_FIXTURE(Test, testAlignForShape) { + loadAndReload("Shape.docx"); //fdo73545:Shape Horizontal and vertical orientation is wrong //The wp:align tag is missing after roundtrip xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); @@ -962,8 +964,9 @@ CPPUNIT_TEST_FIXTURE(Test, testLineStyle_DashType_VML) assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:stroke", "dashstyle", "dash"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo74110,"fdo74110.docx") +CPPUNIT_TEST_FIXTURE(Test, testFdo74110) { + loadAndReload("fdo74110.docx"); /* The File contains word art which is being exported as shape and the mapping is defaulted to shape type rect since the actual shape type(s) is/are commented out for some reason. @@ -976,8 +979,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo74110,"fdo74110.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]/a:avLst[1]/a:gd[1]",0); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOuterShdw,"testOuterShdw.docx") +CPPUNIT_TEST_FIXTURE(Test, testOuterShdw) { + loadAndReload("testOuterShdw.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "//mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:effectLst[1]/a:outerShdw[1]", "dist", "1041400"); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 59d713fdfb04..2459af818b9b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -489,8 +489,9 @@ DECLARE_OOXMLEXPORT_TEST(testTDF91122, "tdf91122.docx") } } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo76803, "fdo76803.docx") +CPPUNIT_TEST_FIXTURE(Test, testFdo76803) { + loadAndReload("fdo76803.docx"); // The ContourPolyPolygon was wrong uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 4416edc4ef69..efc541eeaf26 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -844,8 +844,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf79329, "tdf79329.docx") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xTables->getCount()); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf103982, "tdf103982.docx") +CPPUNIT_TEST_FIXTURE(Test, testTdf103982) { + loadAndReload("tdf103982.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); sal_Int32 nDistB = getXPath(pXmlDoc, "//wp:anchor", "distB").toInt32(); // This was -260350, which is not a valid value for an unsigned type. diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx index 9c9088dda817..7d09765db1b9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx @@ -24,8 +24,9 @@ protected: } }; -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSaveAsDotX, "sample.dotx") +CPPUNIT_TEST_FIXTURE(Test, testSaveAsDotX) { + loadAndReload("sample.dotx"); xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml"); // Ensure that document has correct content type diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 658830274534..5c0e0685ecec 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -64,8 +64,9 @@ DECLARE_OOXMLEXPORT_TEST(testN789482, "n789482.docx") getRun(xParagraph, 5, " After."); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBnc834035, "bnc834035.odt") +CPPUNIT_TEST_FIXTURE(Test, testBnc834035) { + loadAndReload("bnc834035.odt"); CPPUNIT_ASSERT_EQUAL(2, getShapes()); CPPUNIT_ASSERT_EQUAL(3, getPages()); // Illustration index had wrong hyperlinks: anchor was using Writer's @@ -83,8 +84,9 @@ DECLARE_OOXMLEXPORT_TEST(testCp1000015, "cp1000015.odt") getParagraph(2, "http://www.google.com/"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testHyperlineIsEnd, "hyperlink.docx") +CPPUNIT_TEST_FIXTURE(Test, testHyperlineIsEnd) { + loadAndReload("hyperlink.docx"); // Check that the document.xml contents all the tag properly closed. xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // If document.xml miss any ending tag then parseExport() returns NULL which fail the test case. @@ -93,16 +95,18 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testHyperlineIsEnd, "hyperlink.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:hyperlink",1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo69649, "fdo69649.docx") +CPPUNIT_TEST_FIXTURE(Test, testFdo69649) { + loadAndReload("fdo69649.docx"); // The DOCX containing the Table of Contents was not exported with correct page nos xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[21]/w:hyperlink/w:r[5]/w:t", "15"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFieldFlagO,"TOC_field_f.docx") +CPPUNIT_TEST_FIXTURE(Test, testFieldFlagO) { + loadAndReload("TOC_field_f.docx"); // This test case is to verify \o flag should come once. xmlDocUniquePtr pXmlDoc = parseExport(); @@ -111,8 +115,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFieldFlagO,"TOC_field_f.docx") assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[2]/w:instrText", " TOC \\z \\f \\o \"1-3\" \\u \\h"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTOCFlag_f, "toc_doc.docx") +CPPUNIT_TEST_FIXTURE(Test, testTOCFlag_f) { + loadAndReload("toc_doc.docx"); // Export logic for all TOC field flags was enclosed inside // if( SwTOXElement::Mark & pTOX->GetCreateType() ) in ww8atr.cxx which gets true for \f, // this was the reason if there is \f flag present in original doc then only other flags like @@ -126,22 +131,25 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTOCFlag_f, "toc_doc.docx") assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[2]/w:instrText", " TOC \\z \\o \"1-3\" \\u \\h"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPreserveZfield,"preserve_Z_field_TOC.docx") +CPPUNIT_TEST_FIXTURE(Test, testPreserveZfield) { + loadAndReload("preserve_Z_field_TOC.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[2]/w:instrText", " TOC \\z \\f \\o \"1-3\" \\h"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPreserveWfieldTOC, "PreserveWfieldTOC.docx") +CPPUNIT_TEST_FIXTURE(Test, testPreserveWfieldTOC) { + loadAndReload("PreserveWfieldTOC.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " TOC \\z \\w \\f \\o \"1-3\" \\h"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFieldFlagB,"TOC_field_b.docx") +CPPUNIT_TEST_FIXTURE(Test, testFieldFlagB) { + loadAndReload("TOC_field_b.docx"); // This test case is to verify \b flag. xmlDocUniquePtr pXmlDoc = parseExport(); @@ -150,22 +158,25 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFieldFlagB,"TOC_field_b.docx") assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[2]/w:instrText", " TOC \\b \"bookmark111\" \\o \"1-9\" \\h"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPreserveXfieldTOC, "PreserveXfieldTOC.docx") +CPPUNIT_TEST_FIXTURE(Test, testPreserveXfieldTOC) { + loadAndReload("PreserveXfieldTOC.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " TOC \\x \\f \\o \"1-3\" \\h"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO77715,"FDO77715.docx") +CPPUNIT_TEST_FIXTURE(Test, testFDO77715) { + loadAndReload("FDO77715.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/w:instrText[1]", " TOC \\c "); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTOCFlag_u,"testTOCFlag_u.docx") +CPPUNIT_TEST_FIXTURE(Test, testTOCFlag_u) { + loadAndReload("testTOCFlag_u.docx"); // DOCX containing TOC should preserve code field '\u'. xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); @@ -174,24 +185,27 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTOCFlag_u,"testTOCFlag_u.docx") assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " TOC \\z \\o \"1-9\" \\u \\h"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo73596_RunInStyle,"fdo73596_RunInStyle.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo73596_RunInStyle) { + loadAndReload("fdo73596_RunInStyle.docx"); // INDEX should be preserved. xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:instrText[1]", " INDEX \\e \""); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo73596_AlphaSeparator,"fdo73596_AlphaSeparator.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo73596_AlphaSeparator) { + loadAndReload("fdo73596_AlphaSeparator.docx"); // INDEX flag \h "A" should be preserved. xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:instrText[1]", " INDEX \\h \"A\" \\e \""); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption1, "EquationAsScientificNumbering.docx") +CPPUNIT_TEST_FIXTURE(Test, testCaption1) { + loadAndReload("EquationAsScientificNumbering.docx"); // fdo#74431 : This test case is to verify the Captions are coming properly // earlier it was coming as "SEQ "scientific"\*ROMAN now it is SEQ scientific\* ROMAN" @@ -200,8 +214,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption1, "EquationAsScientificNumbering assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[3]/w:instrText", " SEQ scientific \\* ROMAN "); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption2, "EquationWithAboveAndBelowCaption.docx") +CPPUNIT_TEST_FIXTURE(Test, testCaption2) { + loadAndReload("EquationWithAboveAndBelowCaption.docx"); // fdo#72563 : There was a problem that in case of TOC,PAGEREF field tag was not preserved during Roundtrip // This test case is to verify that PAGEREF tag is coming with proper values inside <hyperlink> tag. xmlDocUniquePtr pXmlDoc = parseExport(); @@ -209,8 +224,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption2, "EquationWithAboveAndBelowCapt assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[5]/w:r[3]/w:instrText", " SEQ Equation \\* ARABIC "); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption3, "FigureAsLabelPicture.docx") +CPPUNIT_TEST_FIXTURE(Test, testCaption3) { + loadAndReload("FigureAsLabelPicture.docx"); // fdo#72563 : There was a problem that in case of TOC,PAGEREF field tag was not preserved during Roundtrip // This test case is to verify that PAGEREF tag is coming with proper values inside <hyperlink> tag. xmlDocUniquePtr pXmlDoc = parseExport(); @@ -218,8 +234,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption3, "FigureAsLabelPicture.docx") assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[3]/w:instrText", " SEQ picture \\* ARABIC "); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption4, "TableWithAboveCaptions.docx") +CPPUNIT_TEST_FIXTURE(Test, testCaption4) { + loadAndReload("TableWithAboveCaptions.docx"); // fdo#72563 : There was a problem that in case of TOC,PAGEREF field tag was not preserved during Roundtrip // This test case is to verify that PAGEREF tag is coming with proper values inside <hyperlink> tag. xmlDocUniquePtr pXmlDoc = parseExport(); @@ -227,8 +244,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption4, "TableWithAboveCaptions.docx") assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/w:instrText", " SEQ Table \\* ARABIC "); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFooterContainHyperlink,"footer-contain-hyperlink.docx") +CPPUNIT_TEST_FIXTURE(Test, testFooterContainHyperlink) { + loadAndReload("footer-contain-hyperlink.docx"); // Problem is that footer1.xml.rels contains the empty // Target due to which the file get corrupted // in MS Office 2007. @@ -238,8 +256,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFooterContainHyperlink,"footer-contain-h assertXPath(pXmlRels,"/rels:Relationships/rels:Relationship","Target","http://www.google.com/"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlphabeticalIndex_MultipleColumns,"alphabeticalIndex_MultipleColumns.docx") +CPPUNIT_TEST_FIXTURE(Test, testAlphabeticalIndex_MultipleColumns) { + loadAndReload("alphabeticalIndex_MultipleColumns.docx"); // Bug :: fdo#73596 /* * Index with multiple columns was not imported correctly and @@ -259,8 +278,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlphabeticalIndex_MultipleColumns,"alpha assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:pPr/w:sectPr/w:cols","space","720"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageref, "testPageref.docx") +CPPUNIT_TEST_FIXTURE(Test, testPageref) { + loadAndReload("testPageref.docx"); // fdo#72563 : There was a problem that in case of TOC,PAGEREF field tag was not preserved during Roundtrip // This test case is to verify that PAGEREF tag is coming with proper values inside <hyperlink> tag. xmlDocUniquePtr pXmlDoc = parseExport(); @@ -268,8 +288,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageref, "testPageref.docx") assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[2]/w:hyperlink/w:r[3]/w:instrText", "PAGEREF _Toc355095261 \\h"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlphabeticalIndex_AutoColumn,"alphabeticalIndex_AutoColumn.docx") +CPPUNIT_TEST_FIXTURE(Test, testAlphabeticalIndex_AutoColumn) { + loadAndReload("alphabeticalIndex_AutoColumn.docx"); // Bug :: fdo#73596 /* * When the columns in Index are 0; i.e not specified by the @@ -284,8 +305,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlphabeticalIndex_AutoColumn,"alphabetic assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr", 0); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testIndexFieldFlagF,"IndexFieldFlagF.docx") +CPPUNIT_TEST_FIXTURE(Test, testIndexFieldFlagF) { + loadAndReload("IndexFieldFlagF.docx"); // This test case is to verify the Index field flag '\f' with some // Specific Entry Type (ex. "Syn" in our case). xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); @@ -297,8 +319,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testIndexFieldFlagF,"IndexFieldFlagF.docx") assertXPathContent(pXmlDoc, "/w:document[1]/w:body[1]/w:p[17]/w:r[29]/w:instrText[1]", " XE \"choosing:aaaa\" \\f \"Syn\" "); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBibliography,"FDO75133.docx") +CPPUNIT_TEST_FIXTURE(Test, testBibliography) { + loadAndReload("FDO75133.docx"); xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " BIBLIOGRAPHY "); @@ -306,8 +329,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBibliography,"FDO75133.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:docPartObj/w:docPartUnique", 1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGenericTextField, "Unsupportedtextfields.docx") +CPPUNIT_TEST_FIXTURE(Test, testGenericTextField) { + loadAndReload("Unsupportedtextfields.docx"); // fdo#75158 : This test case is to verify the unsupported textfields are exported properly. xmlDocUniquePtr pXmlDoc = parseExport(); @@ -319,8 +343,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGenericTextField, "Unsupportedtextfields xmlXPathFreeObject(pXmlObj); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_FieldType, "99_Fields.docx") +CPPUNIT_TEST_FIXTURE(Test, test_FieldType) { + loadAndReload("99_Fields.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Checking for three field types (BIBLIOGRAPHY, BIDIOUTLINE, CITATION) in sequence assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:instrText"); @@ -328,15 +353,17 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_FieldType, "99_Fields.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:sdt/w:sdtContent/w:r[2]/w:instrText"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCitation,"FDO74775.docx") +CPPUNIT_TEST_FIXTURE(Test, testCitation) { + loadAndReload("FDO74775.docx"); xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:sdt/w:sdtContent/w:r[2]/w:instrText", " CITATION Kra06 \\l 1033 "); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:sdt/w:sdtContent/w:r[4]/w:t", "(Kramer & Chen, 2006)"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testHyperLinkTagEnded, "fdo76316.docx") +CPPUNIT_TEST_FIXTURE(Test, testHyperLinkTagEnded) { + loadAndReload("fdo76316.docx"); /* XML tag <w:hyperlink> was not getting closed when its inside another * <w:hyperlink> tag. */ @@ -346,22 +373,25 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testHyperLinkTagEnded, "fdo76316.docx") assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[2]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[7]/w:tc[1]/w:tbl[1]/w:tr[2]/w:tc[6]/w:tbl[1]/w:tr[1]/w:tc[1]/w:p[1]/w:hyperlink[1]/w:hyperlink[1]",1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76163 , "fdo76163.docx") +CPPUNIT_TEST_FIXTURE(Test, testFDO76163 ) { + loadAndReload("fdo76163.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); //docx file after RT is getting corrupted. assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:hyperlink/w:r[10]/w:fldChar", "fldCharType", "end" ); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78659, "fdo78659.docx") +CPPUNIT_TEST_FIXTURE(Test, testFDO78659) { + loadAndReload("fdo78659.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:p[1]/w:hyperlink[1]/w:r[3]/w:fldChar[1]", 0); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78654 , "fdo78654.docx") +CPPUNIT_TEST_FIXTURE(Test, testFDO78654 ) { + loadAndReload("fdo78654.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // In case of two "Hyperlink" tags in one paragraph and one of them // contains "PAGEREF" field then field end tag was missing from hyperlink. @@ -369,8 +399,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78654 , "fdo78654.docx") } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78599,"fdo78599.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo78599) { + loadAndReload("fdo78599.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); //docx file after RT is getting corrupted. assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink/w:r[6]/w:fldChar", "fldCharType", "end" ); @@ -381,15 +412,17 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78599,"fdo78599.docx") assertXPath(pSettingsXml, "/w:settings/w:autoHyphenation"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78886, "fdo78886.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo78886) { + loadAndReload("fdo78886.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[2]/w:tr[1]/w:tc[1]/w:p[1]/w:hyperlink[1]/w:r[2]/w:fldChar[1]", 0); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo78910, "fdo78910.docx") +CPPUNIT_TEST_FIXTURE(Test, testFdo78910) { + loadAndReload("fdo78910.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // This is to ensure that the fld starts and ends inside a hyperlink... @@ -397,8 +430,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo78910, "fdo78910.docx") assertXPath ( pXmlDoc, "//w:hyperlink[2]/w:r[5]/w:fldChar", "fldCharType", "end" ); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78590, "FDO78590.docx") +CPPUNIT_TEST_FIXTURE(Test, testFDO78590) { + loadAndReload("FDO78590.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // This is to ensure that the fld starts and ends inside a hyperlink... @@ -406,8 +440,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78590, "FDO78590.docx") assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "h", "1669" ); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtCitationRun, "sdt-citation-run.docx") +CPPUNIT_TEST_FIXTURE(Test, testSdtCitationRun) { + loadAndReload("sdt-citation-run.docx"); // The problem was that the SDT was around the whole paragraph, not only around the citation field. xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/w:t", "Before sdt."); @@ -415,16 +450,18 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtCitationRun, "sdt-citation-run.docx") assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:t", "After sdt."); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testParagraphSdt, "paragraph-sdt.docx") +CPPUNIT_TEST_FIXTURE(Test, testParagraphSdt) { + loadAndReload("paragraph-sdt.docx"); // The problem was that the SDT was around the run only, not the whole paragraph. xmlDocUniquePtr pXmlDoc = parseExport(); // The path to w:sdt contained a w:p. assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:sdt"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdt2Run, "sdt-2-para.docx") +CPPUNIT_TEST_FIXTURE(Test, testSdt2Run) { + loadAndReload("sdt-2-para.docx"); xmlDocUniquePtr pXmlDoc = parseExport(); // The problem was that <w:sdt> was closed after "first", not after "second", so the second assert failed. assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r/w:t", "first"); @@ -433,15 +470,17 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdt2Run, "sdt-2-para.docx") assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r/w:t", "third"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test2Id, "2-id.docx") +CPPUNIT_TEST_FIXTURE(Test, test2Id) { + loadAndReload("2-id.docx"); xmlDocUniquePtr pXmlDoc = parseExport(); // This was 2, but only one w:id is allowed. assertXPath(pXmlDoc, "//w:sdtPr/w:id", 1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableStart2Sdt, "table-start-2-sdt.docx") +CPPUNIT_TEST_FIXTURE(Test, testTableStart2Sdt) { + loadAndReload("table-start-2-sdt.docx"); xmlDocUniquePtr pXmlDoc = parseExport(); // w:docPartGallery should be a child of <w:docPartObj>, make sure it's not a child of w:text. assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:text/w:docPartGallery", 0); @@ -468,14 +507,16 @@ DECLARE_OOXMLEXPORT_TEST(testSdtDateDuplicate, "sdt-date-duplicate.docx") CPPUNIT_ASSERT_EQUAL(OUString("4/26/2012"), pFieldmark->GetContent()); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo81492, "fdo81492.docx") +CPPUNIT_TEST_FIXTURE(Test, testFdo81492) { + loadAndReload("fdo81492.docx"); xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[6]/w:instrText", "ADDIN EN.CITE.DATA"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testEditTime, "fdo81341.docx") +CPPUNIT_TEST_FIXTURE(Test, testEditTime) { + loadAndReload("fdo81341.docx"); /* Issue was LO was not able to Import and Export EditTime in seconds format. * It was supporting Time in "HH:MM" format. But if DOCX contains Time in seconds, * then LO was not able to display time in "HH:MM:SS" format. @@ -489,8 +530,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testEditTime, "fdo81341.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[5]/w:fldChar", "fldCharType", "end"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFlyFieldmark, "fly_fieldmark.fodt") +CPPUNIT_TEST_FIXTURE(Test, testFlyFieldmark) { + loadAndReload("fly_fieldmark.fodt"); // the problem was that the flys were written after the field start xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // run 1 contains 2 shapes, one was at-page, one was at-char @@ -501,53 +543,60 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFlyFieldmark, "fly_fieldmark.fodt") assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/w:instrText", " FORMTEXT "); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo81945, "fdo81945.docx") +CPPUNIT_TEST_FIXTURE(Test, testFdo81945) { + loadAndReload("fdo81945.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "//w:sdt//w:sdt", 0); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo82123, "fdo82123.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo82123) { + loadAndReload("fdo82123.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // make sure there is only one run inside first SDT after RT as in the Original file. assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:p/w:sdt[1]/w:sdtContent/w:r",1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtBeforeField, "sdt-before-field.docx") +CPPUNIT_TEST_FIXTURE(Test, testSdtBeforeField) { + loadAndReload("sdt-before-field.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Make sure the field doesn't sneak inside the SDT: the SDT should contain only a single run (there were 6 ones). assertXPath(pXmlDoc, "//w:sdt/w:sdtContent/w:r", 1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo81946, "fdo81946.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo81946) { + loadAndReload("fdo81946.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/header1.xml"); // make sure AlternateContent should not present in sdt assertXPath(pXmlDoc, "/w:hdr[1]/w:p[1]/w:sdt[1]/w:sdtContent[1]/w:r[2]/mc:AlternateContent[1]",0); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo82492, "fdo82492.docx") +CPPUNIT_TEST_FIXTURE(Test, testfdo82492) { + loadAndReload("fdo82492.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // make sure there is only one run inside first SDT after RT as in the Original file. assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt[1]/w:sdtContent/w:r",1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtHeader, "sdt-header.docx") +CPPUNIT_TEST_FIXTURE(Test, testSdtHeader) { + loadAndReload("sdt-header.docx"); // Problem was that w:sdt elements in headers were lost on import. xmlDocUniquePtr pXmlDoc = parseExport("word/header2.xml"); // This was 0, w:sdt (and then w:date) was missing. assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:date", 1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtCompanyMultipara, "sdt-company-multipara.docx") +CPPUNIT_TEST_FIXTURE(Test, testSdtCompanyMultipara) { + loadAndReload("sdt-company-multipara.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // This was 3, but multiple paragraphs inside "Company" SDT is now allowed. assertXPath(pXmlDoc, "//w:sdtContent/w:p", 1); @@ -600,8 +649,9 @@ DECLARE_OOXMLEXPORT_TEST( testTdf85161, "tdf85161.docx" ) CPPUNIT_ASSERT_EQUAL(OUString(u'\x5e'),getParagraph(1)->getString()); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf66401, "tdf66401.docx") +CPPUNIT_TEST_FIXTURE(Test, testTdf66401) { + loadAndReload("tdf66401.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/w:rPr/w:rFonts", 1); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/w:rPr/w:rFonts", "ascii", "Arial Black"); @@ -671,8 +721,9 @@ DECLARE_OOXMLEXPORT_TEST(testDropDownFieldEntryLimit, "tdf126792.odt" ) CPPUNIT_ASSERT_EQUAL(sal_Int32(25), vListEntries.getLength()); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf132185, "tdf132185.docx") +CPPUNIT_TEST_FIXTURE(Test, testTdf132185) { + loadAndReload("tdf132185.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/footer1.xml"); // Since the default (without xml:space attribute) is to ignore leading and trailing spaces, // " PAGE \\* roman " will get imported as "PAGE \\* roman". This is also valid, and must be @@ -680,8 +731,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf132185, "tdf132185.docx") assertXPathContent(pXmlDoc, "/w:ftr/w:p/w:r[2]/w:instrText", " PAGE \\* roman "); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testConditionalText, "conditional-text.fodt") +CPPUNIT_TEST_FIXTURE(Test, testConditionalText) { + loadAndReload("conditional-text.fodt"); // Load a document which has a conditional text field in it. xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); std::u16string_view aExpected(u" IF 1 < 2 \"True\" \"False\""); diff --git a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx index 157939060024..e508e2d08145 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx @@ -24,8 +24,9 @@ protected: } }; -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_GlowShadowReflection, "TextEffects_Glow_Shadow_Reflection.docx") +CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_GlowShadowReflection) { + loadAndReload("TextEffects_Glow_Shadow_Reflection.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/w:rPr/w14:glow", "rad").match("63500")); @@ -91,8 +92,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_GlowShadowReflection, "Text CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[7]/w:rPr/w14:reflection", "algn").match("bl")); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_TextOutline, "TextEffects_TextOutline.docx") +CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_TextOutline) { + loadAndReload("TextEffects_TextOutline.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Paragraph 1 @@ -146,8 +148,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_TextOutline, "TextEffects_T assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:rPr/w14:textOutline/w14:bevel", 1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_TextFill, "TextEffects_TextFill.docx") +CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_TextFill) { + loadAndReload("TextEffects_TextFill.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Paragraph 1 has no textFill @@ -183,8 +186,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_TextFill, "TextEffects_Text assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w14:textFill/w14:gradFill/w14:lin", "scaled", "0"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_Props3d_Ligatures_NumForm_NumSpacing, "TextEffects_Props3d_Ligatures_NumForm_NumSpacing.docx") +CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_Props3d_Ligatures_NumForm_NumSpacing) { + loadAndReload("TextEffects_Props3d_Ligatures_NumForm_NumSpacing.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Paragraph 1 - w14:props3d @@ -228,8 +232,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_Props3d_Ligatures_NumForm_N assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[4]/w:rPr/w14:numSpacing", "val", "proportional"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_StylisticSets_CntxtAlts, "TextEffects_StylisticSets_CntxtAlts.docx") +CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_StylisticSets_CntxtAlts) { + loadAndReload("TextEffects_StylisticSets_CntxtAlts.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Paragraph 1 - w14:stylisticSets @@ -244,8 +249,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_StylisticSets_CntxtAlts, "T } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_McIgnorable, "TextEffects_StylisticSets_CntxtAlts.docx") +CPPUNIT_TEST_FIXTURE(Test, Test_McIgnorable) { + loadAndReload("TextEffects_StylisticSets_CntxtAlts.docx"); xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); assertXPath(pXmlDocument, "/w:document", "Ignorable", "w14 wp14"); @@ -255,8 +261,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_McIgnorable, "TextEffects_StylisticSets assertXPath(pXmlStyles, "/w:styles", "Ignorable", "w14"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_CompatSettingsForW14, "TextEffects_StylisticSets_CntxtAlts.docx") +CPPUNIT_TEST_FIXTURE(Test, Test_CompatSettingsForW14) { + loadAndReload("TextEffects_StylisticSets_CntxtAlts.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml"); assertXPath(pXmlDoc, "/w:settings/w:compat/w:compatSetting", 5); @@ -282,8 +289,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_CompatSettingsForW14, "TextEffects_Styl assertXPath(pXmlDoc, "/w:settings/w:compat/w:compatSetting[5]", "val", "1"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_Groupshapes, "TextEffects_Groupshapes.docx") +CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_Groupshapes) { + loadAndReload("TextEffects_Groupshapes.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); OString sPathToWGP = "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp"; @@ -395,8 +403,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_Groupshapes, "TextEffects_G assertXPath(pXmlDoc, sPathStylisticSets+"/w14:styleSet", "id", "1"); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_InStyleXml, "TextEffects_InStyle.docx") +CPPUNIT_TEST_FIXTURE(Test, Test_TextEffects_InStyleXml) { + loadAndReload("TextEffects_InStyle.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml"); OString sPathToCharacterStyle = "/w:styles/w:style[3]"; @@ -622,8 +631,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_InStyleXml, "TextEffects_In } } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_no_tag_if_no_fill, "tdf112103_tablebgnofill.docx") +CPPUNIT_TEST_FIXTURE(Test, Test_no_tag_if_no_fill) { + loadAndReload("tdf112103_tablebgnofill.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:shd", 0); diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 65b673789a78..67cfce35117d 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -78,7 +78,6 @@ void TestName::verify() #define DECLARE_OOXMLEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test) -#define DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(TestName, filename) DECLARE_SW_EXPORTONLY_TEST(TestName, filename, nullptr, Test) #define DECLARE_RTFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test) #define DECLARE_ODFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test) #define DECLARE_ODFEXPORT_EXPORTONLY_TEST(TestName, filename) DECLARE_SW_EXPORTONLY_TEST(TestName, filename, nullptr, Test)