embeddedobj/CppunitTest_embeddedobj_msole.mk |    1 
 embeddedobj/qa/cppunit/msole.cxx             |   48 +++++----------------------
 2 files changed, 11 insertions(+), 38 deletions(-)

New commits:
commit f62e6496521af8d1f2b612123c664bcf3223946a
Author:     Xisco Fauli <[email protected]>
AuthorDate: Thu Nov 3 23:08:22 2022 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Nov 4 08:52:57 2022 +0100

    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 <[email protected]>

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

Reply via email to