CppunitTest_sd_png_export_tests: inherit from UnoApiTest

Change-Id: I0dfc7e10250e2690fa34821f8f73cfe6306d2417
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141874
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2022-10-26 13:38:23 +02:00
parent ffe9dfbbc6
commit 932423b8f3
2 changed files with 19 additions and 41 deletions

View file

@ -40,6 +40,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_png_export_tests, \
sd \
sfx \
sot \
subsequenttest \
svl \
svt \
svx \

View file

@ -10,39 +10,26 @@
#include <sal/config.h>
#include "sdmodeltestbase.hxx"
#include <test/unoapi_test.hxx>
#include <com/sun/star/drawing/GraphicExportFilter.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <comphelper/propertyvalue.hxx>
#include <vcl/BitmapReadAccess.hxx>
#include <vcl/filter/PngImageReader.hxx>
class SdPNGExportTest : public SdModelTestBase
{
protected:
uno::Reference<lang::XComponent> 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<uno::XComponentContext> xContext = getComponentContext();
CPPUNIT_ASSERT(xContext.is());
uno::Reference<drawing::XGraphicExportFilter> 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<uno::XComponentContext> xContext = getComponentContext();
CPPUNIT_ASSERT(xContext.is());
uno::Reference<drawing::XGraphicExportFilter> 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<uno::XComponentContext> xContext = getComponentContext();
CPPUNIT_ASSERT(xContext.is());
uno::Reference<drawing::XGraphicExportFilter> 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<uno::XComponentContext> xContext = getComponentContext();
CPPUNIT_ASSERT(xContext.is());
uno::Reference<drawing::XGraphicExportFilter> 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<uno::XComponentContext> xContext = getComponentContext();
CPPUNIT_ASSERT(xContext.is());
uno::Reference<drawing::XGraphicExportFilter> 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<uno::XComponentContext> xContext = getComponentContext();
CPPUNIT_ASSERT(xContext.is());
uno::Reference<drawing::XGraphicExportFilter> 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<uno::XComponentContext> xContext = getComponentContext();
CPPUNIT_ASSERT(xContext.is());
uno::Reference<drawing::XGraphicExportFilter> 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<uno::XComponentContext> 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.