diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-10 17:00:27 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-11 09:52:22 +0100 |
commit | 699251315aeba9620310410c0576c8b9c052c8b2 (patch) | |
tree | 236df34e5c70d3ee4cb9eaac3751062769fbf2c9 /embeddedobj/qa/cppunit | |
parent | 1c11bfc0420245ee19ff9ef1f09eaac79bae53e1 (diff) |
CppunitTest_embeddedobj_general: inherit from UnoApiTest
Change-Id: Id4c056734b6cd3cd1b699a473c32bd69cc949e80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142554
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'embeddedobj/qa/cppunit')
-rw-r--r-- | embeddedobj/qa/cppunit/general.cxx | 48 |
1 files changed, 12 insertions, 36 deletions
diff --git a/embeddedobj/qa/cppunit/general.cxx b/embeddedobj/qa/cppunit/general.cxx index c7824fe87eaf..1876a1238010 100644 --- a/embeddedobj/qa/cppunit/general.cxx +++ b/embeddedobj/qa/cppunit/general.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/frame/Desktop.hpp> #include <com/sun/star/embed/XStorage.hpp> @@ -24,31 +23,14 @@ using namespace ::com::sun::star; namespace { /// Covers embeddedobj/source/general/ fixes. -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("/embeddedobj/qa/cppunit/data/") + { + } }; - -void Test::setUp() -{ - test::BootstrapFixture::setUp(); - - mxDesktop.set(frame::Desktop::create(mxComponentContext)); -} - -void Test::tearDown() -{ - if (mxComponent.is()) - mxComponent->dispose(); - - test::BootstrapFixture::tearDown(); -} } CPPUNIT_TEST_FIXTURE(Test, testInsertFileConfig) @@ -65,14 +47,12 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertFileConfig) pBatchReset); pBatchReset->commit(); }); - getComponent().set( - loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument")); + mxComponent.set(loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument")); // Insert a file as an embedded object. uno::Reference<embed::XStorage> xStorage = comphelper::OStorageHelper::GetTemporaryStorage(); comphelper::EmbeddedObjectContainer aContainer(xStorage); - OUString aFileName - = m_directories.getURLFromSrc(u"embeddedobj/qa/cppunit/data/insert-file-config.doc"); + OUString aFileName = createFileURL(u"insert-file-config.doc"); uno::Sequence<beans::PropertyValue> aMedium{ comphelper::makePropertyValue("URL", aFileName) }; OUString aName("Object 1"); uno::Reference<embed::XEmbeddedObject> xObject @@ -98,14 +78,12 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertFileConfigVsdx) officecfg::Office::Common::Filter::Microsoft::Import::VisioToDraw::set(true, pBatchReset); pBatchReset->commit(); }); - getComponent().set( - loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument")); + mxComponent.set(loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument")); // Insert a file as an embedded object. uno::Reference<embed::XStorage> xStorage = comphelper::OStorageHelper::GetTemporaryStorage(); comphelper::EmbeddedObjectContainer aContainer(xStorage); - OUString aFileName - = m_directories.getURLFromSrc(u"embeddedobj/qa/cppunit/data/insert-file-config.vsdx"); + OUString aFileName = createFileURL(u"insert-file-config.vsdx"); uno::Sequence<beans::PropertyValue> aMedium{ comphelper::makePropertyValue("URL", aFileName) }; OUString aName("Object 1"); uno::Reference<embed::XEmbeddedObject> xObject @@ -131,14 +109,12 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertFileConfigPdf) officecfg::Office::Common::Filter::Adobe::Import::PDFToDraw::set(true, pBatchReset); pBatchReset->commit(); }); - getComponent().set( - loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument")); + mxComponent.set(loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument")); // Insert a PDF file as an embedded object. uno::Reference<embed::XStorage> xStorage = comphelper::OStorageHelper::GetTemporaryStorage(); comphelper::EmbeddedObjectContainer aContainer(xStorage); - OUString aFileName - = m_directories.getURLFromSrc(u"embeddedobj/qa/cppunit/data/insert-file-config.pdf"); + OUString aFileName = createFileURL(u"insert-file-config.pdf"); uno::Sequence<beans::PropertyValue> aMedium{ comphelper::makePropertyValue("URL", aFileName) }; OUString aName("Object 1"); uno::Reference<embed::XEmbeddedObject> xObject |