From 39ed6101c95368697bfaedf73f070129b24d03c9 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 1 Nov 2022 11:04:34 +0100 Subject: [PATCH] CppunitTest_emfio_emf: inherit from UnoApiTest Change-Id: If1278f336aaff56a4378dcc1f0f95e0a749b629d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142099 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- emfio/CppunitTest_emfio_emf.mk | 1 + emfio/qa/cppunit/emf/EmfImportTest.cxx | 33 +++++++------------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/emfio/CppunitTest_emfio_emf.mk b/emfio/CppunitTest_emfio_emf.mk index 38a1c98250f7..4b7d55292485 100644 --- a/emfio/CppunitTest_emfio_emf.mk +++ b/emfio/CppunitTest_emfio_emf.mk @@ -28,6 +28,7 @@ $(eval $(call gb_CppunitTest_use_libraries,emfio_emf,\ cppuhelper \ comphelper \ sal \ + subsequenttest \ svt \ test \ unotest \ diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index fd89ade0c899..6c1e30d57ca4 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -10,9 +10,8 @@ #include #include -#include +#include #include -#include #include #include @@ -39,9 +38,8 @@ using namespace css::graphic; using drawinglayer::primitive2d::Primitive2DSequence; using drawinglayer::primitive2d::Primitive2DContainer; -class Test : public test::BootstrapFixture, public XmlTestTools, public unotest::MacrosTest +class Test : public UnoApiTest, public XmlTestTools { - uno::Reference mxComponent; const OString aXPathPrefix = "/primitive2D/metafile/transform/"; void testPolyPolygon(); @@ -91,9 +89,10 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest: Primitive2DSequence parseEmf(std::u16string_view aSource); public: - void setUp() override; - void tearDown() override; - uno::Reference& getComponent() { return mxComponent; } + Test() + : UnoApiTest("/emfio/qa/cppunit/emf/data/") + { + } CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testPolyPolygon); @@ -141,21 +140,6 @@ public: CPPUNIT_TEST_SUITE_END(); }; -void Test::setUp() -{ - test::BootstrapFixture::setUp(); - - mxDesktop.set(frame::Desktop::create(mxComponentContext)); -} - -void Test::tearDown() -{ - if (mxComponent.is()) - mxComponent->dispose(); - - test::BootstrapFixture::tearDown(); -} - Primitive2DSequence Test::parseEmf(std::u16string_view aSource) { const Reference xEmfParser = EmfTools::create(m_xContext); @@ -1604,11 +1588,10 @@ void Test::TestPdfInEmf() } // Load a PPTX file, which has a shape, with a bitmap fill, which is an EMF, containing a PDF. - OUString aURL = m_directories.getURLFromSrc(u"emfio/qa/cppunit/emf/data/pdf-in-emf.pptx"); - getComponent() = loadFromDesktop(aURL); + loadFromURL(u"pdf-in-emf.pptx"); // Get the EMF. - uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);