diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-10-25 10:18:11 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-10-25 11:24:43 +0200 |
commit | ff97d047393c955af2f3173a9c7e2534a059a058 (patch) | |
tree | 8263409f12317204d5a24ad78bb9e9b51ed6e853 /xmloff/qa/unit | |
parent | 42a7b48065977d11bc99ab32dadbfde5f1209438 (diff) |
UnoApiTest: use validate when saving files
Change-Id: I0f04fae8b4ff922f5e14ae413cd63cc92a66077e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141797
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'xmloff/qa/unit')
-rw-r--r-- | xmloff/qa/unit/draw.cxx | 16 | ||||
-rw-r--r-- | xmloff/qa/unit/style.cxx | 6 | ||||
-rw-r--r-- | xmloff/qa/unit/text.cxx | 13 |
3 files changed, 3 insertions, 32 deletions
diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index 28575f29b12c..b13109900a41 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -71,9 +71,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss) { // Load a document that has a shape with a textbox in it. Save it to ODF and reload. loadFromURL(u"textbox-loss.docx"); - utl::TempFileNamed aTempFile = save("impress8"); - validate(aTempFile.GetFileName(), test::ODF); - mxComponent = loadFromDesktop(aTempFile.GetURL()); + saveAndReload("impress8"); // Make sure that the shape is still a textbox. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); @@ -94,7 +92,6 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle) // Prepare use of XPath utl::TempFileNamed aTempFile = save("draw8"); - validate(aTempFile.GetFileName(), test::ODF); uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(mxComponentContext, aTempFile.GetURL()); uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName("content.xml"), @@ -126,7 +123,6 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport) // Export to ODP: utl::TempFileNamed aTempFile = save("impress8"); - validate(aTempFile.GetFileName(), test::ODF); // Check if the 12 colors are written in the XML: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "styles.xml"); @@ -167,7 +163,6 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot) // Execute ODP export: utl::TempFileNamed aTempFile = save("impress8"); - validate(aTempFile.GetFileName(), test::ODF); std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); @@ -210,7 +205,6 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testReferToTheme) // Given a document that refers to a theme color: loadFromURL(u"refer-to-theme.odp"); utl::TempFileNamed aTempFile = save("impress8"); - validate(aTempFile.GetFileName(), test::ODF); // Make sure the export result has the theme reference: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -322,7 +316,6 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended) // Test, that new attribute is written with loext namespace. Adapt when attribute is added to ODF. utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // assert XML. std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -347,7 +340,6 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict) const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion()); SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // assert XML. std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -387,7 +379,6 @@ 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::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // assert XML. std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -412,7 +403,6 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularity) const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion()); SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); SetODFDefaultVersion(nCurrentODFVersion); } @@ -511,10 +501,8 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextRotationPlusPre) // draw:text-rotate-angle was written twice, one from TextPreRotateAngle and the other from // TextRotateAngle. // This should already catch the format error, but does not, see tdf#149567 - utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // But reload catches it. - mxComponent = loadFromDesktop(aTempFile.GetURL()); + saveAndReload("writer8"); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmloff/qa/unit/style.cxx b/xmloff/qa/unit/style.cxx index f2a2bd80e352..016c5d6bb5ed 100644 --- a/xmloff/qa/unit/style.cxx +++ b/xmloff/qa/unit/style.cxx @@ -189,7 +189,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR) officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // With applied fix for tdf150407 still loext:writing-mode="bt-lr" has to be written. std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "styles.xml"); @@ -211,7 +210,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR) officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Without the fix an faulty 'writing-mode="bt-lr"' attribute was written in productive build. // A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey(). @@ -246,7 +244,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // With applied fix for tdf150407 still loext:vertical-rel="page-content-bottom" has to be // written. @@ -271,7 +268,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Without the fix an faulty 'vertical-rel="page-content-bottom"' attribute was written in // productive build. A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey(). @@ -306,7 +302,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // With applied fix for tdf150407 still loext:vertical-rel="page-content-top has to be // written. @@ -331,7 +326,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Without the fix an faulty 'vertical-rel="page-content-top"' attribute was written in // productive build. A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey(). diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx index 8d8733f4d582..99bb4c1a2910 100644 --- a/xmloff/qa/unit/text.cxx +++ b/xmloff/qa/unit/text.cxx @@ -109,11 +109,9 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyLocalUrl) xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false); // When invoking ODT export + import on it: - utl::TempFileNamed aTempFile = save("writer8"); + saveAndReload("writer8"); // Without the accompanying fix in place, this test would have resulted in an assertion failure, // as LocalURL was mapped to XML_TOKEN_INVALID. - validate(aTempFile.GetFileName(), test::ODF); - mxComponent = loadFromDesktop(aTempFile.GetURL()); // Then make sure that LocalURL is preserved: xTextDocument.set(mxComponent, uno::UNO_QUERY); @@ -244,7 +242,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakExport) // When exporting to ODT: utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Then make sure the expected markup is used: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -387,7 +384,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlExport) // When exporting to ODT: utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Then make sure the expected markup is used: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -451,7 +447,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlExport) // When exporting to ODT: utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Then make sure the expected markup is used: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -539,7 +534,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlExport) // When exporting to ODT: utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Then make sure the expected markup is used: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -625,7 +619,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPictureContentControlExport) // When exporting to ODT: utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Then make sure the expected markup is used: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -685,7 +678,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDateContentControlExport) // When exporting to ODT: utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Then make sure the expected markup is used: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -753,7 +745,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPlainTextContentControlExport) // When exporting to ODT: utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Then make sure the expected markup is used: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -810,7 +801,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testComboBoxContentControlExport) // When exporting to ODT: utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Then make sure the expected markup is used: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -841,7 +831,6 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testAliasContentControlExport) // When exporting to ODT: utl::TempFileNamed aTempFile = save("writer8"); - validate(aTempFile.GetFileName(), test::ODF); // Then make sure the expected markup is used: std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); |