sfx2/CppunitTest_sfx2_classification.mk |    1 
 sfx2/CppunitTest_sfx2_doc.mk            |    1 
 sfx2/qa/cppunit/doc.cxx                 |   44 +++++++++-----------------------
 sfx2/qa/cppunit/test_classification.cxx |   28 +++++---------------
 4 files changed, 22 insertions(+), 52 deletions(-)

New commits:
commit e76cc516135736d2ae1cfe3c178cacd05a7abbcc
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Nov 1 20:29:27 2022 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Nov 1 21:52:38 2022 +0100

    CppunitTest_sfx2_classification: inherit from UnoApiTest
    
    Change-Id: Iab05ead4aecc619c41cac7cfcfa8e3f57ef21601
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142123
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sfx2/CppunitTest_sfx2_classification.mk 
b/sfx2/CppunitTest_sfx2_classification.mk
index 303d3099d9a7..90e2061009ae 100644
--- a/sfx2/CppunitTest_sfx2_classification.mk
+++ b/sfx2/CppunitTest_sfx2_classification.mk
@@ -23,6 +23,7 @@ $(eval $(call 
gb_CppunitTest_use_libraries,sfx2_classification, \
        unotest \
        vcl \
     sal \
+    subsequenttest \
     sfx \
 ))
 
diff --git a/sfx2/qa/cppunit/test_classification.cxx 
b/sfx2/qa/cppunit/test_classification.cxx
index 45d2947882f3..ffa90089fd8d 100644
--- a/sfx2/qa/cppunit/test_classification.cxx
+++ b/sfx2/qa/cppunit/test_classification.cxx
@@ -7,8 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <test/bootstrapfixture.hxx>
-#include <unotest/macros_test.hxx>
+#include <test/unoapi_test.hxx>
 
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
@@ -24,14 +23,16 @@ namespace
 {
 
 /// Tests the handling of the .uno:ClassificationApply command in various 
applications.
-class ClassificationTest : public test::BootstrapFixture, public 
unotest::MacrosTest
+class ClassificationTest : public UnoApiTest
 {
-    uno::Reference<lang::XComponent> mxComponent;
     void testClassification();
 
 public:
-    virtual void setUp() override;
-    virtual void tearDown() override;
+    ClassificationTest()
+        : UnoApiTest("/sfx2/qa/cppunit/data/")
+    {
+    }
+
     void testWriter();
     void testCalc();
     void testImpress();
@@ -43,21 +44,6 @@ public:
     CPPUNIT_TEST_SUITE_END();
 };
 
-void ClassificationTest::setUp()
-{
-    test::BootstrapFixture::setUp();
-
-    mxDesktop.set(frame::Desktop::create(mxComponentContext));
-}
-
-void ClassificationTest::tearDown()
-{
-    if (mxComponent.is())
-        mxComponent->dispose();
-
-    test::BootstrapFixture::tearDown();
-}
-
 void ClassificationTest::testClassification()
 {
     uno::Sequence<beans::PropertyValue> 
aPropertyValues(comphelper::InitPropertySequence(
commit 94437397f544a0ffaed52b2def13870881138ce9
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Nov 1 20:23:19 2022 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Nov 1 21:52:25 2022 +0100

    CppunitTest_sfx2_doc: inherit from UnoApiTest
    
    Change-Id: Ic28ffe09bfc79ca3b254bd060f43eae289e7b488
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142122
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sfx2/CppunitTest_sfx2_doc.mk b/sfx2/CppunitTest_sfx2_doc.mk
index bf181c2325d6..8156822a9d87 100644
--- a/sfx2/CppunitTest_sfx2_doc.mk
+++ b/sfx2/CppunitTest_sfx2_doc.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sfx2_doc, \
     comphelper \
     cppu \
     sal \
+    subsequenttest \
     test \
     unotest \
     sfx \
diff --git a/sfx2/qa/cppunit/doc.cxx b/sfx2/qa/cppunit/doc.cxx
index 7e62652b5bbb..ed4407b2e1aa 100644
--- a/sfx2/qa/cppunit/doc.cxx
+++ b/sfx2/qa/cppunit/doc.cxx
@@ -7,8 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <test/bootstrapfixture.hxx>
-#include <unotest/macros_test.hxx>
+#include <test/unoapi_test.hxx>
 
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
@@ -24,39 +23,22 @@ using namespace com::sun::star;
 namespace
 {
 /// Covers sfx2/source/doc/ fixes.
-class Test : public test::BootstrapFixture, public unotest::MacrosTest
+class Test : public UnoApiTest
 {
-private:
-    uno::Reference<lang::XComponent> mxComponent;
-
 public:
-    void setUp() override;
-    void tearDown() override;
-    uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
+    Test()
+        : UnoApiTest("/sfx2/qa/cppunit/data/")
+    {
+    }
 };
 
-void Test::setUp()
-{
-    test::BootstrapFixture::setUp();
-
-    mxDesktop.set(frame::Desktop::create(mxComponentContext));
-}
-
-void Test::tearDown()
-{
-    if (mxComponent.is())
-        mxComponent->dispose();
-
-    test::BootstrapFixture::tearDown();
-}
-
 CPPUNIT_TEST_FIXTURE(Test, testNoGrabBagShape)
 {
     // Load a document and select the first shape.
     css::uno::Sequence<css::beans::PropertyValue> aArgs{ 
comphelper::makePropertyValue("ReadOnly",
                                                                                
        true) };
-    getComponent() = loadFromDesktop("private:factory/simpress", "", aArgs);
-    uno::Reference<frame::XModel> xModel(getComponent(), uno::UNO_QUERY);
+    mxComponent = loadFromDesktop("private:factory/simpress", "", aArgs);
+    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xModel, 
uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> xDrawPage(
         xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
@@ -79,8 +61,8 @@ CPPUNIT_TEST_FIXTURE(Test, testNoGrabBagShape)
 CPPUNIT_TEST_FIXTURE(Test, testTempFilePath)
 {
     // Create a test file in a directory that contains the URL-encoded "testÿ" 
string.
-    getComponent() = loadFromDesktop("private:factory/swriter");
-    auto pBaseModel = dynamic_cast<SfxBaseModel*>(getComponent().get());
+    mxComponent = loadFromDesktop("private:factory/swriter");
+    auto pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
     CPPUNIT_ASSERT(pBaseModel);
     OUString aTargetDir
         = 
m_directories.getURLFromWorkdir(u"CppunitTest/sfx2_doc.test.user/test%25C3%25Bf");
@@ -89,11 +71,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTempFilePath)
     css::uno::Sequence<css::beans::PropertyValue> aArgs{ 
comphelper::makePropertyValue(
         "FilterName", OUString("writer8")) };
     pBaseModel->storeAsURL(aTargetFile, aArgs);
-    getComponent()->dispose();
+    mxComponent->dispose();
 
     // Load it and export to PDF.
-    getComponent() = loadFromDesktop(aTargetFile);
-    pBaseModel = dynamic_cast<SfxBaseModel*>(getComponent().get());
+    mxComponent = loadFromDesktop(aTargetFile);
+    pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
     OUString aPdfTarget = aTargetDir + "/test.pdf";
     css::uno::Sequence<css::beans::PropertyValue> aPdfArgs{ 
comphelper::makePropertyValue(
         "FilterName", OUString("writer_pdf_Export")) };

Reply via email to