summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/qa/cppunit/test_misc.cxx6
-rw-r--r--xmloff/qa/unit/draw.cxx8
-rw-r--r--xmloff/qa/unit/style.cxx8
-rw-r--r--xmloff/qa/unit/text.cxx44
4 files changed, 8 insertions, 58 deletions
diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx
index 652533db4551..212dc1aea5bf 100644
--- a/sfx2/qa/cppunit/test_misc.cxx
+++ b/sfx2/qa/cppunit/test_misc.cxx
@@ -76,11 +76,7 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testODFCustomMetadata)
xProps->storeToMedium(aTempFile.GetURL(), mimeArgs);
// check that custom metadata is preserved
- uno::Reference<packages::zip::XZipFileAccess2> const xZip(
- packages::zip::ZipFileAccess::createWithURL(m_xContext, aTempFile.GetURL()));
- uno::Reference<io::XInputStream> const xInputStream(xZip->getByName("meta.xml"), uno::UNO_QUERY);
- std::unique_ptr<SvStream> const pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "meta.xml");
assertXPathContent(pXmlDoc, "/office:document-meta/office:meta/bork", "bork");
assertXPath(pXmlDoc, "/office:document-meta/office:meta/foo:bar", 1);
assertXPath(pXmlDoc, "/office:document-meta/office:meta/foo:bar/baz:foo", 1);
diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx
index 93b230db8d72..1f41afbba3ed 100644
--- a/xmloff/qa/unit/draw.cxx
+++ b/xmloff/qa/unit/draw.cxx
@@ -13,7 +13,6 @@
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeMetalType.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
@@ -91,12 +90,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle)
// Prepare use of XPath
utl::TempFileNamed aTempFile = save("draw8");
- 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");
// Without fix draw:extrusion-skew="50 -135" was not written to file although "50 -135" is not
// default in ODF, but only default inside LO.
diff --git a/xmloff/qa/unit/style.cxx b/xmloff/qa/unit/style.cxx
index f5b42fac1fb0..a51b55b37818 100644
--- a/xmloff/qa/unit/style.cxx
+++ b/xmloff/qa/unit/style.cxx
@@ -16,7 +16,6 @@
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
@@ -89,12 +88,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFontSorting)
utl::TempFileNamed aTempFile = save("writer8");
// Then make sure <style:font-face> elements are sorted (by style:name="..."):
- 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");
xmlXPathObjectPtr pXPath
= getXPathNode(pXmlDoc, "/office:document-content/office:font-face-decls/style:font-face");
xmlNodeSetPtr pXmlNodes = pXPath->nodesetval;
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index 7a78848c4b7a..64ec2500ad9f 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -17,7 +17,6 @@
#include <com/sun/star/text/BibliographyDataType.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <comphelper/propertysequence.hxx>
#include <comphelper/propertyvalue.hxx>
@@ -152,25 +151,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testParaStyleListLevel)
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), nNumberingLevel);
// Test the export as well:
-
- // Given a doc model that has a para style with NumberingLevel=2:
- uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-
- // When exporting that to ODT:
- uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({
- { "FilterName", uno::Any(OUString("writer8")) },
- });
- utl::TempFileNamed aTempFile;
- aTempFile.EnableKillingFile();
- xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
+ utl::TempFileNamed aTempFile = save("writer8");
// Then make sure we save the style's numbering level:
- uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
- = packages::zip::ZipFileAccess::createWithURL(mxComponentContext, aTempFile.GetURL());
- uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName("styles.xml"),
- uno::UNO_QUERY);
- std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
// Without the accompanying fix in place, this failed with:
// - XPath '/office:document-styles/office:styles/style:style[@style:name='mystyle']' no attribute 'list-level' exist
// i.e. a custom NumberingLevel was lost on save.
@@ -206,13 +190,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId)
loadFromURL(u"list-id.fodt");
// When storing that document as ODF:
- uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
- uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({
- { "FilterName", uno::Any(OUString("writer8")) },
- });
- utl::TempFileNamed aTempFile;
- aTempFile.EnableKillingFile();
- xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
+ utl::TempFileNamed aTempFile = save("writer8");
// Then make sure that unreferenced xml:id="..." attributes are not written:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
@@ -307,13 +285,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRelativeWidth)
// Body frame width is 16cm.
xStyle->setPropertyValue("Width", uno::Any(static_cast<sal_Int32>(20000)));
- uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
- uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({
- { "FilterName", uno::Any(OUString("writer8")) },
- });
- utl::TempFileNamed aTempFile;
- aTempFile.EnableKillingFile();
- xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
+ utl::TempFileNamed aTempFile = save("writer8");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this failed with:
@@ -343,13 +315,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testScaleWidthAndHeight)
xText->insertTextContent(xCursor, xTextFrame, /*bAbsorb=*/false);
// When exporting to ODT:
- uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
- uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({
- { "FilterName", uno::Any(OUString("writer8")) },
- });
- utl::TempFileNamed aTempFile;
- aTempFile.EnableKillingFile();
- xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
+ utl::TempFileNamed aTempFile = save("writer8");
// Then make sure that we still export a non-zero size:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");