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 <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2022-11-01 11:04:34 +01:00
parent 4e5df4c277
commit 39ed6101c9
2 changed files with 9 additions and 25 deletions

View file

@ -28,6 +28,7 @@ $(eval $(call gb_CppunitTest_use_libraries,emfio_emf,\
cppuhelper \ cppuhelper \
comphelper \ comphelper \
sal \ sal \
subsequenttest \
svt \ svt \
test \ test \
unotest \ unotest \

View file

@ -10,9 +10,8 @@
#include <sal/config.h> #include <sal/config.h>
#include <config_fonts.h> #include <config_fonts.h>
#include <test/bootstrapfixture.hxx> #include <test/unoapi_test.hxx>
#include <test/xmltesttools.hxx> #include <test/xmltesttools.hxx>
#include <unotest/macros_test.hxx>
#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@ -39,9 +38,8 @@ using namespace css::graphic;
using drawinglayer::primitive2d::Primitive2DSequence; using drawinglayer::primitive2d::Primitive2DSequence;
using drawinglayer::primitive2d::Primitive2DContainer; using drawinglayer::primitive2d::Primitive2DContainer;
class Test : public test::BootstrapFixture, public XmlTestTools, public unotest::MacrosTest class Test : public UnoApiTest, public XmlTestTools
{ {
uno::Reference<lang::XComponent> mxComponent;
const OString aXPathPrefix = "/primitive2D/metafile/transform/"; const OString aXPathPrefix = "/primitive2D/metafile/transform/";
void testPolyPolygon(); void testPolyPolygon();
@ -91,9 +89,10 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest:
Primitive2DSequence parseEmf(std::u16string_view aSource); Primitive2DSequence parseEmf(std::u16string_view aSource);
public: public:
void setUp() override; Test()
void tearDown() override; : UnoApiTest("/emfio/qa/cppunit/emf/data/")
uno::Reference<lang::XComponent>& getComponent() { return mxComponent; } {
}
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testPolyPolygon); CPPUNIT_TEST(testPolyPolygon);
@ -141,21 +140,6 @@ public:
CPPUNIT_TEST_SUITE_END(); 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) Primitive2DSequence Test::parseEmf(std::u16string_view aSource)
{ {
const Reference<XEmfParser> xEmfParser = EmfTools::create(m_xContext); const Reference<XEmfParser> 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. // 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"); loadFromURL(u"pdf-in-emf.pptx");
getComponent() = loadFromDesktop(aURL);
// Get the EMF. // Get the EMF.
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
uno::UNO_QUERY); uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);