sw/qa/extras/layout/layout2.cxx               |    7 +++----
 sw/qa/extras/odfexport/odfexport.cxx          |    5 ++---
 sw/qa/extras/odfimport/odfimport.cxx          |    2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx    |   10 +++++-----
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx    |   14 +++++++-------
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx    |    6 +++---
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |    6 +++---
 sw/qa/extras/uiwriter/uiwriter4.cxx           |   20 ++++++++------------
 sw/qa/extras/uiwriter/uiwriter6.cxx           |    5 ++---
 sw/qa/filter/ww8/ww8.cxx                      |    6 +++---
 sw/qa/inc/swmodeltestbase.hxx                 |    2 +-
 sw/qa/unit/swmodeltestbase.cxx                |   11 +++++------
 12 files changed, 43 insertions(+), 51 deletions(-)

New commits:
commit ee1154d7fe84d507ce977b851c4044cafe0b9da9
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Nov 3 15:01:43 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Nov 3 23:21:17 2022 +0100

    swmodeltestbase: use maTempFile everywhere
    
    Change-Id: Ifd840984e4144599f2527702a57688863854b7ac
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142235
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 92ad57c742ff..367eb23f05da 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -2246,12 +2246,11 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf121509)
     CPPUNIT_ASSERT(pTriangleShapeFormat->SetFormatAttr(aNewAnch));
 
     // Reload (docx)
-    utl::TempFileNamed aTemp;
-    save("Office Open XML Text", aTemp);
+    save("Office Open XML Text");
 
     // The second part: check if the reloaded doc has flys inside a fly
     uno::Reference<lang::XComponent> xComponent
-        = loadFromDesktop(aTemp.GetURL(), "com.sun.star.text.TextDocument");
+        = loadFromDesktop(maTempFile.GetURL(), 
"com.sun.star.text.TextDocument");
     uno::Reference<text::XTextDocument> xTextDoc(xComponent, uno::UNO_QUERY);
     auto pTextDoc = dynamic_cast<SwXTextDocument*>(xTextDoc.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -2270,7 +2269,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf121509)
         }
     }
     // Drop the tempfile
-    aTemp.CloseStream();
+    maTempFile.CloseStream();
 
     // With the fix this cannot be true, if it is, that means Word unable to 
read the file..
     CPPUNIT_ASSERT_MESSAGE("Corrupt exported docx file!", !bFlyInFlyFound);
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index d5fe2c8cf706..0fa0f9b5ed30 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -901,10 +901,9 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo58949)
      * and replacement image) OLE objects using UNO, so we'll check the zip 
file directly.
      */
 
-    utl::TempFileNamed aTempFile;
-    save("writer8", aTempFile);
+    save("writer8");
 
-    uno::Sequence<uno::Any> aArgs{ uno::Any(aTempFile.GetURL()) };
+    uno::Sequence<uno::Any> aArgs{ uno::Any(maTempFile.GetURL()) };
     uno::Reference<container::XNameAccess> 
xNameAccess(m_xSFactory->createInstanceWithArguments("com.sun.star.packages.zip.ZipFileAccess",
 aArgs), uno::UNO_QUERY);
     const css::uno::Sequence<OUString> aNames(xNameAccess->getElementNames());
     // The exported document must have three objects named ObjNNN. The names 
are assigned in
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index eeea54388ab8..49ebdbfdeba7 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -1278,7 +1278,7 @@ CPPUNIT_TEST_FIXTURE(Test, testVerticallyMergedCellBorder)
     CPPUNIT_ASSERT(!rA2Set.GetBox().GetRight());
 
     // Given this document model, when exporting to ODT:
-    save("writer8", maTempFile);
+    save("writer8");
     mbExported = true;
 
     // Then make sure the covered cell has a style.
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 337926c8dfb0..86fa7ea808a1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -805,7 +805,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testTdf133771)
     // Without the fix in place, this test would have failed with
     // "An uncaught exception of type com.sun.star.io.IOException"
     // exporting to docx
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     CPPUNIT_ASSERT(pXmlDoc);
@@ -823,7 +823,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testZeroLineSpacing)
     xParagraph->setPropertyValue("ParaLineSpacing", uno::Any(aSpacing));
 
     // Export to docx.
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     CPPUNIT_ASSERT(pXmlDoc);
@@ -851,7 +851,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, 
testSemiTransparentText)
     xTextRange->setString("x");
 
     // Export to docx.
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     CPPUNIT_ASSERT(pXmlDoc);
@@ -896,7 +896,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testUserField)
     xText->insertTextContent(xText->createTextCursor(), xField, 
/*bAbsorb=*/false);
 
     // Export to docx.
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     CPPUNIT_ASSERT(pXmlDoc);
@@ -950,7 +950,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, 
testHighlightEdit_numbering)
     properties->setPropertyValue("ListAutoFormat", uno::Any(aListAutoFormat));
 
     // Export to docx.
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
 
     // Paragraph 2 should have only one w:highlight written per w:rPr. Without 
the fix, there were two.
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index a487e86d3269..37566c4b3e70 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -266,7 +266,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlExport)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // When exporting to DOCX:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
 
     // Then make sure the expected markup is used:
@@ -301,7 +301,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCheckboxContentControlExport)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // When exporting to DOCX:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
 
     // Then make sure the expected markup is used:
@@ -350,7 +350,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDropdownContentControlExport)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // When exporting to DOCX:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
 
     // Then make sure the expected markup is used:
@@ -391,7 +391,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPictureContentControlExport)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // When exporting to DOCX:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
 
     // Then make sure the expected markup is used:
@@ -431,7 +431,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDateContentControlExport)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // When exporting to DOCX:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
 
     // Then make sure the expected markup is used:
@@ -472,7 +472,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorder)
     xPageStyle->setPropertyValue("TopBorderDistance", 
uno::Any(nTopBorderDistance));
 
     // When exporting to DOCX:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
 
     // Then make sure that the page edge -> border space is correct:
@@ -991,7 +991,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978enhancedPathABVW)
 {
     load(DATA_DIRECTORY, "tdf147978_enhancedPath_commandABVW.odt");
     CPPUNIT_ASSERT(mxComponent);
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mxComponent->dispose();
     mxComponent = loadFromDesktop(maTempFile.GetURL(), 
"com.sun.star.text.TextDocument");
     // Make sure the new implemented export for commands A,B,V and W use the 
correct arc between
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index d336625159a5..d95ce2fac87e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -98,7 +98,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149551_mongolianVert)
 
     // Such shape must have vert="mongolianVert" again after saving.
     // Without fix the orientation was vert="vert".
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     assertXPath(pXmlDoc, "//wps:bodyPr", "vert", "mongolianVert");
@@ -124,7 +124,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNumberPortionFormatFromODT)
     load(DATA_DIRECTORY, "number-portion-format.odt");
 
     // When saving to DOCX:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
 
     // Then make sure that the paragraph marker's char format has that custom 
font size:
@@ -149,7 +149,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150966_regularInset)
 
     // Without fix the insets were tIns="359280" and bIns="539640". The text 
area had 1080Emu height
     // and Word displays no text at all.
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     assertXPathAttrs(pXmlDoc, "//wps:bodyPr", { { "tIns", "179640" }, { 
"bIns", "360000" } });
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 079312daf8c1..c7e48a63d4ac 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -877,7 +877,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlGrabBag)
     // When exporting that document back to DOCX:
     // Then make sure that completes without an assertion failure, which would 
mean not-well-formed
     // output was produced:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testContentControlShape)
@@ -889,7 +889,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlShape)
     // When exporting that document back to DOCX:
     // Then make sure that completes without an assertion failure, which would 
mean not-well-formed
     // output was produced, since the <w:sdt> was conditional but the </w:sdt> 
was unconditional:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf104823)
@@ -920,7 +920,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf104823)
     xContentControl2->setString("New Extended Property Value");
 
     // Save and check saved data
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
     xmlDocUniquePtr pXmlCustomPropsDoc = parseExport("customXml/item1.xml");
     CPPUNIT_ASSERT(pXmlCustomPropsDoc);
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 1a7549506bf0..d75018981659 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -646,11 +646,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testBookmarkCollapsed)
     CPPUNIT_ASSERT(pDoc);
 
     // save original document
-    utl::TempFileNamed aTempFile;
-    save("writer8", aTempFile);
+    save("writer8");
 
     // load only content.xml from the resaved document
-    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), 
"content.xml"))
+    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(maTempFile.GetURL(), 
"content.xml"))
     {
         const OString 
aPath("/office:document-content/office:body/office:text/text:p");
 
@@ -722,11 +721,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testRemoveBookmarkText)
     }
 
     // save document
-    utl::TempFileNamed aTempFile;
-    save("writer8", aTempFile);
+    save("writer8");
 
     // load only content.xml from the resaved document
-    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), 
"content.xml"))
+    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(maTempFile.GetURL(), 
"content.xml"))
     {
         const OString 
aPath("/office:document-content/office:body/office:text/text:p");
 
@@ -825,11 +823,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testRemoveBookmarkTextAndAddNew)
     }
 
     // save document
-    utl::TempFileNamed aTempFile;
-    save("writer8", aTempFile);
+    save("writer8");
 
     // load only content.xml from the resaved document
-    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), 
"content.xml"))
+    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(maTempFile.GetURL(), 
"content.xml"))
     {
         const OString 
aPath("/office:document-content/office:body/office:text/text:p");
 
@@ -891,11 +888,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testRemoveBookmarkTextAndAddNewAfterReload
     }
 
     // save original document
-    utl::TempFileNamed aTempFile;
-    save("writer8", aTempFile);
+    save("writer8");
 
     // load only content.xml from the resaved document
-    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), 
"content.xml"))
+    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(maTempFile.GetURL(), 
"content.xml"))
     {
         const OString 
aPath("/office:document-content/office:body/office:text/text:p");
 
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 9f483e8688d5..122f607fb7cc 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -1302,11 +1302,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testInconsistentBookmark)
     // save document and verify the bookmark scoup
     {
         // save document
-        utl::TempFileNamed aTempFile;
-        save("writer8", aTempFile);
+        save("writer8");
 
         // load only content.xml
-        if (xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), 
"content.xml"))
+        if (xmlDocUniquePtr pXmlDoc = parseExportInternal(maTempFile.GetURL(), 
"content.xml"))
         {
             const OString 
aPath("/office:document-content/office:body/office:text/text:p");
 
diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index 8d0b1e7e6dee..da7d4a21c133 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -73,7 +73,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPlainTextContentControlExport)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // When exporting to DOCX:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
 
     // Then make sure the expected markup is used:
@@ -95,7 +95,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testDocxComboBoxContentControlExport)
     pWrtShell->InsertContentControl(SwContentControlType::COMBO_BOX);
 
     // When exporting to DOCX:
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
     mbExported = true;
 
     // Then make sure the expected markup is used:
@@ -136,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxHyperlinkShape)
 
     // When saving this document to DOCX, then make sure we don't crash on 
export (due to an
     // assertion failure for not-well-formed XML output):
-    save("Office Open XML Text", maTempFile);
+    save("Office Open XML Text");
 }
 }
 
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index c0bf9ec9e58e..db51a1f75aec 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -338,7 +338,7 @@ protected:
     void reload(const char* pFilter, const char* filename, const char* 
pPassword = nullptr);
 
     /// Save the loaded document to a tempfile. Can be used to check the 
resulting docx/odt directly as a ZIP file.
-    void save(const OUString& aFilterName, utl::TempFileNamed& rTempFile);
+    void save(const OUString& aFilterName);
 
     /// Combines load() and save().
     void loadAndSave(const char* pName);
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index ab5ed2fcbe52..b12f640fb34f 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -139,7 +139,7 @@ void SwModelTestBase::executeImportExport(const char* 
filename, const char* pPas
     header();
     std::unique_ptr<Resetter> const pChanges(preTest(filename));
     load(mpTestDocumentPath, filename, pPassword);
-    save(OUString::createFromAscii(mpFilter), maTempFile);
+    save(OUString::createFromAscii(mpFilter));
     maTempFile.EnableKillingFile(false);
     verify();
     finish();
@@ -626,26 +626,25 @@ void SwModelTestBase::reload(const char* pFilter, const 
char* filename, const ch
         calcLayout();
 }
 
-void SwModelTestBase::save(const OUString& aFilterName, utl::TempFileNamed& 
rTempFile)
+void SwModelTestBase::save(const OUString& aFilterName)
 {
-    rTempFile.EnableKillingFile();
     uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
     utl::MediaDescriptor aMediaDescriptor;
     aMediaDescriptor["FilterName"] <<= aFilterName;
     if (!maFilterOptions.isEmpty())
         aMediaDescriptor["FilterOptions"] <<= maFilterOptions;
-    xStorable->storeToURL(rTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
+    xStorable->storeToURL(maTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
     // TODO: for now, validate only ODF here
     if (aFilterName == "writer8" || aFilterName == "OpenDocument Text Flat 
XML")
     {
-        validate(rTempFile.GetFileName(), test::ODF);
+        validate(maTempFile.GetFileName(), test::ODF);
     }
 }
 
 void SwModelTestBase::loadAndSave(const char* pName)
 {
     load(mpTestDocumentPath, pName);
-    save(OUString::createFromAscii(mpFilter), maTempFile);
+    save(OUString::createFromAscii(mpFilter));
     mbExported = true;
 }
 

Reply via email to