diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-10-25 11:39:44 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-10-25 13:02:16 +0200 |
commit | 0d2606e30abf3d335abc349165b016077a0c0793 (patch) | |
tree | 9a2622a6269af95bb0ca237a84d8c24df0df5dd7 /oox | |
parent | be3ac27bc83e4b27f55446dde42c45e4d5cc788e (diff) |
CppunitTest_oox_export: inherit from UnoApiTest
Change-Id: I46ae3ce5b1fdf6ef5c9d9a22cd589ed04d08ca2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141802
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/CppunitTest_oox_export.mk | 1 | ||||
-rw-r--r-- | oox/qa/unit/export.cxx | 213 |
2 files changed, 91 insertions, 123 deletions
diff --git a/oox/CppunitTest_oox_export.mk b/oox/CppunitTest_oox_export.mk index 4fe22bd098b4..98f4dc8e6363 100644 --- a/oox/CppunitTest_oox_export.mk +++ b/oox/CppunitTest_oox_export.mk @@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,oox_export, \ cppu \ oox \ sal \ + subsequenttest \ test \ unotest \ utl \ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index d8771b0b9699..de8385fbaf09 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -7,8 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <test/bootstrapfixture.hxx> -#include <unotest/macros_test.hxx> +#include <test/unoapi_test.hxx> #include <test/xmltesttools.hxx> #include <com/sun/star/frame/Desktop.hpp> @@ -22,69 +21,31 @@ using namespace ::com::sun::star; namespace { /// Covers ooox/source/export/ fixes. -class Test : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools +class Test : public UnoApiTest, public XmlTestTools { -private: - uno::Reference<lang::XComponent> mxComponent; - utl::TempFileNamed maTempFile; - public: - void setUp() override; - void tearDown() override; + Test() + : UnoApiTest("/oox/qa/unit/data/") + { + } + void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override; - utl::TempFileNamed& getTempFile() { return maTempFile; } - void loadAndSave(const OUString& rURL, const OUString& rFilterName); }; -void Test::setUp() -{ - test::BootstrapFixture::setUp(); - - mxDesktop.set(frame::Desktop::create(mxComponentContext)); -} - -void Test::tearDown() -{ - if (mxComponent.is()) - mxComponent->dispose(); - - test::BootstrapFixture::tearDown(); -} - void Test::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) { XmlTestTools::registerOOXMLNamespaces(pXmlXpathCtx); } -void Test::loadAndSave(const OUString& rURL, const OUString& rFilterName) -{ - mxComponent = loadFromDesktop(rURL); - uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); - utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= rFilterName; - maTempFile.EnableKillingFile(); - xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); - mxComponent->dispose(); - mxComponent.clear(); - // too many DOCX validation errors right now - if (rFilterName != "Office Open XML Text") - { - validate(maTempFile.GetFileName(), test::OOXML); - } -} - -constexpr OUStringLiteral DATA_DIRECTORY = u"/oox/qa/unit/data/"; - CPPUNIT_TEST_FIXTURE(Test, testPolylineConnectorPosition) { // Given a document with a group shape and therein a polyline and a connector. - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf141786_PolylineConnectorInGroup.odt"; + loadFromURL(u"tdf141786_PolylineConnectorInGroup.odt"); // When saving that to DOCX: - loadAndSave(aURL, "Office Open XML Text"); + utl::TempFileNamed aTempFile = save("Office Open XML Text"); // Then make sure polyline and connector have the correct position. - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "word/document.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "word/document.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // For child elements of groups in Writer the position has to be adapted to be relative @@ -105,13 +66,16 @@ CPPUNIT_TEST_FIXTURE(Test, testPolylineConnectorPosition) CPPUNIT_TEST_FIXTURE(Test, testRotatedShapePosition) { // Given a document with a group shape and therein a rotated custom shape. - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf141786_RotatedShapeInGroup.odt"; + loadFromURL(u"tdf141786_RotatedShapeInGroup.odt"); + + // FIXME: validation error in OOXML export: Errors: 3 + mbSkipValidation = true; + // When saving that to DOCX: - loadAndSave(aURL, "Office Open XML Text"); + utl::TempFileNamed aTempFile = save("Office Open XML Text"); // Then make sure the rotated child shape has the correct position. - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "word/document.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "word/document.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // For a group itself and for shapes outside of groups, the position calculation is done in @@ -125,14 +89,17 @@ CPPUNIT_TEST_FIXTURE(Test, testRotatedShapePosition) CPPUNIT_TEST_FIXTURE(Test, testDmlGroupshapePolygon) { // Given a document with a group shape, containing a single polygon child shape: - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "dml-groupshape-polygon.docx"; + loadFromURL(u"dml-groupshape-polygon.docx"); + + // FIXME: validation error in OOXML export: Errors: 9 + mbSkipValidation = true; // When saving that to DOCX: - loadAndSave(aURL, "Office Open XML Text"); + utl::TempFileNamed aTempFile = save("Office Open XML Text"); // Then make sure that the group shape, the group shape's child size and the child shape's size // match: - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "word/document.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "word/document.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); assertXPath(pXmlDoc, "//wpg:grpSpPr/a:xfrm/a:ext", "cx", "5328360"); // Without the accompanying fix in place, this test would have failed, the <a:chExt> element was @@ -144,12 +111,16 @@ CPPUNIT_TEST_FIXTURE(Test, testDmlGroupshapePolygon) CPPUNIT_TEST_FIXTURE(Test, testCustomShapeArrowExport) { // Given a document with a few different kinds of arrow shapes in it: - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf142602_CustomShapeArrows.odt"; + loadFromURL(u"tdf142602_CustomShapeArrows.odt"); + + // FIXME: validation error in OOXML export: Errors: 11 + mbSkipValidation = true; + // When saving that to DOCX: - loadAndSave(aURL, "Office Open XML Text"); + utl::TempFileNamed aTempFile = save("Office Open XML Text"); // Then the shapes should retain their correct control values. - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "word/document.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "word/document.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // Without the fix the output OOXML would have no <a:prstGeom> tags in it. @@ -330,13 +301,12 @@ CPPUNIT_TEST_FIXTURE(Test, testCustomShapeArrowExport) CPPUNIT_TEST_FIXTURE(Test, testCameraRevolutionGrabBag) { // Given a PPTX file that contains camera revolution (rotation around z axis) applied shapes - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "camera-rotation-revolution-nonwps.pptx"; + loadFromURL(u"camera-rotation-revolution-nonwps.pptx"); // When saving that document: - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // Then make sure the revolution is exported without a problem: // First shape textbox: @@ -357,12 +327,12 @@ CPPUNIT_TEST_FIXTURE(Test, testCameraRevolutionGrabBag) CPPUNIT_TEST_FIXTURE(Test, testReferToTheme) { // Given a PPTX file that contains references to a theme: - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "refer-to-theme.pptx"; + loadFromURL(u"refer-to-theme.pptx"); // When saving that document: - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // Then make sure the shape text color is a scheme color: // Without the accompanying fix in place, this test would have failed with: @@ -399,10 +369,10 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToTheme) CPPUNIT_TEST_FIXTURE(Test, testReferToThemeShapeFill) { // Given an ODP file that contains references to a theme for shape fill: - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "refer-to-theme-shape-fill.odp"; + loadFromURL(u"refer-to-theme-shape-fill.odp"); // When saving that document: - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Then make sure the shape fill color is a scheme color: // Without the accompanying fix in place, this test would have failed with: @@ -410,7 +380,7 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToThemeShapeFill) // - Actual : 0 // i.e. the <a:schemeClr> element was not written. Note that this was already working from PPTX // files via grab-bags, so this test intentionally uses an ODP file as input. - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr", "val", "accent1"); // Without the accompanying fix in place, this test would have failed with: @@ -423,13 +393,12 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToThemeShapeFill) CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSize) { // Given a PPTX file that contains references to a theme: - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "endParaRPr-newline-textsize.pptx"; + loadFromURL(u"endParaRPr-newline-textsize.pptx"); // When saving that document: - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // Make sure the text size is exported correctly: // Without the accompanying fix in place, this test would have failed with: @@ -444,12 +413,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSi CPPUNIT_TEST_FIXTURE(Test, testTdf147978_endsubpath) { // Given an odp file that contains a non-primitive custom shape with command N - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf147978_endsubpath.odp"; + loadFromURL(u"tdf147978_endsubpath.odp"); // When saving that document: - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // Then make sure the pathLst has two child elements, // Without the accompanying fix in place, only one element a:path was exported. @@ -462,13 +431,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_endsubpath) CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandA) { // Given an odp file that contains a non-primitive custom shape with command N - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf147978_enhancedPath_commandA.odp"; + loadFromURL(u"tdf147978_enhancedPath_commandA.odp"); // When saving that document: - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // Then make sure the path has a child element arcTo. Prior to the fix that part of the curve was // not exported at all. In odp it is a command A. Such does not exist in OOXML and is therefore @@ -485,14 +453,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandA) CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandT) { // The odp file contains a non-primitive custom shape with commands MTZ - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf147978_enhancedPath_commandT.odp"; + loadFromURL(u"tdf147978_enhancedPath_commandT.odp"); // Export to pptx had only exported the command M and has used a wrong path size - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup: - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // File has draw:viewBox="0 0 216 216" assertXPath(pXmlDoc, "//a:pathLst/a:path", "w", "216"); @@ -516,14 +483,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandT) CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandXY) { // The odp file contains a non-primitive custom shapes with commands XY - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf147978_enhancedPath_commandXY.odp"; + loadFromURL(u"tdf147978_enhancedPath_commandXY.odp"); // Export to pptx had dropped commands X and Y. - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup: - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // File has draw:viewBox="0 0 10 10" assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "w", "10"); @@ -552,14 +518,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandXY) CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandHIJK) { // The odp file contains a non-primitive custom shapes with commands H,I,J,K - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf147978_enhancedPath_commandHIJK.odp"; + loadFromURL(u"tdf147978_enhancedPath_commandHIJK.odp"); // Export to pptx had dropped commands X and Y. - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup: - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // File has draw:viewBox="0 0 80 80" assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "w", "80"); @@ -576,14 +541,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandHIJK) CPPUNIT_TEST_FIXTURE(Test, testTdf147978_subpath) { // The odp file contains a non-primitive custom shapes with commands H,I,J,K - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf147978_enhancedPath_subpath.pptx"; + loadFromURL(u"tdf147978_enhancedPath_subpath.pptx"); // Export to pptx had dropped the subpaths. - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup: - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // File should have four subpaths with increasing path size assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "w", "10"); @@ -599,12 +563,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_subpath) CPPUNIT_TEST_FIXTURE(Test, testTdf100391TextAreaRect) { // The document has a custom shape of type "non-primitive" to trigger the custGeom export - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf100391_TextAreaRect.odp"; + loadFromURL(u"tdf100391_TextAreaRect.odp"); // When saving to PPTX the textarea rect was set to default instead of using the actual area - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup. Without fix the values were l="l", t="t", r="r", b="b" - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); assertXPath(pXmlDoc, "//a:custGeom/a:rect", "l", "textAreaLeft"); assertXPath(pXmlDoc, "//a:custGeom/a:rect", "t", "textAreaTop"); @@ -621,13 +585,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109169_OctagonBevel) { // The odp file contains an "Octagon Bevel" shape. Such has shading not in commands H,I,J,K // but shading is generated in ctor of EnhancedCustomShape2d from the Type value. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf109169_OctagonBevel.odt"; + loadFromURL(u"tdf109169_OctagonBevel.odt"); + + // FIXME: validation error in OOXML export: Errors: 1 + mbSkipValidation = true; // Export to docx had not written a:fill or a:stroke attributes at all. - loadAndSave(aURL, "Office Open XML Text"); + utl::TempFileNamed aTempFile = save("Office Open XML Text"); // Verify the markup: - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "word/document.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "word/document.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // File should have six subpaths, one with stroke and five with fill assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "stroke", "0"); @@ -644,12 +611,12 @@ CPPUNIT_TEST_FIXTURE(Test, testFaultyPathCommandsAWT) // path. LO is tolerant and renders it so that is makes a moveTo to the start point of the arc or // the end of the line respectively. Export to OOXML does the same now and writes a moveTo // instead of the normally used lnTo. If a lnTo is written, MS Office shows nothing of the shape. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "FaultyPathStart.odp"; + loadFromURL(u"FaultyPathStart.odp"); - loadAndSave(aURL, "Impress Office Open XML"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup: - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // First child of a:path should be a moveTo in all four shapes. assertXPath(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); @@ -664,11 +631,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchXY) // They use formulas with 'right' and 'bottom'. // When saving to PPTX the attributes stretchpoint-x and stretchpoint-y were not considered. The // line at right and bottom edge were positioned inside as if the shape had a square size. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf148784_StretchXY.odp"; - loadAndSave(aURL, "Impress Office Open XML"); + loadFromURL(u"tdf148784_StretchXY.odp"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup. - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // x-position of last segment should be same as path width. It was 21600 without fix. @@ -701,11 +668,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchCommandQ) // They use formulas with 'right' and 'bottom'. // When saving to PPTX the attributes stretchpoint-x and stretchpoint-y were not considered. // That results in wrong arcs on the right or bottom side of the shape. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf148784_StretchCommandQ.odp"; - loadAndSave(aURL, "Impress Office Open XML"); + loadFromURL(u"tdf148784_StretchCommandQ.odp"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup. - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // x-position of second quadBezTo control should be same as path width. It was 21600 without fix. @@ -741,11 +708,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchCommandVW) // has only fixed values in the path. // When saving to PPTX the attributes stretchpoint-x and stretchpoint-y were not considered. // That results in circles instead of ellipses. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf148784_StretchCommandVW.odp"; - loadAndSave(aURL, "Impress Office Open XML"); + loadFromURL(u"tdf148784_StretchCommandVW.odp"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup. - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // wR of first ArcTo in first shape should be same as path width/2. It was 10800 without fix. @@ -776,11 +743,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149551VertPadding) // The document has shape[1] with attribute vert="vert270" and shape[2] with vert="vert". The text // has paddings lIns="720000"=2cm, tIns="360000"=1cm, rIns="0" and bIns="0". // After load and save the paddings were rotated and a 90deg text rotation was added. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf149551_vert_and_padding.pptx"; - loadAndSave(aURL, "Impress Office Open XML"); + loadFromURL(u"tdf149551_vert_and_padding.pptx"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup. The values must be the same as in the original file. - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); for (sal_Int32 i = 1; i <= 2; i++) { @@ -799,11 +766,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149538upright) // emulated by rotating the text area rectangle. On export there should be an upright="1" // attribute but no 'rot' attribute. Without the fix the 'rot' attribute with values from // the emulation was written out. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf149538_upright.pptx"; - loadAndSave(aURL, "Impress Office Open XML"); + loadFromURL(u"tdf149538_upright.pptx"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); // Verify the markup. The values must be the same as in the original file. - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); assertXPath(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr", "upright", "1"); assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr", "rot"); @@ -811,9 +778,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149538upright) CPPUNIT_TEST_FIXTURE(Test, testTdf151008VertAnchor) { - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf151008_eaVertAnchor.pptx"; - loadAndSave(aURL, "Impress Office Open XML"); - std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + loadFromURL(u"tdf151008_eaVertAnchor.pptx"); + utl::TempFileNamed aTempFile = save("Impress Office Open XML"); + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // The order of the shapes in the file is by name "Right", "Center", "Left", "RightMiddle", // "CenterMiddle" and "LeftMiddle". I access the shapes here by index, because the XPath is |