sw/qa/extras/rtfexport/rtfexport7.cxx | 1348 ++++++++++++++++++++--------------
 1 file changed, 822 insertions(+), 526 deletions(-)

New commits:
commit 55eb6fc8b83fe2f846a4f7448271a5b0fe03fbfc
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu May 16 08:00:20 2024 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu May 16 08:48:06 2024 +0200

    CppunitTest_sw_rtfexport7: avoid DECLARE_RTFEXPORT_TEST
    
    No need to go via Writer-specific macros here.
    
    Change-Id: Ib8badf6c7a75ee58bace05dfc3ef8732fd8bc264
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167719
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/rtfexport/rtfexport7.cxx 
b/sw/qa/extras/rtfexport/rtfexport7.cxx
index d0803d6bcb74..57162cf30df1 100644
--- a/sw/qa/extras/rtfexport/rtfexport7.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport7.cxx
@@ -43,29 +43,41 @@ public:
     }
 };
 
-DECLARE_RTFEXPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testPictureWrapPolygon)
 {
-    // The problem was that the wrap polygon was ignored during import.
-    drawing::PointSequenceSequence aSeqSeq
-        = getProperty<drawing::PointSequenceSequence>(getShape(1), 
"ContourPolyPolygon");
-    // This was 0: the polygon list was empty.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeqSeq.getLength());
-
-    drawing::PointSequence aSeq = aSeqSeq[0];
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aSeq.getLength());
-
-    // The shape also didn't have negative top / left coordinates.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-1177)),
-                         getProperty<sal_Int32>(getShape(1), 
"HoriOrientPosition"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-67)),
-                         getProperty<sal_Int32>(getShape(1), 
"VertOrientPosition"));
+    auto verify = [this]() {
+        // The problem was that the wrap polygon was ignored during import.
+        drawing::PointSequenceSequence aSeqSeq
+            = getProperty<drawing::PointSequenceSequence>(getShape(1), 
"ContourPolyPolygon");
+        // This was 0: the polygon list was empty.
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeqSeq.getLength());
+
+        drawing::PointSequence aSeq = aSeqSeq[0];
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aSeq.getLength());
+
+        // The shape also didn't have negative top / left coordinates.
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-1177)),
+                             getProperty<sal_Int32>(getShape(1), 
"HoriOrientPosition"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-67)),
+                             getProperty<sal_Int32>(getShape(1), 
"VertOrientPosition"));
+    };
+    createSwDoc("picture-wrap-polygon.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf113408, "tdf113408.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf113408)
 {
-    // This was 0, left margin was not inherited from style properly.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270),
-                         getProperty<sal_Int32>(getParagraph(1), 
"ParaLeftMargin"));
+    auto verify = [this]() {
+        // This was 0, left margin was not inherited from style properly.
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270),
+                             getProperty<sal_Int32>(getParagraph(1), 
"ParaLeftMargin"));
+    };
+    createSwDoc("tdf113408.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testAbi10039)
@@ -85,30 +97,42 @@ CPPUNIT_TEST_FIXTURE(Test, testAbi10076)
     // Just make sure that we don't crash after exporting a fully calculated 
layout.
 }
 
-DECLARE_RTFEXPORT_TEST(testEm, "em.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testEm)
 {
-    // Test all possible cc* control words.
-    CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::NONE,
-                         getProperty<sal_Int16>(getRun(getParagraph(1), 1), 
"CharEmphasis"));
-    CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_ABOVE,
-                         getProperty<sal_Int16>(getRun(getParagraph(1), 2), 
"CharEmphasis"));
-    CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::ACCENT_ABOVE,
-                         getProperty<sal_Int16>(getRun(getParagraph(1), 3), 
"CharEmphasis"));
-    // This was missing.
-    CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::CIRCLE_ABOVE,
-                         getProperty<sal_Int16>(getRun(getParagraph(1), 4), 
"CharEmphasis"));
-    // This one, too.
-    CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_BELOW,
-                         getProperty<sal_Int16>(getRun(getParagraph(1), 5), 
"CharEmphasis"));
+    auto verify = [this]() {
+        // Test all possible cc* control words.
+        CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::NONE,
+                             getProperty<sal_Int16>(getRun(getParagraph(1), 
1), "CharEmphasis"));
+        CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_ABOVE,
+                             getProperty<sal_Int16>(getRun(getParagraph(1), 
2), "CharEmphasis"));
+        CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::ACCENT_ABOVE,
+                             getProperty<sal_Int16>(getRun(getParagraph(1), 
3), "CharEmphasis"));
+        // This was missing.
+        CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::CIRCLE_ABOVE,
+                             getProperty<sal_Int16>(getRun(getParagraph(1), 
4), "CharEmphasis"));
+        // This one, too.
+        CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_BELOW,
+                             getProperty<sal_Int16>(getRun(getParagraph(1), 
5), "CharEmphasis"));
+    };
+    createSwDoc("em.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testNumberingFont, "numbering-font.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testNumberingFont)
 {
-    uno::Reference<beans::XPropertySet> xStyle(
-        getStyles("CharacterStyles")->getByName("ListLabel 1"), 
uno::UNO_QUERY);
-    // This was Liberation Serif, i.e. custom font of the numbering itself 
("1.        ") was lost on import.
-    CPPUNIT_ASSERT_EQUAL(OUString("Impact"), getProperty<OUString>(xStyle, 
"CharFontName"));
-    CPPUNIT_ASSERT_EQUAL(72.f, getProperty<float>(xStyle, "CharHeight"));
+    auto verify = [this]() {
+        uno::Reference<beans::XPropertySet> xStyle(
+            getStyles("CharacterStyles")->getByName("ListLabel 1"), 
uno::UNO_QUERY);
+        // This was Liberation Serif, i.e. custom font of the numbering itself 
("1.    ") was lost on import.
+        CPPUNIT_ASSERT_EQUAL(OUString("Impact"), getProperty<OUString>(xStyle, 
"CharFontName"));
+        CPPUNIT_ASSERT_EQUAL(72.f, getProperty<float>(xStyle, "CharHeight"));
+    };
+    createSwDoc("numbering-font.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testFdo82860)
@@ -132,60 +156,92 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo82858)
                          getProperty<table::BorderLine2>(getShape(1), 
"TopBorder").LineStyle);
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf104936, "tdf104936.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf104936)
 {
-    uno::Reference<text::XTextRange> xShape1(getShape(1), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), 
getProperty<sal_Int32>(xShape1, "ZOrder"));
-    // This failed, the shape without text covered the shape with text.
-    CPPUNIT_ASSERT(xShape1->getString().isEmpty());
-    uno::Reference<text::XTextRange> xShape2(getShape(2), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), 
getProperty<sal_Int32>(xShape2, "ZOrder"));
-    CPPUNIT_ASSERT_EQUAL(OUString("Hello"), xShape2->getString());
+    auto verify = [this]() {
+        uno::Reference<text::XTextRange> xShape1(getShape(1), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), 
getProperty<sal_Int32>(xShape1, "ZOrder"));
+        // This failed, the shape without text covered the shape with text.
+        CPPUNIT_ASSERT(xShape1->getString().isEmpty());
+        uno::Reference<text::XTextRange> xShape2(getShape(2), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), 
getProperty<sal_Int32>(xShape2, "ZOrder"));
+        CPPUNIT_ASSERT_EQUAL(OUString("Hello"), xShape2->getString());
+    };
+    createSwDoc("tdf104936.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTableRtl, "table-rtl.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTableRtl)
 {
-    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<container::XIndexAccess> 
xTables(xTablesSupplier->getTextTables(),
-                                                    uno::UNO_QUERY);
-    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
-    // This was text::WritingMode2::LR_TB, i.e. direction of the table was 
ignored.
-    CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, 
getProperty<sal_Int16>(xTable, "WritingMode"));
+    auto verify = [this]() {
+        uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+        uno::Reference<container::XIndexAccess> 
xTables(xTablesSupplier->getTextTables(),
+                                                        uno::UNO_QUERY);
+        uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+        // This was text::WritingMode2::LR_TB, i.e. direction of the table was 
ignored.
+        CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB,
+                             getProperty<sal_Int16>(xTable, "WritingMode"));
+    };
+    createSwDoc("table-rtl.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testNumOverrideStart, "num-override-start.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testNumOverrideStart)
 {
-    // The numbering on the second level was "3.1", not "1.3".
-    uno::Reference<container::XIndexAccess> xRules
-        = getProperty<uno::Reference<container::XIndexAccess>>(
-            getStyles("NumberingStyles")->getByName("WWNum1"), 
"NumberingRules");
-    CPPUNIT_ASSERT_EQUAL(
-        sal_Int16(1),
-        
comphelper::SequenceAsHashMap(xRules->getByIndex(0))["StartWith"].get<sal_Int16>());
-    CPPUNIT_ASSERT_EQUAL(
-        sal_Int16(3),
-        
comphelper::SequenceAsHashMap(xRules->getByIndex(1))["StartWith"].get<sal_Int16>());
+    auto verify = [this]() {
+        // The numbering on the second level was "3.1", not "1.3".
+        uno::Reference<container::XIndexAccess> xRules
+            = getProperty<uno::Reference<container::XIndexAccess>>(
+                getStyles("NumberingStyles")->getByName("WWNum1"), 
"NumberingRules");
+        CPPUNIT_ASSERT_EQUAL(
+            sal_Int16(1),
+            
comphelper::SequenceAsHashMap(xRules->getByIndex(0))["StartWith"].get<sal_Int16>());
+        CPPUNIT_ASSERT_EQUAL(
+            sal_Int16(3),
+            
comphelper::SequenceAsHashMap(xRules->getByIndex(1))["StartWith"].get<sal_Int16>());
+    };
+    createSwDoc("num-override-start.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo82006, "fdo82006.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo82006)
 {
-    // These were 176 (100 twips), as \sbauto and \sbbefore were ignored.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(1), 
"ParaTopMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
-                         getProperty<sal_Int32>(getParagraph(1), 
"ParaBottomMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
-                         getProperty<sal_Int32>(getParagraph(2), 
"ParaTopMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
-                         getProperty<sal_Int32>(getParagraph(2), 
"ParaBottomMargin"));
+    auto verify = [this]() {
+        // These were 176 (100 twips), as \sbauto and \sbbefore were ignored.
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0),
+                             getProperty<sal_Int32>(getParagraph(1), 
"ParaTopMargin"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
+                             getProperty<sal_Int32>(getParagraph(1), 
"ParaBottomMargin"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
+                             getProperty<sal_Int32>(getParagraph(2), 
"ParaTopMargin"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
+                             getProperty<sal_Int32>(getParagraph(2), 
"ParaBottomMargin"));
+    };
+    createSwDoc("fdo82006.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf104081, "tdf104081.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf104081)
 {
-    // These were 494 (280 twips), as \htmautsp was ignored.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)),
-                         getProperty<sal_Int32>(getParagraph(1), 
"ParaTopMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)),
-                         getProperty<sal_Int32>(getParagraph(1), 
"ParaBottomMargin"));
+    auto verify = [this]() {
+        // These were 494 (280 twips), as \htmautsp was ignored.
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)),
+                             getProperty<sal_Int32>(getParagraph(1), 
"ParaTopMargin"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)),
+                             getProperty<sal_Int32>(getParagraph(1), 
"ParaBottomMargin"));
+    };
+    createSwDoc("tdf104081.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf88583)
@@ -198,57 +254,93 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf88583)
     CPPUNIT_ASSERT_EQUAL(Color(0x00cc00), getProperty<Color>(getParagraph(1), 
"FillColor"));
 }
 
-DECLARE_RTFEXPORT_TEST(testMargmirror, "margmirror.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testMargmirror)
 {
-    // \margmirror was not handled, this was PageStyleLayout_ALL.
-    uno::Reference<beans::XPropertySet> 
xPageStyle(getStyles("PageStyles")->getByName("Standard"),
-                                                   uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(style::PageStyleLayout_MIRRORED,
-                         getProperty<style::PageStyleLayout>(xPageStyle, 
"PageStyleLayout"));
+    auto verify = [this]() {
+        // \margmirror was not handled, this was PageStyleLayout_ALL.
+        uno::Reference<beans::XPropertySet> xPageStyle(
+            getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(style::PageStyleLayout_MIRRORED,
+                             getProperty<style::PageStyleLayout>(xPageStyle, 
"PageStyleLayout"));
+    };
+    createSwDoc("margmirror.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testSautoupd, "sautoupd.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testSautoupd)
 {
-    // \sautoupd was ignored during import and export.
-    uno::Reference<beans::XPropertySet> xHeading1(
-        getStyles("ParagraphStyles")->getByName("Heading 1"), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xHeading1, "IsAutoUpdate"));
-    uno::Reference<beans::XPropertySet> xHeading2(
-        getStyles("ParagraphStyles")->getByName("Heading 2"), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xHeading2, "IsAutoUpdate"));
+    auto verify = [this]() {
+        // \sautoupd was ignored during import and export.
+        uno::Reference<beans::XPropertySet> xHeading1(
+            getStyles("ParagraphStyles")->getByName("Heading 1"), 
uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xHeading1, 
"IsAutoUpdate"));
+        uno::Reference<beans::XPropertySet> xHeading2(
+            getStyles("ParagraphStyles")->getByName("Heading 2"), 
uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xHeading2, 
"IsAutoUpdate"));
+    };
+    createSwDoc("sautoupd.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testHyphauto, "hyphauto.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testHyphauto)
 {
-    CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getParagraph(1), 
"ParaIsHyphenation"));
+    auto verify = [this]() {
+        CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getParagraph(1), 
"ParaIsHyphenation"));
+    };
+    createSwDoc("hyphauto.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testHyphpar, "hyphpar.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testHyphpar)
 {
-    // Hyphenation was enabled for all 3 paragraphs, but it should be disabled 
for the 2nd one.
-    CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getParagraph(2), 
"ParaIsHyphenation"));
+    auto verify = [this]() {
+        // Hyphenation was enabled for all 3 paragraphs, but it should be 
disabled for the 2nd one.
+        CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getParagraph(2), 
"ParaIsHyphenation"));
+    };
+    createSwDoc("hyphpar.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf108955, "tdf108955.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf108955)
 {
-    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID,
-                         getProperty<drawing::FillStyle>(getParagraph(1), 
"FillStyle"));
-    // This was 0xffffff, i.e. non-white background was overwritten from the 
paragraph style.
-    CPPUNIT_ASSERT_EQUAL(Color(0xffff99), getProperty<Color>(getParagraph(1), 
"FillColor"));
+    auto verify = [this]() {
+        CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID,
+                             getProperty<drawing::FillStyle>(getParagraph(1), 
"FillStyle"));
+        // This was 0xffffff, i.e. non-white background was overwritten from 
the paragraph style.
+        CPPUNIT_ASSERT_EQUAL(Color(0xffff99), 
getProperty<Color>(getParagraph(1), "FillColor"));
+    };
+    createSwDoc("tdf108955.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf80708, "tdf80708.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf80708)
 {
-    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<container::XIndexAccess> 
xTables(xTextTablesSupplier->getTextTables(),
-                                                    uno::UNO_QUERY);
-    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(1), 
uno::UNO_QUERY);
-    uno::Reference<table::XTableRows> xTableRows = xTable->getRows();
-    // This was 2, i.e. the second table had 3 cols, now 2 as expected.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1),
-                         
getProperty<uno::Sequence<text::TableColumnSeparator>>(
-                             xTableRows->getByIndex(0), 
"TableColumnSeparators")
-                             .getLength());
+    auto verify = [this]() {
+        uno::Reference<text::XTextTablesSupplier> 
xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+        uno::Reference<container::XIndexAccess> 
xTables(xTextTablesSupplier->getTextTables(),
+                                                        uno::UNO_QUERY);
+        uno::Reference<text::XTextTable> xTable(xTables->getByIndex(1), 
uno::UNO_QUERY);
+        uno::Reference<table::XTableRows> xTableRows = xTable->getRows();
+        // This was 2, i.e. the second table had 3 cols, now 2 as expected.
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1),
+                             
getProperty<uno::Sequence<text::TableColumnSeparator>>(
+                                 xTableRows->getByIndex(0), 
"TableColumnSeparators")
+                                 .getLength());
+    };
+    createSwDoc("tdf80708.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testHyperlinkWithoutURL)
@@ -274,316 +366,437 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf92521)
     CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf114309, "tdf114309.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf114309)
 {
-    // Without the fix in place, this test would have failed with
-    // - the property is of unexpected type or void: TextSection
-    auto xTextSection
-        = getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(1), 
"TextSection");
-    auto xTextColumns
-        = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, 
"TextColumns");
-    CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+    auto verify = [this]() {
+        // Without the fix in place, this test would have failed with
+        // - the property is of unexpected type or void: TextSection
+        auto xTextSection
+            = 
getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(1), 
"TextSection");
+        auto xTextColumns
+            = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, 
"TextColumns");
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+    };
+    createSwDoc("tdf114309.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf94043, "tdf94043.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf94043)
 {
-    auto xTextSection
-        = getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(2), 
"TextSection");
-    auto xTextColumns
-        = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, 
"TextColumns");
-    // This was 0, the separator line was not visible due to 0 width.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2),
-                         getProperty<sal_Int32>(xTextColumns, 
"SeparatorLineWidth"));
+    auto verify = [this]() {
+        auto xTextSection
+            = 
getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(2), 
"TextSection");
+        auto xTextColumns
+            = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, 
"TextColumns");
+        // This was 0, the separator line was not visible due to 0 width.
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2),
+                             getProperty<sal_Int32>(xTextColumns, 
"SeparatorLineWidth"));
+
+        CPPUNIT_ASSERT_EQUAL(7, getParagraphs());
+    };
+    createSwDoc("tdf94043.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
 
-    CPPUNIT_ASSERT_EQUAL(7, getParagraphs());
+CPPUNIT_TEST_FIXTURE(Test, testTdf94377)
+{
+    auto verify = [this]() {
+        uno::Reference<text::XTextFieldsSupplier> 
xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+        uno::Reference<container::XEnumerationAccess> xFieldsAccess(
+            xTextFieldsSupplier->getTextFields());
+        uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
+        uno::Reference<beans::XPropertySet> 
xPropertySet(xFields->nextElement(), uno::UNO_QUERY);
+        auto xText = getProperty<uno::Reference<text::XText>>(xPropertySet, 
"TextRange");
+        // This failed, as:
+        // 1) multiple paragraphs were not exported, so the text was 
"Asdf10asdf12".
+        // 2) direct formatting of runs were not exported, so this was 12 (the 
document default).
+        CPPUNIT_ASSERT_EQUAL(
+            10.f,
+            getProperty<float>(getRun(getParagraphOfText(1, xText, "Asdf10"), 
1), "CharHeight"));
+        CPPUNIT_ASSERT_EQUAL(
+            12.f,
+            getProperty<float>(getRun(getParagraphOfText(2, xText, "asdf12"), 
1), "CharHeight"));
+    };
+    createSwDoc("tdf94377.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf94377, "tdf94377.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf104079)
 {
-    uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<container::XEnumerationAccess> xFieldsAccess(
-        xTextFieldsSupplier->getTextFields());
-    uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
-    uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), 
uno::UNO_QUERY);
-    auto xText = getProperty<uno::Reference<text::XText>>(xPropertySet, 
"TextRange");
-    // This failed, as:
-    // 1) multiple paragraphs were not exported, so the text was 
"Asdf10asdf12".
-    // 2) direct formatting of runs were not exported, so this was 12 (the 
document default).
-    CPPUNIT_ASSERT_EQUAL(
-        10.f, getProperty<float>(getRun(getParagraphOfText(1, xText, 
"Asdf10"), 1), "CharHeight"));
-    CPPUNIT_ASSERT_EQUAL(
-        12.f, getProperty<float>(getRun(getParagraphOfText(2, xText, 
"asdf12"), 1), "CharHeight"));
+    auto verify = [this]() {
+        bool bFound = false;
+        int nIndex = 0;
+        while (!bFound)
+        {
+            uno::Reference<text::XTextRange> xParagraph = 
getParagraph(++nIndex);
+            if (!xParagraph->getString().startsWith("toc3"))
+                continue;
+
+            bFound = true;
+            // This was 0, 3rd paragraph of ToC lost its bottom paragraph 
margin.
+            CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(212),
+                                 getProperty<sal_Int32>(xParagraph, 
"ParaBottomMargin"));
+        }
+    };
+    createSwDoc("tdf104079.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf104079, "tdf104079.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testPageBackground)
 {
-    bool bFound = false;
-    int nIndex = 0;
-    while (!bFound)
-    {
-        uno::Reference<text::XTextRange> xParagraph = getParagraph(++nIndex);
-        if (!xParagraph->getString().startsWith("toc3"))
-            continue;
-
-        bFound = true;
-        // This was 0, 3rd paragraph of ToC lost its bottom paragraph margin.
-        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(212),
-                             getProperty<sal_Int32>(xParagraph, 
"ParaBottomMargin"));
-    }
+    auto verify = [this]() {
+        // The problem was that ackground was ignored.
+        uno::Reference<beans::XPropertySet> xPageStyle(
+            getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(Color(0x92D050), getProperty<Color>(xPageStyle, 
"BackColor"));
+    };
+    createSwDoc("page-background.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf96175)
+{
+    auto verify = [this]() {
+        // The problem that a user defined property named "Company" was lost 
on export.
+        uno::Reference<document::XDocumentPropertiesSupplier> 
xDocumentPropertiesSupplier(
+            mxComponent, uno::UNO_QUERY);
+        uno::Reference<document::XDocumentProperties> xDocumentProperties
+            = xDocumentPropertiesSupplier->getDocumentProperties();
+        uno::Reference<beans::XPropertyContainer> xUserDefinedProperties
+            = xDocumentProperties->getUserDefinedProperties();
+        // This resulted in a beans::UnknownPropertyException.
+        CPPUNIT_ASSERT_EQUAL(OUString("foobar"),
+                             getProperty<OUString>(xUserDefinedProperties, 
"Company"));
+    };
+    createSwDoc("tdf96175.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testRedline)
+{
+    auto verify = [this]() {
+        CPPUNIT_ASSERT_EQUAL(OUString("Rebecca Lopez"),
+                             getProperty<OUString>(getRun(getParagraph(1), 2), 
"RedlineAuthor"));
+        CPPUNIT_ASSERT_EQUAL(OUString("Dorothy Jones"),
+                             getProperty<OUString>(getRun(getParagraph(2), 2), 
"RedlineAuthor"));
+    };
+    createSwDoc("redline.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testCustomDocProps)
+{
+    auto verify = [this]() {
+        // Custom document properties were not improved, this resulted in a 
beans::UnknownPropertyException.
+        uno::Reference<document::XDocumentPropertiesSupplier> 
xDocumentPropertiesSupplier(
+            mxComponent, uno::UNO_QUERY);
+        uno::Reference<document::XDocumentProperties> xDocumentProperties
+            = xDocumentPropertiesSupplier->getDocumentProperties();
+        uno::Reference<beans::XPropertyContainer> xUserDefinedProperties
+            = xDocumentProperties->getUserDefinedProperties();
+        CPPUNIT_ASSERT_EQUAL(
+            OUString("2016-03-08T10:55:18,531376147"),
+            getProperty<OUString>(xUserDefinedProperties,
+                                  
"urn:bails:IntellectualProperty:Authorization:StartValidity"));
+        CPPUNIT_ASSERT_EQUAL(
+            OUString("None"),
+            getProperty<OUString>(xUserDefinedProperties,
+                                  
"urn:bails:IntellectualProperty:Authorization:StopValidity"));
+        // Test roundtrip of numbers. This failed as getProperty() did not 
find "n".
+        CPPUNIT_ASSERT_EQUAL(42.0, getProperty<double>(xUserDefinedProperties, 
"n"));
+        // Test boolean "yes".
+        CPPUNIT_ASSERT(getProperty<bool>(xUserDefinedProperties, "by"));
+        // Test boolean "no".
+        CPPUNIT_ASSERT(!getProperty<bool>(xUserDefinedProperties, "bn"));
+
+        // Test roundtrip of date in general, and year/month/day in particular.
+        util::DateTime aDate = 
getProperty<util::DateTime>(xUserDefinedProperties, "d");
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2016), aDate.Year);
+        CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(1), aDate.Month);
+        CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(30), aDate.Day);
+
+        // Test real number.
+        CPPUNIT_ASSERT_EQUAL(3.14, getProperty<double>(xUserDefinedProperties, 
"pi"));
+    };
+    createSwDoc("custom-doc-props.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf65642)
+{
+    auto verify = [this]() {
+        uno::Reference<container::XNameAccess> xPageStyles = 
getStyles("PageStyles");
+        uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+        uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+            xModel->getCurrentController(), uno::UNO_QUERY);
+        uno::Reference<text::XPageCursor> 
xCursor(xTextViewCursorSupplier->getViewCursor(),
+                                                  uno::UNO_QUERY);
+        xCursor->jumpToLastPage();
+        OUString pageStyleName = getProperty<OUString>(xCursor, 
"PageStyleName");
+        // The second page's numbering type: this was 
style::NumberingType::ARABIC.
+        CPPUNIT_ASSERT_EQUAL(
+            style::NumberingType::CHARS_UPPER_LETTER_N,
+            getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
+        // The second page's restart value: this was 0.
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1),
+                             getProperty<sal_Int32>(getParagraph(2), 
"PageNumberOffset"));
+    };
+    createSwDoc("tdf65642.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testPgnlcltr)
+{
+    auto verify = [this]() {
+        uno::Reference<container::XNameAccess> xPageStyles = 
getStyles("PageStyles");
+        uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+        uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+            xModel->getCurrentController(), uno::UNO_QUERY);
+        uno::Reference<text::XPageCursor> 
xCursor(xTextViewCursorSupplier->getViewCursor(),
+                                                  uno::UNO_QUERY);
+        xCursor->jumpToLastPage();
+        OUString pageStyleName = getProperty<OUString>(xCursor, 
"PageStyleName");
+        // The second page's numbering type: this was 
style::NumberingType::ARABIC.
+        CPPUNIT_ASSERT_EQUAL(
+            style::NumberingType::CHARS_LOWER_LETTER_N,
+            getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
+    };
+    createSwDoc("pgnlcltr.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testPgnucrm)
+{
+    auto verify = [this]() {
+        uno::Reference<container::XNameAccess> xPageStyles = 
getStyles("PageStyles");
+        uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+        uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+            xModel->getCurrentController(), uno::UNO_QUERY);
+        uno::Reference<text::XPageCursor> 
xCursor(xTextViewCursorSupplier->getViewCursor(),
+                                                  uno::UNO_QUERY);
+        xCursor->jumpToLastPage();
+        OUString pageStyleName = getProperty<OUString>(xCursor, 
"PageStyleName");
+        // The second page's numbering type: this was 
style::NumberingType::ARABIC.
+        CPPUNIT_ASSERT_EQUAL(
+            style::NumberingType::ROMAN_UPPER,
+            getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
+    };
+    createSwDoc("pgnucrm.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testPgnlcrm)
+{
+    auto verify = [this]() {
+        uno::Reference<container::XNameAccess> xPageStyles = 
getStyles("PageStyles");
+        uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+        uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+            xModel->getCurrentController(), uno::UNO_QUERY);
+        uno::Reference<text::XPageCursor> 
xCursor(xTextViewCursorSupplier->getViewCursor(),
+                                                  uno::UNO_QUERY);
+        xCursor->jumpToLastPage();
+        OUString pageStyleName = getProperty<OUString>(xCursor, 
"PageStyleName");
+        // The second page's numbering type: this was 
style::NumberingType::ARABIC.
+        CPPUNIT_ASSERT_EQUAL(
+            style::NumberingType::ROMAN_LOWER,
+            getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
+    };
+    createSwDoc("pgnlcrm.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testPageBackground, "page-background.rtf")
-{
-    // The problem was that ackground was ignored.
-    uno::Reference<beans::XPropertySet> 
xPageStyle(getStyles("PageStyles")->getByName("Standard"),
-                                                   uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(Color(0x92D050), getProperty<Color>(xPageStyle, 
"BackColor"));
-}
-
-DECLARE_RTFEXPORT_TEST(testTdf96175, "tdf96175.rtf")
-{
-    // The problem that a user defined property named "Company" was lost on 
export.
-    uno::Reference<document::XDocumentPropertiesSupplier> 
xDocumentPropertiesSupplier(
-        mxComponent, uno::UNO_QUERY);
-    uno::Reference<document::XDocumentProperties> xDocumentProperties
-        = xDocumentPropertiesSupplier->getDocumentProperties();
-    uno::Reference<beans::XPropertyContainer> xUserDefinedProperties
-        = xDocumentProperties->getUserDefinedProperties();
-    // This resulted in a beans::UnknownPropertyException.
-    CPPUNIT_ASSERT_EQUAL(OUString("foobar"),
-                         getProperty<OUString>(xUserDefinedProperties, 
"Company"));
-}
-
-DECLARE_RTFEXPORT_TEST(testRedline, "redline.rtf")
-{
-    CPPUNIT_ASSERT_EQUAL(OUString("Rebecca Lopez"),
-                         getProperty<OUString>(getRun(getParagraph(1), 2), 
"RedlineAuthor"));
-    CPPUNIT_ASSERT_EQUAL(OUString("Dorothy Jones"),
-                         getProperty<OUString>(getRun(getParagraph(2), 2), 
"RedlineAuthor"));
-}
-
-DECLARE_RTFEXPORT_TEST(testCustomDocProps, "custom-doc-props.rtf")
-{
-    // Custom document properties were not improved, this resulted in a 
beans::UnknownPropertyException.
-    uno::Reference<document::XDocumentPropertiesSupplier> 
xDocumentPropertiesSupplier(
-        mxComponent, uno::UNO_QUERY);
-    uno::Reference<document::XDocumentProperties> xDocumentProperties
-        = xDocumentPropertiesSupplier->getDocumentProperties();
-    uno::Reference<beans::XPropertyContainer> xUserDefinedProperties
-        = xDocumentProperties->getUserDefinedProperties();
-    CPPUNIT_ASSERT_EQUAL(
-        OUString("2016-03-08T10:55:18,531376147"),
-        getProperty<OUString>(xUserDefinedProperties,
-                              
"urn:bails:IntellectualProperty:Authorization:StartValidity"));
-    CPPUNIT_ASSERT_EQUAL(
-        OUString("None"),
-        getProperty<OUString>(xUserDefinedProperties,
-                              
"urn:bails:IntellectualProperty:Authorization:StopValidity"));
-    // Test roundtrip of numbers. This failed as getProperty() did not find 
"n".
-    CPPUNIT_ASSERT_EQUAL(42.0, getProperty<double>(xUserDefinedProperties, 
"n"));
-    // Test boolean "yes".
-    CPPUNIT_ASSERT(getProperty<bool>(xUserDefinedProperties, "by"));
-    // Test boolean "no".
-    CPPUNIT_ASSERT(!getProperty<bool>(xUserDefinedProperties, "bn"));
-
-    // Test roundtrip of date in general, and year/month/day in particular.
-    util::DateTime aDate = getProperty<util::DateTime>(xUserDefinedProperties, 
"d");
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2016), aDate.Year);
-    CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(1), aDate.Month);
-    CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(30), aDate.Day);
-
-    // Test real number.
-    CPPUNIT_ASSERT_EQUAL(3.14, getProperty<double>(xUserDefinedProperties, 
"pi"));
-}
-
-DECLARE_RTFEXPORT_TEST(testTdf65642, "tdf65642.rtf")
-{
-    uno::Reference<container::XNameAccess> xPageStyles = 
getStyles("PageStyles");
-    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
-    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
-        xModel->getCurrentController(), uno::UNO_QUERY);
-    uno::Reference<text::XPageCursor> 
xCursor(xTextViewCursorSupplier->getViewCursor(),
-                                              uno::UNO_QUERY);
-    xCursor->jumpToLastPage();
-    OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
-    // The second page's numbering type: this was style::NumberingType::ARABIC.
-    CPPUNIT_ASSERT_EQUAL(
-        style::NumberingType::CHARS_UPPER_LETTER_N,
-        getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
-    // The second page's restart value: this was 0.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1),
-                         getProperty<sal_Int32>(getParagraph(2), 
"PageNumberOffset"));
-}
-
-DECLARE_RTFEXPORT_TEST(testPgnlcltr, "pgnlcltr.rtf")
-{
-    uno::Reference<container::XNameAccess> xPageStyles = 
getStyles("PageStyles");
-    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
-    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
-        xModel->getCurrentController(), uno::UNO_QUERY);
-    uno::Reference<text::XPageCursor> 
xCursor(xTextViewCursorSupplier->getViewCursor(),
-                                              uno::UNO_QUERY);
-    xCursor->jumpToLastPage();
-    OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
-    // The second page's numbering type: this was style::NumberingType::ARABIC.
-    CPPUNIT_ASSERT_EQUAL(
-        style::NumberingType::CHARS_LOWER_LETTER_N,
-        getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
-}
-
-DECLARE_RTFEXPORT_TEST(testPgnucrm, "pgnucrm.rtf")
-{
-    uno::Reference<container::XNameAccess> xPageStyles = 
getStyles("PageStyles");
-    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
-    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
-        xModel->getCurrentController(), uno::UNO_QUERY);
-    uno::Reference<text::XPageCursor> 
xCursor(xTextViewCursorSupplier->getViewCursor(),
-                                              uno::UNO_QUERY);
-    xCursor->jumpToLastPage();
-    OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
-    // The second page's numbering type: this was style::NumberingType::ARABIC.
-    CPPUNIT_ASSERT_EQUAL(
-        style::NumberingType::ROMAN_UPPER,
-        getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
-}
-
-DECLARE_RTFEXPORT_TEST(testPgnlcrm, "pgnlcrm.rtf")
-{
-    uno::Reference<container::XNameAccess> xPageStyles = 
getStyles("PageStyles");
-    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
-    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
-        xModel->getCurrentController(), uno::UNO_QUERY);
-    uno::Reference<text::XPageCursor> 
xCursor(xTextViewCursorSupplier->getViewCursor(),
-                                              uno::UNO_QUERY);
-    xCursor->jumpToLastPage();
-    OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
-    // The second page's numbering type: this was style::NumberingType::ARABIC.
-    CPPUNIT_ASSERT_EQUAL(
-        style::NumberingType::ROMAN_LOWER,
-        getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
-}
-
-DECLARE_RTFEXPORT_TEST(testPgndec, "pgndec.rtf")
-{
-    uno::Reference<container::XNameAccess> xPageStyles = 
getStyles("PageStyles");
-    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
-    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
-        xModel->getCurrentController(), uno::UNO_QUERY);
-    uno::Reference<text::XPageCursor> 
xCursor(xTextViewCursorSupplier->getViewCursor(),
-                                              uno::UNO_QUERY);
-    xCursor->jumpToLastPage();
-    OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
-    // The second page's numbering type: this was 
style::NumberingType::ROMAN_LOWER.
-    CPPUNIT_ASSERT_EQUAL(
-        style::NumberingType::ARABIC,
-        getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
-
-    // tdf#82111 ensure a paragraph exists before a section break.
-    // This was only two paragraphs, and both page number fields were in one 
para on page 2 ("11").
-    getParagraph(2, "1");
-    CPPUNIT_ASSERT_EQUAL(3, getParagraphs());
-}
-
-DECLARE_RTFEXPORT_TEST(testTdf98806, "tdf98806.rtf")
-{
-    uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<text::XTextContent> xBookmark(
-        xBookmarksSupplier->getBookmarks()->getByName("bookmark"), 
uno::UNO_QUERY);
-    // This was empty, bookmark in table wasn't imported correctly.
-    CPPUNIT_ASSERT_EQUAL(OUString("BBB"), xBookmark->getAnchor()->getString());
-}
-
-DECLARE_RTFEXPORT_TEST(testTdf61901, "tdf61901.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testPgndec)
 {
+    auto verify = [this]() {
+        uno::Reference<container::XNameAccess> xPageStyles = 
getStyles("PageStyles");
+        uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+        uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+            xModel->getCurrentController(), uno::UNO_QUERY);
+        uno::Reference<text::XPageCursor> 
xCursor(xTextViewCursorSupplier->getViewCursor(),
+                                                  uno::UNO_QUERY);
+        xCursor->jumpToLastPage();
+        OUString pageStyleName = getProperty<OUString>(xCursor, 
"PageStyleName");
+        // The second page's numbering type: this was 
style::NumberingType::ROMAN_LOWER.
+        CPPUNIT_ASSERT_EQUAL(
+            style::NumberingType::ARABIC,
+            getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
+
+        // tdf#82111 ensure a paragraph exists before a section break.
+        // This was only two paragraphs, and both page number fields were in 
one para on page 2 ("11").
+        getParagraph(2, "1");
+        CPPUNIT_ASSERT_EQUAL(3, getParagraphs());
+    };
+    createSwDoc("pgndec.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf98806)
+{
+    auto verify = [this]() {
+        uno::Reference<text::XBookmarksSupplier> 
xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
+        uno::Reference<text::XTextContent> xBookmark(
+            xBookmarksSupplier->getBookmarks()->getByName("bookmark"), 
uno::UNO_QUERY);
+        // This was empty, bookmark in table wasn't imported correctly.
+        CPPUNIT_ASSERT_EQUAL(OUString("BBB"), 
xBookmark->getAnchor()->getString());
+    };
+    createSwDoc("tdf98806.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf61901)
+{
+    createSwDoc("tdf61901.rtf");
+    save(mpFilter);
     // Test the file directly, as current RTF import gives the correct font 
name with and without the fix.
-    if (isExported())
+    SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
+    OString sLine;
+    while (pStream->ReadLine(sLine))
     {
-        SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
-        OString sLine;
-        while (pStream->ReadLine(sLine))
+        sal_Int32 nIndex = sLine.indexOf("\loch\loch");
+        if (nIndex != -1)
         {
-            sal_Int32 nIndex = sLine.indexOf("\loch\loch");
-            if (nIndex != -1)
-            {
-                // Make sure that \hich is always written after a \loch\loch.
-                OString sRemaining = sLine.copy(nIndex);
-                CPPUNIT_ASSERT(sRemaining.indexOf("\hich") != -1);
-            }
+            // Make sure that \hich is always written after a \loch\loch.
+            OString sRemaining = sLine.copy(nIndex);
+            CPPUNIT_ASSERT(sRemaining.indexOf("\hich") != -1);
         }
     }
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf103925, "tdf103925.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf103925)
 {
-    // This was true, nimtext0 resulted in setting the blinking font effect.
-    CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getRun(getParagraph(1), 1), 
"CharFlash"));
+    auto verify = [this]() {
+        // This was true, nimtext0 resulted in setting the blinking font 
effect.
+        CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getRun(getParagraph(1), 
1), "CharFlash"));
+    };
+    createSwDoc("tdf103925.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf104228, "tdf104228.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf104228)
 {
-    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), 
uno::UNO_QUERY);
-    uno::Reference<text::XTextRange> xCell(xTable->getCellByName("C1"), 
uno::UNO_QUERY);
-    uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, 
xCell->getText());
-    // This was 2103, implicit 0 as direct formatting was ignored on the
-    // paragraph (and the style had this larger value).
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0),
-                         getProperty<sal_Int32>(xParagraph, "ParaLeftMargin"));
+    auto verify = [this]() {
+        uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), 
uno::UNO_QUERY);
+        uno::Reference<text::XTextRange> xCell(xTable->getCellByName("C1"), 
uno::UNO_QUERY);
+        uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, 
xCell->getText());
+        // This was 2103, implicit 0 as direct formatting was ignored on the
+        // paragraph (and the style had this larger value).
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0),
+                             getProperty<sal_Int32>(xParagraph, 
"ParaLeftMargin"));
+    };
+    createSwDoc("tdf104228.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf104085, "tdf104085.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf104085)
 {
-    uno::Reference<text::XTextRange> xPara(getParagraph(1));
-    uno::Reference<beans::XPropertySet> properties(xPara, uno::UNO_QUERY);
-    uno::Reference<container::XIndexAccess> 
xLevels(properties->getPropertyValue("NumberingRules"),
-                                                    uno::UNO_QUERY);
-    uno::Sequence<beans::PropertyValue> aProps;
-    xLevels->getByIndex(0) >>= aProps;
-    for (beans::PropertyValue const& prop : aProps)
-    {
-        if (prop.Name == "BulletChar")
-            return;
-    }
-    CPPUNIT_FAIL("no BulletChar property");
+    auto verify = [this]() {
+        uno::Reference<text::XTextRange> xPara(getParagraph(1));
+        uno::Reference<beans::XPropertySet> properties(xPara, uno::UNO_QUERY);
+        uno::Reference<container::XIndexAccess> xLevels(
+            properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+        uno::Sequence<beans::PropertyValue> aProps;
+        xLevels->getByIndex(0) >>= aProps;
+        for (beans::PropertyValue const& prop : aProps)
+        {
+            if (prop.Name == "BulletChar")
+                return;
+        }
+        CPPUNIT_FAIL("no BulletChar property");
+    };
+    createSwDoc("tdf104085.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf113550, "tdf113550.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf113550)
 {
-    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), 
uno::UNO_QUERY);
-    uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
-    uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, 
xCell->getText());
-    // This was 2501, 0 as direct formatting was ignored on the paragraph (and
-    // the style had this larger value).
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0),
-                         getProperty<sal_Int32>(xParagraph, "ParaLeftMargin"));
+    auto verify = [this]() {
+        uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), 
uno::UNO_QUERY);
+        uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+        uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, 
xCell->getText());
+        // This was 2501, 0 as direct formatting was ignored on the paragraph 
(and
+        // the style had this larger value).
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0),
+                             getProperty<sal_Int32>(xParagraph, 
"ParaLeftMargin"));
+    };
+    createSwDoc("tdf113550.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testLeveljcCenter, "leveljc-center.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testLeveljcCenter)
 {
-    // Tests that \leveljc1 is mapped to Adjust=Center for a numbering rule.
-    uno::Reference<text::XTextRange> xPara(getParagraph(1));
-    uno::Reference<beans::XPropertySet> properties(xPara, uno::UNO_QUERY);
-    uno::Reference<container::XIndexAccess> 
xLevels(properties->getPropertyValue("NumberingRules"),
-                                                    uno::UNO_QUERY);
-    uno::Sequence<beans::PropertyValue> aProps;
-    xLevels->getByIndex(0) >>= aProps;
-    for (beans::PropertyValue const& prop : aProps)
-    {
-        if (prop.Name == "Adjust")
+    auto verify = [this]() {
+        // Tests that \leveljc1 is mapped to Adjust=Center for a numbering 
rule.
+        uno::Reference<text::XTextRange> xPara(getParagraph(1));
+        uno::Reference<beans::XPropertySet> properties(xPara, uno::UNO_QUERY);
+        uno::Reference<container::XIndexAccess> xLevels(
+            properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+        uno::Sequence<beans::PropertyValue> aProps;
+        xLevels->getByIndex(0) >>= aProps;
+        for (beans::PropertyValue const& prop : aProps)
         {
-            sal_Int16 nValue = 0;
-            CPPUNIT_ASSERT(prop.Value >>= nValue);
-            CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
-            return;
+            if (prop.Name == "Adjust")
+            {
+                sal_Int16 nValue = 0;
+                CPPUNIT_ASSERT(prop.Value >>= nValue);
+                CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
+                return;
+            }
         }
-    }
-    CPPUNIT_FAIL("no Adjust property");
+        CPPUNIT_FAIL("no Adjust property");
+    };
+    createSwDoc("leveljc-center.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testHyperlinkTarget, "hyperlink-target.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testHyperlinkTarget)
 {
-    // This was empty, hyperlink target was lost on import.
-    CPPUNIT_ASSERT_EQUAL(OUString("_blank"),
-                         getProperty<OUString>(getRun(getParagraph(1), 1), 
"HyperLinkTarget"));
+    auto verify = [this]() {
+        // This was empty, hyperlink target was lost on import.
+        CPPUNIT_ASSERT_EQUAL(OUString("_blank"),
+                             getProperty<OUString>(getRun(getParagraph(1), 1), 
"HyperLinkTarget"));
+    };
+    createSwDoc("hyperlink-target.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf107620)
@@ -599,189 +812,272 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf107620)
     CPPUNIT_ASSERT(!bAddParaTableSpacing);
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf104937, "tdf104937.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf104937)
 {
-    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<container::XIndexAccess> 
xTables(xTextTablesSupplier->getTextTables(),
-                                                    uno::UNO_QUERY);
-    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
-    uno::Reference<table::XTableRows> xTableRows = xTable->getRows();
-    auto aSeparators = getProperty<uno::Sequence<text::TableColumnSeparator>>(
-        xTableRows->getByIndex(1), "TableColumnSeparators");
-    // First table's second row had 9 cells (so 8 separators).
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(8), aSeparators.getLength());
-    // This was 3174, i.e. last cell was wider than expected, while others were
-    // narrower.
-    CPPUNIT_ASSERT_GREATER(static_cast<sal_Int16>(4500), 
aSeparators[7].Position);
+    auto verify = [this]() {
+        uno::Reference<text::XTextTablesSupplier> 
xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+        uno::Reference<container::XIndexAccess> 
xTables(xTextTablesSupplier->getTextTables(),
+                                                        uno::UNO_QUERY);
+        uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+        uno::Reference<table::XTableRows> xTableRows = xTable->getRows();
+        auto aSeparators = 
getProperty<uno::Sequence<text::TableColumnSeparator>>(
+            xTableRows->getByIndex(1), "TableColumnSeparators");
+        // First table's second row had 9 cells (so 8 separators).
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(8), 
aSeparators.getLength());
+        // This was 3174, i.e. last cell was wider than expected, while others 
were
+        // narrower.
+        CPPUNIT_ASSERT_GREATER(static_cast<sal_Int16>(4500), 
aSeparators[7].Position);
+    };
+    createSwDoc("tdf104937.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf112507, "tdf112507.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf112507)
 {
-    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<container::XIndexAccess> 
xTables(xTextTablesSupplier->getTextTables(),
-                                                    uno::UNO_QUERY);
-    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
-    uno::Reference<table::XTableRows> xTableRows = xTable->getRows();
-    auto aSeparators = getProperty<uno::Sequence<text::TableColumnSeparator>>(
-        xTableRows->getByIndex(1), "TableColumnSeparators");
-    // First table's second row had 3 cells (so 2 separators).
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), aSeparators.getLength());
-    // This was 3333, i.e. the B2 cell was too narrow and the text needed 2 
lines.
-    CPPUNIT_ASSERT_GREATEREQUAL(5000, aSeparators[1].Position - 
aSeparators[0].Position);
+    auto verify = [this]() {
+        uno::Reference<text::XTextTablesSupplier> 
xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+        uno::Reference<container::XIndexAccess> 
xTables(xTextTablesSupplier->getTextTables(),
+                                                        uno::UNO_QUERY);
+        uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+        uno::Reference<table::XTableRows> xTableRows = xTable->getRows();
+        auto aSeparators = 
getProperty<uno::Sequence<text::TableColumnSeparator>>(
+            xTableRows->getByIndex(1), "TableColumnSeparators");
+        // First table's second row had 3 cells (so 2 separators).
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), 
aSeparators.getLength());
+        // This was 3333, i.e. the B2 cell was too narrow and the text needed 
2 lines.
+        CPPUNIT_ASSERT_GREATEREQUAL(5000, aSeparators[1].Position - 
aSeparators[0].Position);
+    };
+    createSwDoc("tdf112507.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf107480, "tdf107480.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf107480)
 {
-    // These were 176 (100 twips), as \htmautsp was parsed too late.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(1), 
"ParaTopMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
-                         getProperty<sal_Int32>(getParagraph(1), 
"ParaBottomMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
-                         getProperty<sal_Int32>(getParagraph(2), 
"ParaTopMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
-                         getProperty<sal_Int32>(getParagraph(2), 
"ParaBottomMargin"));
+    auto verify = [this]() {
+        // These were 176 (100 twips), as \htmautsp was parsed too late.
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0),
+                             getProperty<sal_Int32>(getParagraph(1), 
"ParaTopMargin"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
+                             getProperty<sal_Int32>(getParagraph(1), 
"ParaBottomMargin"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
+                             getProperty<sal_Int32>(getParagraph(2), 
"ParaTopMargin"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)),
+                             getProperty<sal_Int32>(getParagraph(2), 
"ParaBottomMargin"));
+    };
+    createSwDoc("tdf107480.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testWatermark, "watermark.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testWatermark)
 {
-    uno::Reference<text::XTextRange> xShape(getShape(1), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(OUString("WatermarkRTF"), xShape->getString());
+    auto verify = [this]() {
+        uno::Reference<text::XTextRange> xShape(getShape(1), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(OUString("WatermarkRTF"), xShape->getString());
 
-    uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
-    OUString aFont;
-    float nFontSize;
+        uno::Reference<beans::XPropertySet> xPropertySet(xShape, 
uno::UNO_QUERY);
+        OUString aFont;
+        float nFontSize;
 
-    // Check transparency
-    CPPUNIT_ASSERT_EQUAL(sal_Int16(50), getProperty<sal_Int16>(xShape, 
"FillTransparence"));
+        // Check transparency
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(50), getProperty<sal_Int16>(xShape, 
"FillTransparence"));
 
-    // Check font family
-    CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CharFontName") >>= aFont);
-    CPPUNIT_ASSERT_EQUAL(OUString("DejaVu Serif"), aFont);
+        // Check font family
+        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CharFontName") >>= 
aFont);
+        CPPUNIT_ASSERT_EQUAL(OUString("DejaVu Serif"), aFont);
 
-    // Check font size
-    CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CharHeight") >>= nFontSize);
-    CPPUNIT_ASSERT_EQUAL(float(66), nFontSize);
+        // Check font size
+        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CharHeight") >>= 
nFontSize);
+        CPPUNIT_ASSERT_EQUAL(float(66), nFontSize);
+    };
+    createSwDoc("watermark.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf153194Compat, "page-break-emptyparas.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf153194Compat)
 {
-    CPPUNIT_ASSERT_EQUAL(2, getPages());
-    // no \spltpgpar => paragraph 2 on page 1
-    CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
-                         getProperty<style::BreakType>(getParagraph(1), 
"BreakType"));
-    CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE,
-                         getProperty<style::BreakType>(getParagraph(2), 
"BreakType"));
-    CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
-                         getProperty<style::BreakType>(getParagraph(3), 
"BreakType"));
+    auto verify = [this]() {
+        CPPUNIT_ASSERT_EQUAL(2, getPages());
+        // no \spltpgpar => paragraph 2 on page 1
+        CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
+                             getProperty<style::BreakType>(getParagraph(1), 
"BreakType"));
+        CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE,
+                             getProperty<style::BreakType>(getParagraph(2), 
"BreakType"));
+        CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
+                             getProperty<style::BreakType>(getParagraph(3), 
"BreakType"));
+    };
+    createSwDoc("page-break-emptyparas.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf153194New, "page-break-emptyparas-spltpgpar.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf153194New)
 {
-    CPPUNIT_ASSERT_EQUAL(2, getPages());
-    // \spltpgpar => paragraph 2 on page 2
-    CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
-                         getProperty<style::BreakType>(getParagraph(1), 
"BreakType"));
-    CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
-                         getProperty<style::BreakType>(getParagraph(2), 
"BreakType"));
-    CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE,
-                         getProperty<style::BreakType>(getParagraph(3), 
"BreakType"));
+    auto verify = [this]() {
+        CPPUNIT_ASSERT_EQUAL(2, getPages());
+        // \spltpgpar => paragraph 2 on page 2
+        CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
+                             getProperty<style::BreakType>(getParagraph(1), 
"BreakType"));
+        CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
+                             getProperty<style::BreakType>(getParagraph(2), 
"BreakType"));
+        CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE,
+                             getProperty<style::BreakType>(getParagraph(3), 
"BreakType"));
+    };
+    createSwDoc("page-break-emptyparas-spltpgpar.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf153178, "tdf153178.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf153178)
 {
-    // the problem was that a frame was created
-    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<container::XIndexAccess> 
xIndexAccess(xTextFramesSupplier->getTextFrames(),
-                                                         uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+    auto verify = [this]() {
+        // the problem was that a frame was created
+        uno::Reference<text::XTextFramesSupplier> 
xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+        uno::Reference<container::XIndexAccess> 
xIndexAccess(xTextFramesSupplier->getTextFrames(),
+                                                             uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+    };
+    createSwDoc("tdf153178.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf109790, "tdf109790.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf109790)
 {
-    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), 
uno::UNO_QUERY);
-    uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
-    // Style information was reset, which caused character height to be 22.
-    CPPUNIT_ASSERT_EQUAL(
-        10.f, getProperty<float>(getRun(getParagraphOfText(1, 
xCell->getText()), 1), "CharHeight"));
+    auto verify = [this]() {
+        uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), 
uno::UNO_QUERY);
+        uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+        // Style information was reset, which caused character height to be 22.
+        CPPUNIT_ASSERT_EQUAL(
+            10.f,
+            getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()), 
1), "CharHeight"));
+    };
+    createSwDoc("tdf109790.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf112211, "tdf112211.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf112211)
 {
-    // This was 0, i in a list level definition was not imported.
-    auto xRules = getProperty<uno::Reference<container::XIndexAccess>>(
-        getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules");
-    comphelper::SequenceAsHashMap aRule(xRules->getByIndex(0));
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-635), 
aRule["FirstLineIndent"].get<sal_Int32>());
+    auto verify = [this]() {
+        // This was 0, i in a list level definition was not imported.
+        auto xRules = getProperty<uno::Reference<container::XIndexAccess>>(
+            getStyles("NumberingStyles")->getByName("WWNum1"), 
"NumberingRules");
+        comphelper::SequenceAsHashMap aRule(xRules->getByIndex(0));
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-635),
+                             aRule["FirstLineIndent"].get<sal_Int32>());
+    };
+    createSwDoc("tdf112211.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf113202, "tdf113202.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf113202)
 {
-    // This failed, contextual spacing in 4th paragraph was lost.
-    CPPUNIT_ASSERT(getProperty<bool>(getParagraph(4), "ParaContextMargin"));
+    auto verify = [this]() {
+        // This failed, contextual spacing in 4th paragraph was lost.
+        CPPUNIT_ASSERT(getProperty<bool>(getParagraph(4), 
"ParaContextMargin"));
+    };
+    createSwDoc("tdf113202.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf156030, "tdf156030.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf156030)
 {
-    uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<container::XEnumerationAccess> xFieldsAccess(
-        xTextFieldsSupplier->getTextFields());
-    uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
+    auto verify = [this]() {
+        uno::Reference<text::XTextFieldsSupplier> 
xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+        uno::Reference<container::XEnumerationAccess> xFieldsAccess(
+            xTextFieldsSupplier->getTextFields());
+        uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
+
+        // As usual, fields given by FieldsAccess are not in same order as in 
the document
+        // (mostly in reverse order, thanks to SwModify::Add)
+        std::vector<std::vector<OUString>> aExpectedValues = {
+            { "1 FORMULA 2", "true value 1", "false value 1" }, // #1, 
condition should be 1 = 2
+            { "", "", "" }, // #9, not enough field params
+            { "1 1 FORMULA 1 2 1 true value 8 fal", "se",
+              "value 8" }, // #8, nonsense in field params
+            { "1 1 FORMULA 1 2 1 true value 7 false", "value", "7" }, // #7, 
another parse error
+            { "1 < 2", "true value 6", "false value 6" }, // #6
+            { "1 > 2", "true value 5", "false value 5" }, // #5
+            { "1 <> 2", "true value 4", "false value 4" }, // #4
+            { "1 != 2", "true value 3", "false value 3" }, // #3
+            { "1 FORMULA FORMULA 2", "true value 2",
+              "false value 2" }, // #2, condition expected 1 == 2
+        };
+        uno::Reference<beans::XPropertySet> xPropertySet;
+        OUString sValue;
+
+        for (const auto& aValues : aExpectedValues)
+        {
+            xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY_THROW);
+            CPPUNIT_ASSERT(xPropertySet.is());
+            CPPUNIT_ASSERT(xPropertySet->getPropertyValue("Condition") >>= 
sValue);
+            CPPUNIT_ASSERT_EQUAL(aValues[0], sValue);
+            CPPUNIT_ASSERT(xPropertySet->getPropertyValue("TrueContent") >>= 
sValue);
+            CPPUNIT_ASSERT_EQUAL(aValues[1], sValue);
+            CPPUNIT_ASSERT(xPropertySet->getPropertyValue("FalseContent") >>= 
sValue);
+            CPPUNIT_ASSERT_EQUAL(aValues[2], sValue);
+        }
 
-    // As usual, fields given by FieldsAccess are not in same order as in the 
document
-    // (mostly in reverse order, thanks to SwModify::Add)
-    std::vector<std::vector<OUString>> aExpectedValues = {
-        { "1 FORMULA 2", "true value 1", "false value 1" }, // #1, condition 
should be 1 = 2
-        { "", "", "" }, // #9, not enough field params
-        { "1 1 FORMULA 1 2 1 true value 8 fal", "se", "value 8" }, // #8, 
nonsense in field params
-        { "1 1 FORMULA 1 2 1 true value 7 false", "value", "7" }, // #7, 
another parse error
-        { "1 < 2", "true value 6", "false value 6" }, // #6
-        { "1 > 2", "true value 5", "false value 5" }, // #5
-        { "1 <> 2", "true value 4", "false value 4" }, // #4
-        { "1 != 2", "true value 3", "false value 3" }, // #3
-        { "1 FORMULA FORMULA 2", "true value 2", "false value 2" }, // #2, 
condition expected 1 == 2
+        // No more fields
+        CPPUNIT_ASSERT(!xFields->hasMoreElements());
     };
-    uno::Reference<beans::XPropertySet> xPropertySet;
-    OUString sValue;
-
-    for (const auto& aValues : aExpectedValues)
-    {
-        xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY_THROW);
-        CPPUNIT_ASSERT(xPropertySet.is());
-        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("Condition") >>= sValue);
-        CPPUNIT_ASSERT_EQUAL(aValues[0], sValue);
-        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("TrueContent") >>= 
sValue);
-        CPPUNIT_ASSERT_EQUAL(aValues[1], sValue);
-        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("FalseContent") >>= 
sValue);
-        CPPUNIT_ASSERT_EQUAL(aValues[2], sValue);
-    }
-
-    // No more fields
-    CPPUNIT_ASSERT(!xFields->hasMoreElements());
+    createSwDoc("tdf156030.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf153195, "tdf153195.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf153195)
 {
-    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<container::XIndexAccess> 
xTables(xTextTablesSupplier->getTextTables(),
-                                                    uno::UNO_QUERY);
-
-    // Table margin test (cannot be set to exact value, it jumps between -1991 
and -1983)
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(-2182),
-                                 
getProperty<sal_Int32>(xTables->getByIndex(0), "LeftMargin"), 10);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(-2182),
-                                 
getProperty<sal_Int32>(xTables->getByIndex(1), "LeftMargin"), 10);
+    auto verify = [this]() {
+        uno::Reference<text::XTextTablesSupplier> 
xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+        uno::Reference<container::XIndexAccess> 
xTables(xTextTablesSupplier->getTextTables(),
+                                                        uno::UNO_QUERY);
+
+        // Table margin test (cannot be set to exact value, it jumps between 
-1991 and -1983)
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(
+            sal_Int32(-2182), getProperty<sal_Int32>(xTables->getByIndex(0), 
"LeftMargin"), 10);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(
+            sal_Int32(-2182), getProperty<sal_Int32>(xTables->getByIndex(1), 
"LeftMargin"), 10);
+    };
+    createSwDoc("tdf153195.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf158762, "tdf158762.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf158762)
 {
-    for (int paragraph = 3; paragraph < 6; ++paragraph)
-    {
-        uno::Reference<text::XTextRange> xPara(getParagraph(paragraph));
-        uno::Reference<beans::XPropertySet> properties(xPara, uno::UNO_QUERY);
-        uno::Reference<container::XIndexAccess> xLevels(
-            properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
-        CPPUNIT_ASSERT(xLevels.is());
-    }
+    auto verify = [this]() {
+        for (int paragraph = 3; paragraph < 6; ++paragraph)
+        {
+            uno::Reference<text::XTextRange> xPara(getParagraph(paragraph));
+            uno::Reference<beans::XPropertySet> properties(xPara, 
uno::UNO_QUERY);
+            uno::Reference<container::XIndexAccess> xLevels(
+                properties->getPropertyValue("NumberingRules"), 
uno::UNO_QUERY);
+            CPPUNIT_ASSERT(xLevels.is());
+        }
+    };
+    createSwDoc("tdf158762.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
 }
 
 } // end of anonymous namespace

Reply via email to