CppunitTest_sd_pdf_import_test: inherit from UnoApiTest

Change-Id: I8bd1c930896935770cdf7453550340cbc8b79f55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141862
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2022-10-26 10:10:23 +02:00
parent 58002ab85d
commit 160473c1f1
2 changed files with 9 additions and 26 deletions

View file

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

View file

@ -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 <comphelper/scopeguard.hxx>
#include <comphelper/propertysequence.hxx>
@ -69,31 +68,15 @@ private:
};
}
class SdrPdfImportTest : public test::BootstrapFixture, public unotest::MacrosTest
class SdrPdfImportTest : public UnoApiTest
{
protected:
uno::Reference<lang::XComponent> mxComponent;
public:
virtual void setUp() override;
virtual void tearDown() override;
SdrPdfImportTest()
: UnoApiTest("/sd/qa/unit/data/")
{
}
};
void SdrPdfImportTest::setUp()
{
test::BootstrapFixture::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
}
void SdrPdfImportTest::tearDown()
{
if (mxComponent.is())
mxComponent->dispose();
test::BootstrapFixture::tearDown();
}
// Load the PDF in Draw, which will load the PDF as an Graphic, then
// mark the graphic object and trigger "break" function. This should
// convert the PDF content into objects/shapes.
@ -108,7 +91,7 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testImportSimpleText)
// We need to enable PDFium import (and make sure to disable after the test)
EnvVarGuard UsePDFiumGuard("LO_IMPORT_USE_PDFIUM", "1");
mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"sd/qa/unit/data/SimplePDF.pdf"));
loadFromURL(u"SimplePDF.pdf");
auto pImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
sd::ViewShell* pViewShell = pImpressDocument->GetDocShell()->GetViewShell();
CPPUNIT_ASSERT(pViewShell);
@ -177,8 +160,7 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testAnnotationsImportExport)
auto pPdfiumLibrary = vcl::pdf::PDFiumLibrary::get();
mxComponent
= loadFromDesktop(m_directories.getURLFromSrc(u"sd/qa/unit/data/PdfWithAnnotation.pdf"));
loadFromURL(u"PdfWithAnnotation.pdf");
auto pImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
sd::ViewShell* pViewShell = pImpressDocument->GetDocShell()->GetViewShell();
CPPUNIT_ASSERT(pViewShell);