diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-09-21 20:54:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-29 09:11:18 +0200 |
commit | 4b95451f859bac8e05956ce12df17f1ee410032d (patch) | |
tree | 2ebe03c8ecbba3c9179d33c346774e037fcfc224 /xmloff | |
parent | a08468c1a5255d3fb04cd8a0dc627acdea40426a (diff) |
split utl::TempFile into fast and named variants
which makes it easier to know what each variant requires
to stay on it's happy path
Change-Id: I3275a2543573367714bc78092e882f6535507285
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140469
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/qa/unit/draw.cxx | 24 | ||||
-rw-r--r-- | xmloff/qa/unit/style.cxx | 18 | ||||
-rw-r--r-- | xmloff/qa/unit/text.cxx | 30 |
3 files changed, 36 insertions, 36 deletions
diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index 6aab4c12a46f..7fd1679effab 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -53,7 +53,7 @@ public: void tearDown() override; void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override; uno::Reference<lang::XComponent>& getComponent() { return mxComponent; } - void save(const OUString& rFilterName, utl::TempFile& rTempFile); + void save(const OUString& rFilterName, utl::TempFileNamed& rTempFile); uno::Reference<drawing::XShape> getShape(sal_uInt8 nShapeIndex); }; @@ -77,7 +77,7 @@ void XmloffDrawTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) XmlTestTools::registerODFNamespaces(pXmlXpathCtx); } -void XmloffDrawTest::save(const OUString& rFilterName, utl::TempFile& rTempFile) +void XmloffDrawTest::save(const OUString& rFilterName, utl::TempFileNamed& rTempFile) { uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -104,7 +104,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss) OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "textbox-loss.docx"; getComponent() = loadFromDesktop(aURL); uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("writer8"); @@ -131,7 +131,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle) getComponent() = loadFromDesktop(aURL, "com.sun.star.comp.drawing.DrawingDocument"); // Prepare use of XPath - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("draw8", aTempFile); uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(mxComponentContext, aTempFile.GetURL()); @@ -163,7 +163,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport) xMasterPage->setPropertyValue("Theme", aTheme); // Export to ODP: - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("impress8", aTempFile); // Check if the 12 colors are written in the XML: @@ -205,7 +205,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1356), rCrop.Right); // Execute ODP export: - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("impress8", aTempFile); std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -254,7 +254,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testReferToTheme) // When loading and saving that document: getComponent() = loadFromDesktop(aURL); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("impress8", aTempFile); // Make sure the export result has the theme reference: @@ -372,7 +372,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended) lcl_assertMetalProperties("from doc", xShape); // Test, that new attribute is written with loext namespace. Adapt when attribute is added to ODF. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // assert XML. @@ -401,7 +401,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict) // added to ODF. const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion()); SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // assert XML. @@ -444,7 +444,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended) // Test, that attribute is written in draw namespace with value 100% and in loext namespace with // value 122.0703125%. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // assert XML. @@ -473,7 +473,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularity) // Save to ODF 1.3 strict and make sure it does not produce a validation error. const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion()); SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); SetODFDefaultVersion(nCurrentODFVersion); @@ -576,7 +576,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextRotationPlusPre) // Save to ODF. Without the fix, a file format error was produced, because attribute // draw:text-rotate-angle was written twice, one from TextPreRotateAngle and the other from // TextRotateAngle. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; // This should already catch the format error, but does not, see tdf#149567 save("impress8", aTempFile); // But reload catches it. diff --git a/xmloff/qa/unit/style.cxx b/xmloff/qa/unit/style.cxx index c01f188c762d..7c9053df6b6b 100644 --- a/xmloff/qa/unit/style.cxx +++ b/xmloff/qa/unit/style.cxx @@ -48,7 +48,7 @@ public: void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override; uno::Reference<lang::XComponent>& getComponent() { return mxComponent; } void load(std::u16string_view rURL); - void save(const OUString& rFilterName, utl::TempFile& rTempFile); + void save(const OUString& rFilterName, utl::TempFileNamed& rTempFile); }; void XmloffStyleTest::setUp() @@ -77,7 +77,7 @@ void XmloffStyleTest::load(std::u16string_view rFileName) mxComponent = loadFromDesktop(aURL); } -void XmloffStyleTest::save(const OUString& rFilterName, utl::TempFile& rTempFile) +void XmloffStyleTest::save(const OUString& rFilterName, utl::TempFileNamed& rTempFile) { uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -126,7 +126,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFontSorting) // When saving that document to ODT: uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, @@ -234,7 +234,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // With applied fix for tdf150407 still loext:writing-mode="bt-lr" has to be written. @@ -254,7 +254,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // Without the fix an faulty 'writing-mode="bt-lr"' attribute was written in productive build. @@ -291,7 +291,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // With applied fix for tdf150407 still loext:vertical-rel="page-content-bottom" has to be @@ -314,7 +314,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // Without the fix an faulty 'vertical-rel="page-content-bottom"' attribute was written in @@ -351,7 +351,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // With applied fix for tdf150407 still loext:vertical-rel="page-content-top has to be @@ -374,7 +374,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // Without the fix an faulty 'vertical-rel="page-content-top"' attribute was written in diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx index 72b0e49ecbd0..ee5e4a580ebb 100644 --- a/xmloff/qa/unit/text.cxx +++ b/xmloff/qa/unit/text.cxx @@ -96,7 +96,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentResolved) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); getComponent()->dispose(); @@ -143,7 +143,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyLocalUrl) uno::Sequence<beans::PropertyValue> aStoreProps = { comphelper::makePropertyValue("FilterName", OUString("writer8")), }; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); // Without the accompanying fix in place, this test would have resulted in an assertion failure, // as LocalURL was mapped to XML_TOKEN_INVALID. @@ -204,7 +204,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testParaStyleListLevel) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); @@ -258,7 +258,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); @@ -292,7 +292,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -371,7 +371,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRelativeWidth) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); @@ -408,7 +408,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testScaleWidthAndHeight) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); @@ -444,7 +444,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -517,7 +517,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -614,7 +614,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -709,7 +709,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPictureContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -778,7 +778,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDateContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -855,7 +855,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPlainTextContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -921,7 +921,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testComboBoxContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -977,7 +977,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlAutostyleExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); // Without the accompanying fix in place, this test would have failed, we had duplicated XML // attributes. |