svx/CppunitTest_svx_styles.mk | 1 + svx/qa/unit/styles.cxx | 37 ++++++++----------------------------- 2 files changed, 9 insertions(+), 29 deletions(-)
New commits: commit e2f7f551dcc9aa9e8e4d0b5f004962340c01e4c8 Author: Xisco Fauli <[email protected]> AuthorDate: Tue Nov 1 10:12:33 2022 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Nov 1 13:13:43 2022 +0100 CppunitTest_svx_styles: inherit from UnoApiTest Change-Id: I3edd6e41e12efb4876f632edc66ae198d26ac944 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142095 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/svx/CppunitTest_svx_styles.mk b/svx/CppunitTest_svx_styles.mk index f617668ad705..17559a02a87a 100644 --- a/svx/CppunitTest_svx_styles.mk +++ b/svx/CppunitTest_svx_styles.mk @@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svx_styles, \ cppu \ svx \ sal \ + subsequenttest \ test \ unotest \ )) diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx index dd27e24f02ae..13ee30efd773 100644 --- a/svx/qa/unit/styles.cxx +++ b/svx/qa/unit/styles.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/beans/XPropertySet.hpp> #include <com/sun/star/frame/Desktop.hpp> @@ -21,34 +20,15 @@ using namespace ::com::sun::star; namespace { /// Tests for svx/source/styles/ code. -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("svx/qa/unit/data/") + { + } }; -void Test::setUp() -{ - test::BootstrapFixture::setUp(); - - mxDesktop.set(frame::Desktop::create(mxComponentContext)); -} - -void Test::tearDown() -{ - if (mxComponent.is()) - mxComponent->dispose(); - - test::BootstrapFixture::tearDown(); -} - -constexpr OUStringLiteral DATA_DIRECTORY = u"/svx/qa/unit/data/"; - /// Get the character color of the first text portion in xShape. sal_Int32 GetShapeTextColor(const uno::Reference<text::XTextRange>& xShape) { @@ -73,9 +53,8 @@ sal_Int32 GetShapeFillColor(const uno::Reference<beans::XPropertySet>& xShape) CPPUNIT_TEST_FIXTURE(Test, testThemeChange) { // Given a document, with a first slide and blue shape text from theme: - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "theme.pptx"; - getComponent() = loadFromDesktop(aURL); - uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); + loadFromURL(u"theme.pptx"); + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); // The draw page also contains a group shape to make sure we don't crash on group shapes. uno::Reference<drawing::XMasterPageTarget> xDrawPage( xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
