[Libreoffice-commits] core.git: sw/qa

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 30 06:33:10 UTC 2021


 sw/qa/extras/txtimport/txtimport.cxx |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

New commits:
commit dbbd4f356487d7d4f68cddd5a06a71f236d358ed
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jun 29 20:48:25 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Jun 30 08:32:35 2021 +0200

    sw: rework to avoid DECLARE_SW_IMPORT_TEST() in CppunitTest_sw_txtimport
    
    See commit a226cec52e536c46e03f57a5f1f7931abbeb0cdd
    (CppunitTest_sw_rtfimport: convert one testcase to use
    CPPUNIT_TEST_FIXTURE(), 2019-11-05) for motivation.
    
    Change-Id: Ic272bbecada260d22fa30e6e39a92be3d503d403
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118133
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/txtimport/txtimport.cxx b/sw/qa/extras/txtimport/txtimport.cxx
index c14ce8e0ad5b..3a506d42227f 100644
--- a/sw/qa/extras/txtimport/txtimport.cxx
+++ b/sw/qa/extras/txtimport/txtimport.cxx
@@ -47,11 +47,9 @@ public:
     }
 };
 
-#define DECLARE_TXTIMPORT_TEST(TestName, filename)                                                 \
-    DECLARE_SW_IMPORT_TEST(TestName, filename, nullptr, TxtImportTest)
-
-DECLARE_TXTIMPORT_TEST(testTdf112191, "bullets.odt")
+CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf112191)
 {
+    load(mpTestDocumentPath, "bullets.odt");
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
@@ -79,8 +77,9 @@ DECLARE_TXTIMPORT_TEST(testTdf112191, "bullets.odt")
     assertExportedRange(OUStringToOString(aString, osl_getThreadTextEncoding()), aPaM3);
 }
 
-DECLARE_TXTIMPORT_TEST(testTdf60145_utf8withoutbom, "UTF8WITHOUTBOM.txt")
+CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withoutbom)
 {
+    load(mpTestDocumentPath, "UTF8WITHOUTBOM.txt");
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
@@ -91,8 +90,9 @@ DECLARE_TXTIMPORT_TEST(testTdf60145_utf8withoutbom, "UTF8WITHOUTBOM.txt")
     CPPUNIT_ASSERT_EQUAL(OUString(u"漢a'"), xPara->getString());
 }
 
-DECLARE_TXTIMPORT_TEST(testTdf60145_utf8withbom, "UTF8WITHBOM.txt")
+CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withbom)
 {
+    load(mpTestDocumentPath, "UTF8WITHBOM.txt");
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
@@ -103,8 +103,9 @@ DECLARE_TXTIMPORT_TEST(testTdf60145_utf8withbom, "UTF8WITHBOM.txt")
     CPPUNIT_ASSERT_EQUAL(OUString(u"漢a'"), xPara->getString());
 }
 
-DECLARE_TXTIMPORT_TEST(testTdf60145_utf16lewithoutbom, "UTF16LEWITHOUTBOM.txt")
+CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithoutbom)
 {
+    load(mpTestDocumentPath, "UTF16LEWITHOUTBOM.txt");
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
@@ -115,8 +116,9 @@ DECLARE_TXTIMPORT_TEST(testTdf60145_utf16lewithoutbom, "UTF16LEWITHOUTBOM.txt")
     CPPUNIT_ASSERT_EQUAL(OUString(u"漢a'"), xPara->getString());
 }
 
-DECLARE_TXTIMPORT_TEST(testTdf60145_utf16lewithbom, "UTF16LEWITHBOM.txt")
+CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithbom)
 {
+    load(mpTestDocumentPath, "UTF16LEWITHBOM.txt");
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
@@ -127,8 +129,9 @@ DECLARE_TXTIMPORT_TEST(testTdf60145_utf16lewithbom, "UTF16LEWITHBOM.txt")
     CPPUNIT_ASSERT_EQUAL(OUString(u"漢a'"), xPara->getString());
 }
 
-DECLARE_TXTIMPORT_TEST(testTdf60145_utf16bewithoutbom, "UTF16BEWITHOUTBOM.txt")
+CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithoutbom)
 {
+    load(mpTestDocumentPath, "UTF16BEWITHOUTBOM.txt");
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
@@ -139,8 +142,9 @@ DECLARE_TXTIMPORT_TEST(testTdf60145_utf16bewithoutbom, "UTF16BEWITHOUTBOM.txt")
     CPPUNIT_ASSERT_EQUAL(OUString(u"漢a'"), xPara->getString());
 }
 
-DECLARE_TXTIMPORT_TEST(testTdf60145_utf16bewithbom, "UTF16BEWITHBOM.txt")
+CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithbom)
 {
+    load(mpTestDocumentPath, "UTF16BEWITHBOM.txt");
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();


More information about the Libreoffice-commits mailing list