summaryrefslogtreecommitdiff
path: root/svx/qa
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-11-01 10:09:23 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-11-01 11:09:55 +0100
commitcfc8a8f5d841b3f84d207196153be67da7f60652 (patch)
tree1437e203bc005f13b49adf64b196056bae2dce96 /svx/qa
parentbc770e44c1e8c9686f0eb7eac49dd42717fb494f (diff)
CppunitTest_svx_core: inherit from UnoApiTest
Change-Id: I4e7cdd1507232d48eba7c4afc599adf8da7a3df7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142094 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svx/qa')
-rw-r--r--svx/qa/unit/core.cxx41
1 files changed, 10 insertions, 31 deletions
diff --git a/svx/qa/unit/core.cxx b/svx/qa/unit/core.cxx
index de0264555617..c3a9d3e3a2de 100644
--- a/svx/qa/unit/core.cxx
+++ b/svx/qa/unit/core.cxx
@@ -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 <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@@ -25,47 +24,27 @@ using namespace ::com::sun::star;
namespace
{
/// Tests for svx/source/core/ code.
-class Test : public test::BootstrapFixture, public unotest::MacrosTest
+class Test : public UnoApiTest
{
-private:
- uno::Reference<lang::XComponent> mxComponent;
-
public:
- void setUp() override;
- void tearDown() override;
- uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
+ Test()
+ : UnoApiTest("svx/qa/unit/data/")
+ {
+ }
};
-void Test::setUp()
-{
- test::BootstrapFixture::setUp();
-
- mxDesktop.set(frame::Desktop::create(mxComponentContext));
-}
-
-void Test::tearDown()
-{
- if (mxComponent.is())
- mxComponent->dispose();
-
- test::BootstrapFixture::tearDown();
-}
-
-constexpr OUStringLiteral DATA_DIRECTORY = u"/svx/qa/unit/data/";
-
CPPUNIT_TEST_FIXTURE(Test, testChartExportToPdf)
{
// Given a Calc document with a chart in it:
- OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "chart.ods";
- getComponent() = loadFromDesktop(aURL);
- uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+ loadFromURL(u"chart.ods");
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
uno::UNO_QUERY);
uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
// When exporting that chart to PDF:
utl::TempFileNamed aTempFile;
- GraphicHelper::SaveShapeAsGraphicToPath(getComponent(), xShape, "application/pdf",
+ GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "application/pdf",
aTempFile.GetURL());
// Then make sure we get a valid, non-empty PDF:
@@ -85,7 +64,7 @@ CPPUNIT_TEST_FIXTURE(Test, testChartExportToPdf)
CPPUNIT_TEST_FIXTURE(Test, testGraphicObjectResolver)
{
- OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "GraphicObjectResolverTest.zip";
+ OUString aURL = createFileURL(u"GraphicObjectResolverTest.zip");
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(ZIP_STORAGE_FORMAT_STRING, aURL,
embed::ElementModes::READWRITE);