sfx2/CppunitTest_sfx2_view.mk |    1 +
 sfx2/qa/cppunit/view.cxx      |   37 ++++++++-----------------------------
 2 files changed, 9 insertions(+), 29 deletions(-)

New commits:
commit 6410b6f1251d52cc3d6eea7c7c49a009a7ec7025
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Nov 1 20:44:10 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Nov 2 09:38:16 2022 +0100

    CppunitTest_sfx2_view: inherit from UnoApiTest
    
    Change-Id: I5a2d62fde3e14bdd47b4d7d3511a30cbd1629b19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142125
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sfx2/CppunitTest_sfx2_view.mk b/sfx2/CppunitTest_sfx2_view.mk
index e39346c1075a..a673d7b576fd 100644
--- a/sfx2/CppunitTest_sfx2_view.mk
+++ b/sfx2/CppunitTest_sfx2_view.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sfx2_view, \
     comphelper \
     cppu \
     sal \
+    subsequenttest \
     test \
     unotest \
     sfx \
diff --git a/sfx2/qa/cppunit/view.cxx b/sfx2/qa/cppunit/view.cxx
index 70bb5fd4f54b..ce8bf8d1d427 100644
--- a/sfx2/qa/cppunit/view.cxx
+++ b/sfx2/qa/cppunit/view.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/drawing/XDrawView.hpp>
@@ -24,40 +23,20 @@
 
 using namespace com::sun::star;
 
-constexpr OUStringLiteral DATA_DIRECTORY = u"/sfx2/qa/cppunit/data/";
-
 /// Covers sfx2/source/view/ fixes.
-class Sfx2ViewTest : public test::BootstrapFixture, public unotest::MacrosTest
+class Sfx2ViewTest : public UnoApiTest
 {
-private:
-    uno::Reference<lang::XComponent> mxComponent;
-
 public:
-    void setUp() override;
-    void tearDown() override;
-    uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
+    Sfx2ViewTest()
+        : UnoApiTest("/sfx2/qa/cppunit/data/")
+    {
+    }
 };
 
-void Sfx2ViewTest::setUp()
-{
-    test::BootstrapFixture::setUp();
-
-    mxDesktop.set(frame::Desktop::create(mxComponentContext));
-}
-
-void Sfx2ViewTest::tearDown()
-{
-    if (mxComponent.is())
-        mxComponent->dispose();
-
-    test::BootstrapFixture::tearDown();
-}
-
 CPPUNIT_TEST_FIXTURE(Sfx2ViewTest, testReloadPage)
 {
     // Load a document, which has 2 pages.
-    OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"reload-page.odg";
-    getComponent() = loadFromDesktop(aURL);
+    loadFromURL(u"reload-page.odg");
 
     // Reload, and request to start on page 2.
     SfxViewFrame* pFrame = SfxViewFrame::Current();
@@ -66,7 +45,7 @@ CPPUNIT_TEST_FIXTURE(Sfx2ViewTest, testReloadPage)
     SfxRequest aReq(SID_RELOAD, SfxCallMode::SLOT, aSet);
     pFrame->ExecReload_Impl(aReq);
     uno::Reference<frame::XModel> xModel = 
SfxObjectShell::Current()->GetBaseModel();
-    getComponent() = xModel;
+    mxComponent = xModel;
 
     // Check the current page after reload.
     uno::Reference<drawing::XDrawView> 
xController(xModel->getCurrentController(), uno::UNO_QUERY);

Reply via email to