diff --git a/sd/CppunitTest_sd_png_export_tests.mk b/sd/CppunitTest_sd_png_export_tests.mk index 015557873961..d881fbaab532 100644 --- a/sd/CppunitTest_sd_png_export_tests.mk +++ b/sd/CppunitTest_sd_png_export_tests.mk @@ -40,6 +40,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_png_export_tests, \ sd \ sfx \ sot \ + subsequenttest \ svl \ svt \ svx \ diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx index 0d3ed74eca28..857548869fb0 100644 --- a/sd/qa/unit/PNGExportTests.cxx +++ b/sd/qa/unit/PNGExportTests.cxx @@ -10,39 +10,26 @@ #include -#include "sdmodeltestbase.hxx" +#include #include +#include #include #include #include #include -class SdPNGExportTest : public SdModelTestBase -{ -protected: - uno::Reference mxComponent; +using namespace ::com::sun::star; +class SdPNGExportTest : public UnoApiTest +{ public: - virtual void setUp() override; - virtual void tearDown() override; + SdPNGExportTest() + : UnoApiTest("/sd/qa/unit/data/") + { + } }; -void SdPNGExportTest::setUp() -{ - test::BootstrapFixture::setUp(); - - mxDesktop.set(frame::Desktop::create(mxComponentContext)); -} - -void SdPNGExportTest::tearDown() -{ - if (mxComponent.is()) - mxComponent->dispose(); - - test::BootstrapFixture::tearDown(); -} - static void assertColorsAreSimilar(const std::string& message, const BitmapColor& expected, const BitmapColor& actual, int nDelta) { @@ -55,8 +42,7 @@ static void assertColorsAreSimilar(const std::string& message, const BitmapColor CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105998) { - mxComponent - = loadFromDesktop(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf105998.odp")); + loadFromURL(u"odp/tdf105998.odp"); uno::Reference xContext = getComponentContext(); CPPUNIT_ASSERT(xContext.is()); uno::Reference xGraphicExporter @@ -120,8 +106,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105998) CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319) { - mxComponent - = loadFromDesktop(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odg/tdf126319.odg")); + loadFromURL(u"odg/tdf126319.odg"); uno::Reference xContext = getComponentContext(); CPPUNIT_ASSERT(xContext.is()); uno::Reference xGraphicExporter @@ -191,8 +176,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319) CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf136632) { // Reuse existing file - mxComponent - = loadFromDesktop(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf105998.odp")); + loadFromURL(u"odp/tdf105998.odp"); uno::Reference xContext = getComponentContext(); CPPUNIT_ASSERT(xContext.is()); uno::Reference xGraphicExporter @@ -229,8 +213,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf136632) CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113163) { - mxComponent - = loadFromDesktop(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf113163.pptx")); + loadFromURL(u"pptx/tdf113163.pptx"); uno::Reference xContext = getComponentContext(); CPPUNIT_ASSERT(xContext.is()); uno::Reference xGraphicExporter @@ -283,8 +266,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113163) CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf147119) { - mxComponent - = loadFromDesktop(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odg/tdf147119.odg")); + loadFromURL(u"odg/tdf147119.odg"); uno::Reference xContext = getComponentContext(); CPPUNIT_ASSERT(xContext.is()); uno::Reference xGraphicExporter @@ -336,8 +318,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf147119) CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113197) { - mxComponent - = loadFromDesktop(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf113197.odp")); + loadFromURL(u"odp/tdf113197.odp"); uno::Reference xContext = getComponentContext(); CPPUNIT_ASSERT(xContext.is()); uno::Reference xGraphicExporter @@ -391,8 +372,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113197) CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf93124) { - mxComponent - = loadFromDesktop(m_directories.getURLFromSrc(u"/sd/qa/unit/data/ppt/tdf93124.ppt")); + loadFromURL(u"ppt/tdf93124.ppt"); uno::Reference xContext = getComponentContext(); CPPUNIT_ASSERT(xContext.is()); uno::Reference xGraphicExporter @@ -446,14 +426,12 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf93124) CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf99729) { - const OUString filenames[] - = { "/sd/qa/unit/data/odp/tdf99729-new.odp", "/sd/qa/unit/data/odp/tdf99729-legacy.odp" }; + const OUString filenames[] = { "odp/tdf99729-new.odp", "odp/tdf99729-legacy.odp" }; int nonwhitecounts[] = { 0, 0 }; for (size_t i = 0; i < SAL_N_ELEMENTS(filenames); ++i) { // 1st check for new behaviour - having AnchoredTextOverflowLegacy compatibility flag set to false in settings.xml - mxComponent = loadFromDesktop(m_directories.getURLFromSrc(filenames[i]), - "com.sun.star.presentation.PresentationDocument"); + loadFromURL(filenames[i]); uno::Reference xContext = getComponentContext(); CPPUNIT_ASSERT(xContext.is()); @@ -497,7 +475,6 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf99729) ++nonwhitecounts[i]; } } - mxComponent->dispose(); } // The numbers 1-9 should be above the Text Box in rectangle 154,16 - 170,112. // If text alignment is wrong, the rectangle will be white.