chart2/qa/extras/chart2export2.cxx  |    2 --
 chart2/qa/extras/chart2geometry.cxx |    3 ---
 include/test/unoapi_test.hxx        |    1 +
 sc/qa/unit/uicalc/uicalc.cxx        |    8 ++++----
 test/source/unoapi_test.cxx         |   14 +++++++++++---
 5 files changed, 16 insertions(+), 12 deletions(-)

New commits:
commit b45ab31f2b5eb93773608f06b947cd9c5a169150
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Oct 26 18:12:42 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Oct 26 19:34:28 2022 +0200

    UnoApiTest: do not dispose on save
    
    Change-Id: Id100591517da48ec8e5cfd38f5c44ac0d7b16198
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141888
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/chart2/qa/extras/chart2export2.cxx 
b/chart2/qa/extras/chart2export2.cxx
index 64e5e5c676d4..1d79de8e119a 100644
--- a/chart2/qa/extras/chart2export2.cxx
+++ b/chart2/qa/extras/chart2export2.cxx
@@ -1127,8 +1127,6 @@ void Chart2ExportTest2::testTdf127792()
         assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val",
                     "between");
     }
-
-    loadFromURL(u"docx/MSO_axis_position.docx");
     {
         xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart2", "Office 
Open XML Text");
         CPPUNIT_ASSERT(pXmlDoc);
diff --git a/chart2/qa/extras/chart2geometry.cxx 
b/chart2/qa/extras/chart2geometry.cxx
index 9073fcb42cfe..873d00a7f33e 100644
--- a/chart2/qa/extras/chart2geometry.cxx
+++ b/chart2/qa/extras/chart2geometry.cxx
@@ -209,7 +209,6 @@ void 
Chart2GeometryTest::testTdf128345ChartArea_CG_TS_import()
         = getXPathContent(pXmlDoc, sStylePath + 
"/style:graphic-properties/@draw:opacity-name");
 
     // Verify the content of the opacity definition
-    loadFromURL(u"pptx/tdf128345_ChartArea_CG_TS.pptx");
     xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8");
     CPPUNIT_ASSERT(pXmlDoc2);
     const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'");
@@ -261,7 +260,6 @@ void 
Chart2GeometryTest::testTdf128345ChartWall_CS_TG_import()
         = getXPathContent(pXmlDoc, sStylePath + 
"/style:graphic-properties/@draw:opacity-name");
 
     // Verify content of the opacity definition
-    loadFromURL(u"pptx/tdf128345_ChartWall_CS_TG.pptx");
     xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8");
     CPPUNIT_ASSERT(pXmlDoc2);
     const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'");
@@ -312,7 +310,6 @@ void 
Chart2GeometryTest::testTdf128345Legend_CS_TG_axial_import()
     const OUString sOUOpacityName
         = getXPathContent(pXmlDoc, sStylePath + 
"/style:graphic-properties/@draw:opacity-name");
 
-    loadFromURL(u"pptx/tdf128345_Legend_CS_TG_axial.pptx");
     // Verify content of the opacity definition
     xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8");
     CPPUNIT_ASSERT(pXmlDoc2);
diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx
index 8c19a56333a9..577c2d62ece7 100644
--- a/include/test/unoapi_test.hxx
+++ b/include/test/unoapi_test.hxx
@@ -37,6 +37,7 @@ public:
                                const css::uno::Sequence<css::uno::Any>& 
rParams = {});
 
     utl::TempFileNamed save(const OUString& rFilter);
+    utl::TempFileNamed saveAndClose(const OUString& rFilter);
     void saveAndReload(const OUString& rFilter);
 
 protected:
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 27e28175bc23..38c8cb537371 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -153,7 +153,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf100847)
     CPPUNIT_ASSERT(pDoc);
 
     // Save the document
-    utl::TempFileNamed aTempFile = save("calc8");
+    saveAndClose("calc8");
 
     // Open a new document
     mxComponent = loadFromDesktop("private:factory/scalc");
@@ -186,7 +186,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences)
     insertStringToCell(*pModelObj, "D3", u"FISHY");
 
     // Save the document
-    utl::TempFileNamed aTempFile = save("calc8");
+    utl::TempFileNamed aTempFile = saveAndClose("calc8");
 
     // Open a new document
     mxComponent = loadFromDesktop("private:factory/scalc");
@@ -292,7 +292,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf103994)
     insertStringToCell(*pModelObj, "B1", u"2");
 
     // Save the document
-    utl::TempFileNamed aTempFile = save("calc8");
+    utl::TempFileNamed aTempFile = saveAndClose("calc8");
 
     // Open a new document
     mxComponent = loadFromDesktop("private:factory/scalc");
@@ -334,7 +334,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf113541)
     insertStringToCell(*pModelObj, "A1", u"50");
 
     // Save the document
-    utl::TempFileNamed aTempFile = save("calc8");
+    utl::TempFileNamed aTempFile = saveAndClose("calc8");
 
     // Open a new document
     mxComponent = loadFromDesktop("private:factory/scalc");
diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx
index aaf3db10eccf..0a04e46fd831 100644
--- a/test/source/unoapi_test.cxx
+++ b/test/source/unoapi_test.cxx
@@ -87,8 +87,6 @@ utl::TempFileNamed UnoApiTest::save(const OUString& rFilter)
     uno::Sequence aArgs{ comphelper::makePropertyValue("FilterName", rFilter) 
};
     css::uno::Reference<frame::XStorable> xStorable(mxComponent, 
css::uno::UNO_QUERY_THROW);
     xStorable->storeToURL(aTempFile.GetURL(), aArgs);
-    mxComponent->dispose();
-    mxComponent.clear();
 
     if (!mbSkipValidation)
     {
@@ -119,10 +117,20 @@ utl::TempFileNamed UnoApiTest::save(const OUString& 
rFilter)
     return aTempFile;
 }
 
-void UnoApiTest::saveAndReload(const OUString& rFilter)
+utl::TempFileNamed UnoApiTest::saveAndClose(const OUString& rFilter)
 {
     utl::TempFileNamed aTempFile = save(rFilter);
 
+    mxComponent->dispose();
+    mxComponent.clear();
+
+    return aTempFile;
+}
+
+void UnoApiTest::saveAndReload(const OUString& rFilter)
+{
+    utl::TempFileNamed aTempFile = saveAndClose(rFilter);
+
     mxComponent = loadFromDesktop(aTempFile.GetURL());
 }
 

Reply via email to