summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-11-03 23:08:22 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-11-04 08:52:57 +0100
commitf62e6496521af8d1f2b612123c664bcf3223946a (patch)
tree5c353dff3f27b3babd6f1848456a0d2b4ed4ce5b /embeddedobj
parent1e007e8f1703851b01c68884e87c906f6bae5a5e (diff)
CppunitTest_embeddedobj_msole: inherit from UnoApiXmlTest
Change-Id: I26e0a4db8484c8e91f3ebff9828d76270ddc5f6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142256 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/CppunitTest_embeddedobj_msole.mk1
-rw-r--r--embeddedobj/qa/cppunit/msole.cxx48
2 files changed, 11 insertions, 38 deletions
diff --git a/embeddedobj/CppunitTest_embeddedobj_msole.mk b/embeddedobj/CppunitTest_embeddedobj_msole.mk
index 2ffb7f64d829..522c2372446b 100644
--- a/embeddedobj/CppunitTest_embeddedobj_msole.mk
+++ b/embeddedobj/CppunitTest_embeddedobj_msole.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,embeddedobj_msole, \
cppu \
embobj \
sal \
+ subsequenttest \
test \
unotest \
utl \
diff --git a/embeddedobj/qa/cppunit/msole.cxx b/embeddedobj/qa/cppunit/msole.cxx
index 778186f01b55..ee76dfb3984c 100644
--- a/embeddedobj/qa/cppunit/msole.cxx
+++ b/embeddedobj/qa/cppunit/msole.cxx
@@ -7,14 +7,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <test/bootstrapfixture.hxx>
-#include <unotest/macros_test.hxx>
-#include <test/xmltesttools.hxx>
+#include <test/unoapixml_test.hxx>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <comphelper/embeddedobjectcontainer.hxx>
@@ -34,36 +31,16 @@ using namespace ::com::sun::star;
namespace
{
/// Covers embeddedobj/source/msole/ fixes.
-class Test : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
+class Test : public UnoApiXmlTest
{
-private:
- uno::Reference<lang::XComponent> mxComponent;
-
public:
- void setUp() override;
- void tearDown() override;
- uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
- void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override;
-};
-}
-
-void Test::setUp()
-{
- test::BootstrapFixture::setUp();
-
- mxDesktop.set(frame::Desktop::create(mxComponentContext));
-}
-
-void Test::tearDown()
-{
- if (mxComponent)
+ Test()
+ : UnoApiXmlTest("/embeddedobj/qa/cppunit/data/")
{
- uno::Reference<util::XCloseable> xCloseable(mxComponent, css::uno::UNO_QUERY_THROW);
- xCloseable->close(false);
- mxComponent.clear();
}
- test::BootstrapFixture::tearDown();
+ void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override;
+};
}
void Test::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
@@ -109,17 +86,17 @@ CPPUNIT_TEST_FIXTURE(Test, testSaveOnThread)
}
DBG_TESTSOLARMUTEX();
- OUString aURL = m_directories.getURLFromSrc(u"embeddedobj/qa/cppunit/data/reqif-ole2.xhtml");
+ OUString aURL = createFileURL(u"reqif-ole2.xhtml");
uno::Sequence<beans::PropertyValue> aLoadProperties = {
comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")),
comphelper::makePropertyValue("FilterOptions", OUString("xhtmlns=reqif-xhtml")),
};
- getComponent().set(loadFromDesktop(aURL, "com.sun.star.text.TextDocument", aLoadProperties));
+ mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", aLoadProperties);
// When saving that document on a thread:
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
- OdtExportThread aThread(getComponent(), aTempFile.GetURL());
+ OdtExportThread aThread(mxComponent, aTempFile.GetURL());
aThread.create();
{
SolarMutexReleaser r;
@@ -131,12 +108,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSaveOnThread)
}
// Then make sure its visible area's width is correct.
- uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
- = packages::zip::ZipFileAccess::createWithURL(mxComponentContext, aTempFile.GetURL());
- uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName("content.xml"),
- uno::UNO_QUERY);
- std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// 16 pixels, assuming 96 DPI.
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 0.1665in