diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-11-06 21:31:54 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-11-07 08:27:19 +0100 |
commit | 1129c848b360bd76174c941bb8fd98bfa5b9119c (patch) | |
tree | baa27d289745b29693d88203f9d4bc75498ba1ea | |
parent | c503fc6e478510f0fec72cd88b776ca683a00021 (diff) |
sw: convert remaining uses of DECLARE_RTFIMPORT_TEST()
See commit a226cec52e536c46e03f57a5f1f7931abbeb0cdd
(CppunitTest_sw_rtfimport: convert one testcase to use
CPPUNIT_TEST_FIXTURE(), 2019-11-05) for motivation.
Change-Id: Icef8d75ac759480e841363142c474b95544bcf0e
Reviewed-on: https://gerrit.libreoffice.org/82176
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | sw/qa/extras/inc/swmodeltestbase.hxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport4.cxx | 9 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport5.cxx | 3 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 273 |
4 files changed, 190 insertions, 96 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index af6f492d90f3..4e3f1eda0eeb 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -103,7 +103,6 @@ using namespace css; #define DECLARE_OOXMLIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, nullptr, Test) #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_RTFIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, nullptr, Test) #define DECLARE_RTFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test) #define DECLARE_ODFIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, nullptr, Test) #define DECLARE_ODFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test) diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index bcac3b291cb7..a7116ba7dd79 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -138,8 +138,9 @@ DECLARE_RTFEXPORT_TEST(testCjklist34, "cjklist34.rtf") CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_UPPER_ZH_TW, numFormat); } -DECLARE_RTFIMPORT_TEST(testTabStopFillChars, "tab-stop-fill-chars.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTabStopFillChars) { + load(mpTestDocumentPath, "tab-stop-fill-chars.rtf"); // tlmdot auto aTabstops = getProperty<uno::Sequence<style::TabStop>>(getParagraph(1), "ParaTabStops"); CPPUNIT_ASSERT(aTabstops.hasElements()); @@ -207,8 +208,9 @@ DECLARE_RTFEXPORT_TEST(testBtlrFrame, "btlr-frame.odt") CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, nActual); } -DECLARE_RTFIMPORT_TEST(testPageBorder, "page-border.rtf") +CPPUNIT_TEST_FIXTURE(Test, testPageBorder) { + load(mpTestDocumentPath, "page-border.rtf"); uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); auto aTopBorder = getProperty<table::BorderLine2>(xPageStyle, "TopBorder"); @@ -236,8 +238,9 @@ DECLARE_RTFEXPORT_TEST(testTbrlPage, "tbrl-page.rtf") CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, nActual); } -DECLARE_RTFIMPORT_TEST(testTdf126309, "tdf126309.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf126309) { + load(mpTestDocumentPath, "tdf126309.rtf"); // Without the accompanying fix in place, this test would have failed, as // the paragraph was aligned to left, not right. CPPUNIT_ASSERT_EQUAL( diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 9ea411fae888..e74e79073348 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -181,8 +181,9 @@ DECLARE_RTFEXPORT_TEST(testParaBottomMargin, "para-bottom-margin.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin")); } -DECLARE_RTFIMPORT_TEST(testParaStyleBottomMargin2, "para-style-bottom-margin-2.rtf") +CPPUNIT_TEST_FIXTURE(Test, testParaStyleBottomMargin2) { + load(mpTestDocumentPath, "para-style-bottom-margin-2.rtf"); uno::Reference<beans::XPropertySet> xPropertySet( getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(353), getProperty<sal_Int32>(xPropertySet, "ParaBottomMargin")); diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index ba19786d4fa2..d13ba58410f2 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -109,14 +109,16 @@ CPPUNIT_TEST_FIXTURE(Test, testN695479) CPPUNIT_ASSERT(bDrawFound); } -DECLARE_RTFIMPORT_TEST(testTdf117246, "tdf117246.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf117246) { + load(mpTestDocumentPath, "tdf117246.rtf"); // This was 2, all but the last \page was lost. CPPUNIT_ASSERT_EQUAL(3, getPages()); } -DECLARE_RTFIMPORT_TEST(testTdf108943, "tdf108943.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf108943) { + load(mpTestDocumentPath, "tdf108943.rtf"); uno::Reference<beans::XPropertySet> xPropertySet( getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xLevels( @@ -136,8 +138,9 @@ DECLARE_RTFIMPORT_TEST(testTdf108943, "tdf108943.rtf") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nListtabStopPosition); } -DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo46662) { + load(mpTestDocumentPath, "fdo46662.rtf"); uno::Reference<beans::XPropertySet> xPropertySet( getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xLevels( @@ -156,22 +159,25 @@ DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf") } } -DECLARE_RTFIMPORT_TEST(testTdf115715, "tdf115715.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf115715) { + load(mpTestDocumentPath, "tdf115715.rtf"); // This was 0, second paragraph was shifted to the right, it had the same // horizontal position as the 3rd paragraph. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1270), getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent")); } -DECLARE_RTFIMPORT_TEST(testTdf81943, "tdf81943.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf81943) { + load(mpTestDocumentPath, "tdf81943.rtf"); // The shape wasn't in background. CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getShape(1), "Opaque")); } -DECLARE_RTFIMPORT_TEST(testTdf115155, "tdf115155.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf115155) { + load(mpTestDocumentPath, "tdf115155.rtf"); auto xLevels = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(2), "NumberingRules"); // 1st level @@ -180,8 +186,9 @@ DECLARE_RTFIMPORT_TEST(testTdf115155, "tdf115155.rtf") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2540), aMap["IndentAt"].get<sal_Int32>()); } -DECLARE_RTFIMPORT_TEST(testTdf108951, "tdf108951.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf108951) { + load(mpTestDocumentPath, "tdf108951.rtf"); // This test is import-only, as we assert the list ID, which is OK to // re-order on export, but then this test would not pass anymore. @@ -190,8 +197,9 @@ DECLARE_RTFIMPORT_TEST(testTdf108951, "tdf108951.rtf") getProperty<OUString>(getParagraph(1), "NumberingStyleName")); } -DECLARE_RTFIMPORT_TEST(testFdo47036, "fdo47036.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo47036) { + load(mpTestDocumentPath, "fdo47036.rtf"); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); int nAtCharacter = 0; @@ -211,8 +219,9 @@ DECLARE_RTFIMPORT_TEST(testFdo47036, "fdo47036.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); } -DECLARE_RTFIMPORT_TEST(testFdo45182, "fdo45182.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo45182) { + load(mpTestDocumentPath, "fdo45182.rtf"); uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); @@ -221,8 +230,9 @@ DECLARE_RTFIMPORT_TEST(testFdo45182, "fdo45182.rtf") CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString()); } -DECLARE_RTFIMPORT_TEST(testFdo85812, "fdo85812.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo85812) { + load(mpTestDocumentPath, "fdo85812.rtf"); lang::Locale locale( getProperty<lang::Locale>(getRun(getParagraph(1), 1, "This "), "CharLocale")); // the \lang inside the group was applied to CJK not Western @@ -284,8 +294,9 @@ DECLARE_RTFIMPORT_TEST(testFdo85812, "fdo85812.rtf") CPPUNIT_ASSERT_EQUAL(OUString("EG"), locale.Country); } -DECLARE_RTFIMPORT_TEST(testFdo49692, "fdo49692.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo49692) { + load(mpTestDocumentPath, "fdo49692.rtf"); uno::Reference<beans::XPropertySet> xPropertySet( getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xLevels( @@ -305,8 +316,9 @@ DECLARE_RTFIMPORT_TEST(testFdo49692, "fdo49692.rtf") } } -DECLARE_RTFIMPORT_TEST(testFdo45190, "fdo45190.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo45190) { + load(mpTestDocumentPath, "fdo45190.rtf"); // inherited \fi should be reset CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent")); @@ -316,16 +328,18 @@ DECLARE_RTFIMPORT_TEST(testFdo45190, "fdo45190.rtf") getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent")); } -DECLARE_RTFIMPORT_TEST(testTdf59699, "tdf59699.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf59699) { + load(mpTestDocumentPath, "tdf59699.rtf"); // This resulted in a lang.IndexOutOfBoundsException: the referenced graphic data wasn't imported. uno::Reference<beans::XPropertySet> xImage(getShape(1), uno::UNO_QUERY); auto xGraphic = getProperty<uno::Reference<graphic::XGraphic>>(xImage, "Graphic"); CPPUNIT_ASSERT(xGraphic.is()); } -DECLARE_RTFIMPORT_TEST(testFdo52066, "fdo52066.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo52066) { + load(mpTestDocumentPath, "fdo52066.rtf"); /* * The problem was that the height of the shape was too big. * @@ -335,8 +349,9 @@ DECLARE_RTFIMPORT_TEST(testFdo52066, "fdo52066.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(19)), xShape->getSize().Height); } -DECLARE_RTFIMPORT_TEST(testTdf112211_2, "tdf112211-2.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf112211_2) { + load(mpTestDocumentPath, "tdf112211-2.rtf"); // Spacing between the bullet and the actual text was too large. // This is now around 269, large old value was 629. int nWidth = parseDump("/root/page/body/txt[2]/Text[@nType='PortionType::TabLeft']", "nWidth") @@ -344,15 +359,17 @@ DECLARE_RTFIMPORT_TEST(testTdf112211_2, "tdf112211-2.rtf") CPPUNIT_ASSERT_LESS(300, nWidth); } -DECLARE_RTFIMPORT_TEST(testTdf122430, "tdf122430.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf122430) { + load(mpTestDocumentPath, "tdf122430.rtf"); // Without the accompanying fix in place, this test would have failed with // 'Expected: 18, Actual : 12', i.e. the font was smaller than expected. CPPUNIT_ASSERT_EQUAL(18.0f, getProperty<float>(getRun(getParagraph(1), 2), "CharHeight")); } -DECLARE_RTFIMPORT_TEST(testFdo49892, "fdo49892.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo49892) { + load(mpTestDocumentPath, "fdo49892.rtf"); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); for (int i = 0; i < xDraws->getCount(); ++i) @@ -379,15 +396,17 @@ DECLARE_RTFIMPORT_TEST(testFdo49892, "fdo49892.rtf") } } -DECLARE_RTFIMPORT_TEST(testFdo52052, "fdo52052.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo52052) { + load(mpTestDocumentPath, "fdo52052.rtf"); // Make sure the textframe containing the text "third" appears on the 3rd page. CPPUNIT_ASSERT_EQUAL(OUString("third"), parseDump("/root/page[3]/body/txt/anchored/fly/txt/text()")); } -DECLARE_RTFIMPORT_TEST(testInk, "ink.rtf") +CPPUNIT_TEST_FIXTURE(Test, testInk) { + load(mpTestDocumentPath, "ink.rtf"); /* * The problem was that the second segment had wrong command count and wrap type. * @@ -418,8 +437,9 @@ DECLARE_RTFIMPORT_TEST(testInk, "ink.rtf") getProperty<text::WrapTextMode>(getShape(1), "Surround")); } -DECLARE_RTFIMPORT_TEST(testFdo79319, "fdo79319.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo79319) { + load(mpTestDocumentPath, "fdo79319.rtf"); // the thin horizontal rule was imported as a big fat rectangle uno::Reference<drawing::XShape> xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xShape, "RelativeWidth")); @@ -431,16 +451,18 @@ DECLARE_RTFIMPORT_TEST(testFdo79319, "fdo79319.rtf") #endif } -DECLARE_RTFIMPORT_TEST(testFdo48442, "fdo48442.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo48442) { + load(mpTestDocumentPath, "fdo48442.rtf"); // The problem was that \pvmrg is the default in RTF, but not in Writer. uno::Reference<drawing::XShape> xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); // was FRAME } -DECLARE_RTFIMPORT_TEST(testFdo55525, "fdo55525.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo55525) { + load(mpTestDocumentPath, "fdo55525.rtf"); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -454,8 +476,9 @@ DECLARE_RTFIMPORT_TEST(testFdo55525, "fdo55525.rtf") .Position); } -DECLARE_RTFIMPORT_TEST(testFdo57708, "fdo57708.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo57708) { + load(mpTestDocumentPath, "fdo57708.rtf"); // There were two issues: the doc was of 2 pages and the picture was missing. CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); @@ -464,8 +487,9 @@ DECLARE_RTFIMPORT_TEST(testFdo57708, "fdo57708.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount()); } -DECLARE_RTFIMPORT_TEST(testFdo45183, "fdo45183.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo45183) { + load(mpTestDocumentPath, "fdo45183.rtf"); // Was text::WrapTextMode_PARALLEL, i.e. shpfblwtxt didn't send the shape below text. CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, getProperty<text::WrapTextMode>(getShape(1), "Surround")); @@ -477,8 +501,9 @@ DECLARE_RTFIMPORT_TEST(testFdo45183, "fdo45183.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(16237), getProperty<sal_Int32>(xTables->getByIndex(0), "Width")); } -DECLARE_RTFIMPORT_TEST(testFdo59953, "fdo59953.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo59953) { + load(mpTestDocumentPath, "fdo59953.rtf"); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -490,8 +515,9 @@ DECLARE_RTFIMPORT_TEST(testFdo59953, "fdo59953.rtf") .Position); } -DECLARE_RTFIMPORT_TEST(testTdf84684, "tdf84684.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf84684) { + load(mpTestDocumentPath, "tdf84684.rtf"); // The ZOrder of the two children of the group shape were swapped. uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY); uno::Reference<container::XNamed> xChild1(xGroup->getByIndex(0), uno::UNO_QUERY); @@ -502,8 +528,9 @@ DECLARE_RTFIMPORT_TEST(testTdf84684, "tdf84684.rtf") CPPUNIT_ASSERT_EQUAL(OUString("Pie 2"), xChild2->getName()); } -DECLARE_RTFIMPORT_TEST(testFdo81944, "fdo81944.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo81944) { + load(mpTestDocumentPath, "fdo81944.rtf"); // font properties in style were not imported uno::Reference<beans::XPropertySet> xPropertySet( getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY); @@ -516,8 +543,9 @@ DECLARE_RTFIMPORT_TEST(testFdo81944, "fdo81944.rtf") CPPUNIT_ASSERT_EQUAL(11.0f, getProperty<float>(xStyle, "CharHeightComplex")); } -DECLARE_RTFIMPORT_TEST(testSbkodd, "sbkodd.rtf") +CPPUNIT_TEST_FIXTURE(Test, testSbkodd) { + load(mpTestDocumentPath, "sbkodd.rtf"); uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); @@ -528,8 +556,9 @@ DECLARE_RTFIMPORT_TEST(testSbkodd, "sbkodd.rtf") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(3), xCursor->getPage()); } -DECLARE_RTFIMPORT_TEST(testSbkeven, "sbkeven.rtf") +CPPUNIT_TEST_FIXTURE(Test, testSbkeven) { + load(mpTestDocumentPath, "sbkeven.rtf"); uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); @@ -542,8 +571,9 @@ DECLARE_RTFIMPORT_TEST(testSbkeven, "sbkeven.rtf") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4), xCursor->getPage()); } -DECLARE_RTFIMPORT_TEST(testPoshPosv, "posh-posv.rtf") +CPPUNIT_TEST_FIXTURE(Test, testPoshPosv) { + load(mpTestDocumentPath, "posh-posv.rtf"); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(getShape(1), "HoriOrient")); CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, @@ -551,16 +581,18 @@ DECLARE_RTFIMPORT_TEST(testPoshPosv, "posh-posv.rtf") CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getShape(1), "FrameIsAutomaticHeight")); } -DECLARE_RTFIMPORT_TEST(testPoshLeftRight, "posh-leftright.rtf") +CPPUNIT_TEST_FIXTURE(Test, testPoshLeftRight) { + load(mpTestDocumentPath, "posh-leftright.rtf"); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::RIGHT, getProperty<sal_Int16>(getShape(1), "HoriOrient")); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::LEFT, getProperty<sal_Int16>(getShape(2), "HoriOrient")); } -DECLARE_RTFIMPORT_TEST(testTdf96326, "tdf96326.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf96326) { + load(mpTestDocumentPath, "tdf96326.rtf"); // Make sure this is not checked. auto xFormField = getProperty<uno::Reference<text::XFormField>>(getRun(getParagraph(1), 2), "Bookmark"); @@ -575,8 +607,9 @@ DECLARE_RTFIMPORT_TEST(testTdf96326, "tdf96326.rtf") CPPUNIT_ASSERT_EQUAL(true, xParameters->getByName("Checkbox_Checked").get<bool>()); } -DECLARE_RTFIMPORT_TEST(testN823655, "n823655.rtf") +CPPUNIT_TEST_FIXTURE(Test, testN823655) { + load(mpTestDocumentPath, "n823655.rtf"); uno::Sequence<beans::PropertyValue> aProps = getProperty<uno::Sequence<beans::PropertyValue>>(getShape(1), "CustomShapeGeometry"); uno::Sequence<beans::PropertyValue> aPathProps; @@ -598,8 +631,9 @@ DECLARE_RTFIMPORT_TEST(testN823655, "n823655.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(286), aCoordinates[0].Second.Value.get<sal_Int32>()); } -DECLARE_RTFIMPORT_TEST(testN823675, "n823675.rtf") +CPPUNIT_TEST_FIXTURE(Test, testN823675) { + load(mpTestDocumentPath, "n823675.rtf"); uno::Reference<beans::XPropertySet> xPropertySet( getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xLevels( @@ -619,8 +653,9 @@ DECLARE_RTFIMPORT_TEST(testN823675, "n823675.rtf") CPPUNIT_ASSERT_EQUAL(OUString("Symbol"), aFont.Name); } -DECLARE_RTFIMPORT_TEST(testGroupshape, "groupshape.rtf") +CPPUNIT_TEST_FIXTURE(Test, testGroupshape) { + load(mpTestDocumentPath, "groupshape.rtf"); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); // There should be a single groupshape with 2 children. @@ -629,8 +664,9 @@ DECLARE_RTFIMPORT_TEST(testGroupshape, "groupshape.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupshape->getCount()); } -DECLARE_RTFIMPORT_TEST(testGroupshape_notext, "groupshape-notext.rtf") +CPPUNIT_TEST_FIXTURE(Test, testGroupshape_notext) { + load(mpTestDocumentPath, "groupshape-notext.rtf"); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); // There should be a single groupshape with 2 children. @@ -639,8 +675,9 @@ DECLARE_RTFIMPORT_TEST(testGroupshape_notext, "groupshape-notext.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupshape->getCount()); } -DECLARE_RTFIMPORT_TEST(testFdo81033, "fdo81033.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo81033) { + load(mpTestDocumentPath, "fdo81033.rtf"); // Number of tabstops in the paragraph should be 2, was 3. uno::Sequence<style::TabStop> tabs( getProperty<uno::Sequence<style::TabStop>>(getParagraph(1), "ParaTabStops")); @@ -653,24 +690,27 @@ DECLARE_RTFIMPORT_TEST(testFdo81033, "fdo81033.rtf") CPPUNIT_ASSERT_EQUAL(u'_', tabs[1].FillChar); } -DECLARE_RTFIMPORT_TEST(testTdf116269, "tdf116269.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf116269) { + load(mpTestDocumentPath, "tdf116269.rtf"); // This was 2540, implicit 0 left margin was ignored on import (inherited // value from list definition is repeated if it's not 0). CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); } -DECLARE_RTFIMPORT_TEST(testTdf116265, "tdf116265.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf116265) { + load(mpTestDocumentPath, "tdf116265.rtf"); // This was -635, \fi as direct formatting has to be ignored due to // matching \fi in list definition (and with invalid level numbers). CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent")); } -DECLARE_RTFIMPORT_TEST(testFdo66565, "fdo66565.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo66565) { + load(mpTestDocumentPath, "fdo66565.rtf"); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -682,8 +722,9 @@ DECLARE_RTFIMPORT_TEST(testFdo66565, "fdo66565.rtf") .Position); } -DECLARE_RTFIMPORT_TEST(testFdo67365, "fdo67365.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo67365) { + load(mpTestDocumentPath, "fdo67365.rtf"); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -702,8 +743,9 @@ DECLARE_RTFIMPORT_TEST(testFdo67365, "fdo67365.rtf") getParagraphOfText(1, xCell->getText()), "ParaAdjust"))); } -DECLARE_RTFIMPORT_TEST(testFdo47440, "fdo47440.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo47440) { + load(mpTestDocumentPath, "fdo47440.rtf"); // Vertical and horizontal orientation of the picture wasn't imported (was text::RelOrientation::FRAME). CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "HoriOrientRelation")); @@ -711,8 +753,9 @@ DECLARE_RTFIMPORT_TEST(testFdo47440, "fdo47440.rtf") getProperty<sal_Int16>(getShape(1), "VertOrientRelation")); } -DECLARE_RTFIMPORT_TEST(testFdo53556, "fdo53556.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo53556) { + load(mpTestDocumentPath, "fdo53556.rtf"); // This was drawing::FillStyle_SOLID, which resulted in being non-transparent, hiding text which would be visible. CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(getShape(3), "FillStyle")); @@ -723,14 +766,16 @@ DECLARE_RTFIMPORT_TEST(testFdo53556, "fdo53556.rtf") CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor->getShapeType()); } -DECLARE_RTFIMPORT_TEST(testGroupshapeRotation, "groupshape-rotation.rtf") +CPPUNIT_TEST_FIXTURE(Test, testGroupshapeRotation) { + load(mpTestDocumentPath, "groupshape-rotation.rtf"); // Rotation on groupshapes wasn't handled correctly, RotateAngle was 4500. CPPUNIT_ASSERT_EQUAL(sal_Int32(315 * 100), getProperty<sal_Int32>(getShape(1), "RotateAngle")); } -DECLARE_RTFIMPORT_TEST(testTdf115153, "tdf115153.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf115153) { + load(mpTestDocumentPath, "tdf115153.rtf"); auto const xShape(getShape(1)); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::NONE, getProperty<sal_Int16>(xShape, "HoriOrient")); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, @@ -743,8 +788,9 @@ DECLARE_RTFIMPORT_TEST(testTdf115153, "tdf115153.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(2131), getProperty<sal_Int32>(xShape, "VertOrientPosition")); } -DECLARE_RTFIMPORT_TEST(testFdo68291, "fdo68291.odt") +CPPUNIT_TEST_FIXTURE(Test, testFdo68291) { + load(mpTestDocumentPath, "fdo68291.odt"); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); @@ -771,8 +817,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf105511) getParagraph(1, aExpected); } -DECLARE_RTFIMPORT_TEST(testContSectionPageBreak, "cont-section-pagebreak.rtf") +CPPUNIT_TEST_FIXTURE(Test, testContSectionPageBreak) { + load(mpTestDocumentPath, "cont-section-pagebreak.rtf"); uno::Reference<text::XTextRange> xParaSecond = getParagraph(2); CPPUNIT_ASSERT_EQUAL(OUString("SECOND"), xParaSecond->getString()); CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, @@ -797,15 +844,17 @@ DECLARE_RTFIMPORT_TEST(testContSectionPageBreak, "cont-section-pagebreak.rtf") CPPUNIT_ASSERT_EQUAL(2, getPages()); } -DECLARE_RTFIMPORT_TEST(testBackground, "background.rtf") +CPPUNIT_TEST_FIXTURE(Test, testBackground) { + load(mpTestDocumentPath, "background.rtf"); // The first shape wasn't in the foreground. CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getShape(1), "Opaque")); CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getShape(2), "Opaque")); } -DECLARE_RTFIMPORT_TEST(testFdo74823, "fdo74823.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo74823) { + load(mpTestDocumentPath, "fdo74823.rtf"); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -817,8 +866,9 @@ DECLARE_RTFIMPORT_TEST(testFdo74823, "fdo74823.rtf") .Position); } -DECLARE_RTFIMPORT_TEST(testFdo74599, "fdo74599.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo74599) { + load(mpTestDocumentPath, "fdo74599.rtf"); uno::Reference<beans::XPropertySet> xPropertySet( getStyles("ParagraphStyles")->getByName("Heading 3"), uno::UNO_QUERY); // Writer default styles weren't disabled, so the color was gray, not default (black). @@ -826,15 +876,17 @@ DECLARE_RTFIMPORT_TEST(testFdo74599, "fdo74599.rtf") getProperty<sal_Int32>(xPropertySet, "CharColor")); } -DECLARE_RTFIMPORT_TEST(testColumnBreak, "column-break.rtf") +CPPUNIT_TEST_FIXTURE(Test, testColumnBreak) { + load(mpTestDocumentPath, "column-break.rtf"); // Column break at the very start of the document was ignored. CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType")); } -DECLARE_RTFIMPORT_TEST(testUnbalancedColumnsCompat, "unbalanced-columns-compat.rtf") +CPPUNIT_TEST_FIXTURE(Test, testUnbalancedColumnsCompat) { + load(mpTestDocumentPath, "unbalanced-columns-compat.rtf"); uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); @@ -843,23 +895,26 @@ DECLARE_RTFIMPORT_TEST(testUnbalancedColumnsCompat, "unbalanced-columns-compat.r getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns")); } -DECLARE_RTFIMPORT_TEST(testOleInline, "ole-inline.rtf") +CPPUNIT_TEST_FIXTURE(Test, testOleInline) { + load(mpTestDocumentPath, "ole-inline.rtf"); // Problem was that inline shape had at-page anchor. CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); } -DECLARE_RTFIMPORT_TEST(testFdo80742, "fdo80742.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo80742) { + load(mpTestDocumentPath, "fdo80742.rtf"); uno::Reference<beans::XPropertySet> xPropertySet( getStyles("ParagraphStyles")->getByName("Heading 2"), uno::UNO_QUERY); // This was 0, outline level was body text. CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xPropertySet, "OutlineLevel")); } -DECLARE_RTFIMPORT_TEST(testBehindDoc, "behind-doc.rtf") +CPPUNIT_TEST_FIXTURE(Test, testBehindDoc) { + load(mpTestDocumentPath, "behind-doc.rtf"); // The problem was that "behind doc" didn't result in the shape being in the background, only in being wrapped as "through". uno::Reference<drawing::XShape> xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, @@ -868,8 +923,9 @@ DECLARE_RTFIMPORT_TEST(testBehindDoc, "behind-doc.rtf") CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xShape, "Opaque")); } -DECLARE_RTFIMPORT_TEST(testFdo82114, "fdo82114.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo82114) { + load(mpTestDocumentPath, "fdo82114.rtf"); uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>( getStyles("PageStyles")->getByName("Converted1"), "HeaderText"); OUString aActual = xHeaderText->getString(); @@ -878,8 +934,9 @@ DECLARE_RTFIMPORT_TEST(testFdo82114, "fdo82114.rtf") CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } -DECLARE_RTFIMPORT_TEST(testFdo44984, "fdo44984.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo44984) { + load(mpTestDocumentPath, "fdo44984.rtf"); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -891,8 +948,9 @@ DECLARE_RTFIMPORT_TEST(testFdo44984, "fdo44984.rtf") "TextPortionType")); } -DECLARE_RTFIMPORT_TEST(testFdo82071, "fdo82071.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo82071) { + load(mpTestDocumentPath, "fdo82071.rtf"); // The problem was that in TOC, chapter names were underlined, but they should not be. uno::Reference<text::XTextRange> xRun = getRun(getParagraph(2), 1); // Make sure we test the right text portion. @@ -901,23 +959,26 @@ DECLARE_RTFIMPORT_TEST(testFdo82071, "fdo82071.rtf") CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::NONE, getProperty<sal_Int16>(xRun, "CharUnderline")); } -DECLARE_RTFIMPORT_TEST(testFdo85179, "fdo85179.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo85179) { + load(mpTestDocumentPath, "fdo85179.rtf"); // This was 0, border around the picture was ignored on import. // 360: EMU -> MM100 CPPUNIT_ASSERT_EQUAL(sal_uInt32(50800 / 360), getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineWidth); } -DECLARE_RTFIMPORT_TEST(testFdo82512, "fdo82512.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo82512) { + load(mpTestDocumentPath, "fdo82512.rtf"); // This was style::BreakType_NONE, column break was before the 3rd paragraph, not before the 2nd one. CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType")); } -DECLARE_RTFIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.rtf") +CPPUNIT_TEST_FIXTURE(Test, testUnbalancedColumns) { + load(mpTestDocumentPath, "unbalanced-columns.rtf"); uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); @@ -926,15 +987,17 @@ DECLARE_RTFIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.rtf") getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns")); } -DECLARE_RTFIMPORT_TEST(testTdf126173, "tdf126173.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf126173) { + load(mpTestDocumentPath, "tdf126173.rtf"); // Without the accompanying fix in place, this test would have failed, as the TextFrame was lost // on import. CPPUNIT_ASSERT(getShape(1).is()); } -DECLARE_RTFIMPORT_TEST(testFdo84685, "fdo84685.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo84685) { + load(mpTestDocumentPath, "fdo84685.rtf"); // index mark was not imported uno::Reference<text::XDocumentIndexMark> xMark( getProperty<uno::Reference<text::XDocumentIndexMark>>(getRun(getParagraph(1), 1), @@ -951,8 +1014,9 @@ DECLARE_RTFIMPORT_TEST(testFdo84685, "fdo84685.rtf") } // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ). -DECLARE_RTFIMPORT_TEST(testCp950listleveltext1, "cp950listleveltext1.rtf") +CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext1) { + load(mpTestDocumentPath, "cp950listleveltext1.rtf"); // suffix with Chinese only ( most common case generated by MSO2010 TC) const sal_Unicode aExpectedSuffix[1] = { 0x3001 }; // This is a dot that is generally used as suffix of Chinese list number @@ -976,8 +1040,9 @@ DECLARE_RTFIMPORT_TEST(testCp950listleveltext1, "cp950listleveltext1.rtf") } // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ). -DECLARE_RTFIMPORT_TEST(testCp950listleveltext2, "cp950listleveltext2.rtf") +CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext2) { + load(mpTestDocumentPath, "cp950listleveltext2.rtf"); // Prefix and suffix with Chinese only ( tweaked from default in MSO2010 TC) const sal_Unicode aExpectedPrefix[2] = { 0x524d, 0x7f6e }; const sal_Unicode aExpectedSuffix[3] = { 0x3001, 0x5f8c, 0x7f6e }; @@ -1005,8 +1070,9 @@ DECLARE_RTFIMPORT_TEST(testCp950listleveltext2, "cp950listleveltext2.rtf") } // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ) -DECLARE_RTFIMPORT_TEST(testCp950listleveltext3, "cp950listleveltext3.rtf") +CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext3) { + load(mpTestDocumentPath, "cp950listleveltext3.rtf"); // Prefix and suffix that mix Chinese and English ( tweaked from default in MSO2010 TC) const sal_Unicode aExpectedPrefix[4] = { 0x524d, 0x0061, 0x7f6e, 0x0062 }; const sal_Unicode aExpectedSuffix[6] = { 0x3001, 0x0063, 0x5f8c, 0x0064, 0x7f6e, 0x0065 }; @@ -1033,8 +1099,9 @@ DECLARE_RTFIMPORT_TEST(testCp950listleveltext3, "cp950listleveltext3.rtf") CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix, SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); } -DECLARE_RTFIMPORT_TEST(testChtOutlineNumberingRtf, "chtoutline.rtf") +CPPUNIT_TEST_FIXTURE(Test, testChtOutlineNumberingRtf) { + load(mpTestDocumentPath, "chtoutline.rtf"); const sal_Unicode aExpectedPrefix[2] = { 0x7b2c, 0x0020 }; const sal_Unicode aExpectedSuffix[2] = { 0x0020, 0x7ae0 }; uno::Reference<text::XChapterNumberingSupplier> xChapterNumberingSupplier(mxComponent, @@ -1058,8 +1125,9 @@ DECLARE_RTFIMPORT_TEST(testChtOutlineNumberingRtf, "chtoutline.rtf") CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix, SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); } -DECLARE_RTFIMPORT_TEST(testTdf90046, "tdf90046.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf90046) { + load(mpTestDocumentPath, "tdf90046.rtf"); // this was crashing on importing the footnote uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); @@ -1067,8 +1135,9 @@ DECLARE_RTFIMPORT_TEST(testTdf90046, "tdf90046.rtf") CPPUNIT_ASSERT_EQUAL(OUString("Ma"), xTextRange->getString()); } -DECLARE_RTFIMPORT_TEST(testFdo49893, "fdo49893.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo49893) { + load(mpTestDocumentPath, "fdo49893.rtf"); // Image from shape was not loaded, invalid size of image after load uno::Reference<drawing::XShape> xShape = getShape(2); CPPUNIT_ASSERT(xShape.is()); @@ -1076,8 +1145,9 @@ DECLARE_RTFIMPORT_TEST(testFdo49893, "fdo49893.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(1296)), xShape->getSize().Width); } -DECLARE_RTFIMPORT_TEST(testFdo49893_3, "fdo49893-3.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFdo49893_3) { + load(mpTestDocumentPath, "fdo49893-3.rtf"); // No artifacts (black lines in left top corner) as shape #3 are expected try { @@ -1094,8 +1164,9 @@ DECLARE_RTFIMPORT_TEST(testFdo49893_3, "fdo49893-3.rtf") getProperty<text::WrapTextMode>(getShape(2), "Surround")); } -DECLARE_RTFIMPORT_TEST(testWrapDistance, "wrap-distance.rtf") +CPPUNIT_TEST_FIXTURE(Test, testWrapDistance) { + load(mpTestDocumentPath, "wrap-distance.rtf"); // Custom shape, handled directly in RTFSdrImport. uno::Reference<drawing::XShape> xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.CustomShape"), xShape->getShapeType()); @@ -1120,8 +1191,9 @@ DECLARE_RTFIMPORT_TEST(testWrapDistance, "wrap-distance.rtf") getProperty<sal_Int32>(xShape, "RightMargin") / 1000); } -DECLARE_RTFIMPORT_TEST(testTdf90260Par, "hello.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf90260Par) { + load(mpTestDocumentPath, "hello.rtf"); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); @@ -1129,16 +1201,18 @@ DECLARE_RTFIMPORT_TEST(testTdf90260Par, "hello.rtf") CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); } -DECLARE_RTFIMPORT_TEST(testTdf119599, "tdf119599.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf119599) { + load(mpTestDocumentPath, "tdf119599.rtf"); uno::Reference<beans::XPropertyState> xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY); // This was beans::PropertyState_DIRECT_VALUE, changing the font size in // the style had no effect on the rendering result. CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, xRun->getPropertyState("CharHeight")); } -DECLARE_RTFIMPORT_TEST(testTdf90315, "tdf90315.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf90315) { + load(mpTestDocumentPath, "tdf90315.rtf"); uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); @@ -1149,14 +1223,16 @@ DECLARE_RTFIMPORT_TEST(testTdf90315, "tdf90315.rtf") getProperty<sal_Int32>(xTextSection->getPropertyValue("TextColumns"), "AutomaticDistance")); } -DECLARE_RTFIMPORT_TEST(testTdf59454, "tdf59454.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf59454) { + load(mpTestDocumentPath, "tdf59454.rtf"); // This was 1, section break was ignored right before a table. CPPUNIT_ASSERT_EQUAL(2, getPages()); } -DECLARE_RTFIMPORT_TEST(testTdf96308Tabpos, "tdf96308-tabpos.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf96308Tabpos) { + load(mpTestDocumentPath, "tdf96308-tabpos.rtf"); // Get the tab stops of the second para in the B1 cell of the first table in the document. uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), @@ -1172,8 +1248,9 @@ DECLARE_RTFIMPORT_TEST(testTdf96308Tabpos, "tdf96308-tabpos.rtf") CPPUNIT_ASSERT(!aTabStops.hasElements()); } -DECLARE_RTFIMPORT_TEST(testLndscpsxn, "lndscpsxn.rtf") +CPPUNIT_TEST_FIXTURE(Test, testLndscpsxn) { + load(mpTestDocumentPath, "lndscpsxn.rtf"); // Check landscape flag. CPPUNIT_ASSERT_EQUAL(4, getPages()); @@ -1211,8 +1288,9 @@ DECLARE_RTFIMPORT_TEST(testLndscpsxn, "lndscpsxn.rtf") CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xStylePage, "IsLandscape")); } -DECLARE_RTFIMPORT_TEST(testTdf99498, "tdf99498.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf99498) { + load(mpTestDocumentPath, "tdf99498.rtf"); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -1222,8 +1300,9 @@ DECLARE_RTFIMPORT_TEST(testTdf99498, "tdf99498.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(7056), getProperty<sal_Int32>(xTables->getByIndex(0), "Width")); } -DECLARE_RTFIMPORT_TEST(testClassificatonPaste, "hello.rtf") +CPPUNIT_TEST_FIXTURE(Test, testClassificatonPaste) { + load(mpTestDocumentPath, "hello.rtf"); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); @@ -1238,8 +1317,9 @@ DECLARE_RTFIMPORT_TEST(testClassificatonPaste, "hello.rtf") CPPUNIT_ASSERT_EQUAL(aOld, xText->getString()); } -DECLARE_RTFIMPORT_TEST(testTdf90097, "tdf90097.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf90097) { + load(mpTestDocumentPath, "tdf90097.rtf"); // Get the second child of the group shape. uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xShape(xGroup->getByIndex(0), uno::UNO_QUERY); @@ -1251,15 +1331,17 @@ DECLARE_RTFIMPORT_TEST(testTdf90097, "tdf90097.rtf") CPPUNIT_ASSERT(rPolygon[0].Y > rPolygon[1].Y); } -DECLARE_RTFIMPORT_TEST(testTdf91684, "tdf91684.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf91684) { + load(mpTestDocumentPath, "tdf91684.rtf"); // Scaling of the group shape children were incorrect, this was 3203. // (Unit was assumed to be twips, but it was relative coordinates.) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1337), getShape(1)->getSize().Height); } -DECLARE_RTFIMPORT_TEST(testFlip, "flip.rtf") +CPPUNIT_TEST_FIXTURE(Test, testFlip) { + load(mpTestDocumentPath, "flip.rtf"); comphelper::SequenceAsHashMap aMap = getProperty<uno::Sequence<beans::PropertyValue>>( getShapeByName("h-and-v"), "CustomShapeGeometry"); // This resulted in a uno::RuntimeException, as MirroredX wasn't set at all, so could not extract void to boolean. @@ -1282,8 +1364,9 @@ DECLARE_RTFIMPORT_TEST(testFlip, "flip.rtf") CPPUNIT_ASSERT(!aMap["MirroredY"].hasValue()); } -DECLARE_RTFIMPORT_TEST(testTdf78506, "tdf78506.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf78506) { + load(mpTestDocumentPath, "tdf78506.rtf"); uno::Reference<beans::XPropertySet> xPropertySet( getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xLevels( @@ -1301,8 +1384,9 @@ DECLARE_RTFIMPORT_TEST(testTdf78506, "tdf78506.rtf") } } -DECLARE_RTFIMPORT_TEST(testTdf117403, "tdf117403.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf117403) { + load(mpTestDocumentPath, "tdf117403.rtf"); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -1315,8 +1399,9 @@ DECLARE_RTFIMPORT_TEST(testTdf117403, "tdf117403.rtf") CPPUNIT_ASSERT_BORDER_EQUAL(aExpected, getProperty<table::BorderLine2>(xCell, "BottomBorder")); } -DECLARE_RTFIMPORT_TEST(testImportHeaderFooter, "tdf108055.rtf") +CPPUNIT_TEST_FIXTURE(Test, testImportHeaderFooter) { + load(mpTestDocumentPath, "tdf108055.rtf"); // The RTF import sometimes added Header and Footer multiple Times // as well as added the Header to the document body. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); @@ -1369,8 +1454,9 @@ DECLARE_RTFIMPORT_TEST(testImportHeaderFooter, "tdf108055.rtf") CPPUNIT_ASSERT_EQUAL(OUString("Footer uneven"), aActual); } -DECLARE_RTFIMPORT_TEST(testTdf108947, "tdf108947.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf108947) { + load(mpTestDocumentPath, "tdf108947.rtf"); //Check if Headers/Footers contain what they should in this document uno::Reference<text::XText> xHeaderTextRight = getProperty<uno::Reference<text::XText>>( getStyles("PageStyles")->getByName("Default Style"), "HeaderTextRight"); @@ -1387,8 +1473,9 @@ DECLARE_RTFIMPORT_TEST(testTdf108947, "tdf108947.rtf") #endif } -DECLARE_RTFIMPORT_TEST(testWatermark, "watermark.rtf") +CPPUNIT_TEST_FIXTURE(Test, testWatermark) { + load(mpTestDocumentPath, "watermark.rtf"); Size aExpectedSize(14965, 7482); uno::Reference<drawing::XShape> xShape = getShape(1); awt::Size aActualSize(xShape->getSize()); @@ -1397,8 +1484,9 @@ DECLARE_RTFIMPORT_TEST(testWatermark, "watermark.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), aActualSize.Height); } -DECLARE_RTFIMPORT_TEST(testTdf104016, "tdf104016.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf104016) { + load(mpTestDocumentPath, "tdf104016.rtf"); uno::Reference<beans::XPropertyState> xParagraph(getParagraph(1), uno::UNO_QUERY); // This was beans::PropertyState_DIRECT_VALUE, leading to lack of // inheritance from numbering. @@ -1406,16 +1494,18 @@ DECLARE_RTFIMPORT_TEST(testTdf104016, "tdf104016.rtf") xParagraph->getPropertyState("ParaLeftMargin")); } -DECLARE_RTFIMPORT_TEST(testTdf115242, "tdf115242.rtf") +CPPUNIT_TEST_FIXTURE(Test, testTdf115242) { + load(mpTestDocumentPath, "tdf115242.rtf"); // This was 0, overridden left margin was lost by too aggressive style // deduplication. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2787), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); } -DECLARE_RTFIMPORT_TEST(testDefaultValues, "default-values.rtf") +CPPUNIT_TEST_FIXTURE(Test, testDefaultValues) { + load(mpTestDocumentPath, "default-values.rtf"); // tdf#105910: control words without values must be treated as having default values, // instead of being silently ignored @@ -1544,8 +1634,9 @@ DECLARE_RTFIMPORT_TEST(testDefaultValues, "default-values.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_AUTO), getProperty<sal_Int32>(run, "CharColor")); } -DECLARE_RTFIMPORT_TEST(testParaStyleBottomMargin, "para-style-bottom-margin.rtf") +CPPUNIT_TEST_FIXTURE(Test, testParaStyleBottomMargin) { + load(mpTestDocumentPath, "para-style-bottom-margin.rtf"); uno::Reference<beans::XPropertySet> xPropertySet( getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(353), getProperty<sal_Int32>(xPropertySet, "ParaBottomMargin")); |