UnoApiTest: simplify code by using tempfile member

SwModelTestBase does the same. this will help to make
SwModelTestBase inherit from UnoApiTest

Change-Id: If1c824cf92f0e8b70253e4d5fdeddcaa521d4632
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142287
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2022-11-04 17:31:55 +01:00
parent 444bf8710d
commit 248be1fe7d
42 changed files with 640 additions and 697 deletions

View file

@ -632,10 +632,10 @@ getShapeByName(const uno::Reference<drawing::XShapes>& rShapes, const OUString&
xmlDocUniquePtr ChartTest::parseExport(const OUString& rDir, const OUString& rFilterFormat)
{
utl::TempFileNamed aTempFile = save(rFilterFormat);
save(rFilterFormat);
// Read the XML stream we're interested in.
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), aTempFile.GetURL());
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName(findChartFile(rDir, xNameAccess)), uno::UNO_QUERY);
CPPUNIT_ASSERT(xInputStream.is());
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));

View file

@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,cppcanvas_emfplus, \
test \
tl \
unotest \
utl \
vcl \
))

View file

@ -94,9 +94,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSaveOnThread)
mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", aLoadProperties);
// When saving that document on a thread:
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
OdtExportThread aThread(mxComponent, aTempFile.GetURL());
OdtExportThread aThread(mxComponent, maTempFile.GetURL());
aThread.create();
{
SolarMutexReleaser r;
@ -108,7 +106,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSaveOnThread)
}
// Then make sure its visible area's width is correct.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// 16 pixels, assuming 96 DPI.
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 0.1665in

View file

@ -36,9 +36,9 @@ public:
css::uno::Any executeMacro(const OUString& rScriptURL,
const css::uno::Sequence<css::uno::Any>& rParams = {});
utl::TempFileNamed save(const OUString& rFilter);
utl::TempFileNamed saveAndClose(const OUString& rFilter);
utl::TempFileNamed saveAndReload(const OUString& rFilter);
void save(const OUString& rFilter);
void saveAndClose(const OUString& rFilter);
void saveAndReload(const OUString& rFilter);
void skipValidation() { mbSkipValidation = true; }
void setFilterOptions(const OUString& rFilterOptions) { maFilterOptions = rFilterOptions; }
@ -47,6 +47,8 @@ protected:
// reference to document component that we are testing
css::uno::Reference<css::lang::XComponent> mxComponent;
utl::TempFileNamed maTempFile;
private:
bool mbSkipValidation;
OUString m_aBaseString;

View file

@ -22,7 +22,7 @@ class OOO_DLLPUBLIC_TEST UnoApiXmlTest : public UnoApiTest, public XmlTestTools
public:
UnoApiXmlTest(OUString path);
xmlDocUniquePtr parseExport(OUString const& rTempFile, OUString const& rStreamName);
xmlDocUniquePtr parseExport(OUString const& rStreamName);
};
#endif // INCLUDED_TEST_UNOAPIXML_TEST_HXX

View file

@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,lotuswordpro_import_test, \
test \
tl \
unotest \
utl \
vcl \
))

View file

@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,oox_mathml, \
subsequenttest \
test \
unotest \
utl \
))
$(eval $(call gb_CppunitTest_use_sdk_api,oox_mathml))

View file

@ -41,10 +41,10 @@ CPPUNIT_TEST_FIXTURE(Test, testPolylineConnectorPosition)
// Given a document with a group shape and therein a polyline and a connector.
loadFromURL(u"tdf141786_PolylineConnectorInGroup.odt");
// When saving that to DOCX:
utl::TempFileNamed aTempFile = save("Office Open XML Text");
save("Office Open XML Text");
// Then make sure polyline and connector have the correct position.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "word/document.xml");
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
// For child elements of groups in Writer the position has to be adapted to be relative
// to group instead of being relative to anchor. That was missing for polyline and
@ -70,10 +70,10 @@ CPPUNIT_TEST_FIXTURE(Test, testRotatedShapePosition)
skipValidation();
// When saving that to DOCX:
utl::TempFileNamed aTempFile = save("Office Open XML Text");
save("Office Open XML Text");
// Then make sure the rotated child shape has the correct position.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "word/document.xml");
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
// For a group itself and for shapes outside of groups, the position calculation is done in
// DocxSdrExport. For child elements of groups it has to be done in
@ -92,11 +92,11 @@ CPPUNIT_TEST_FIXTURE(Test, testDmlGroupshapePolygon)
skipValidation();
// When saving that to DOCX:
utl::TempFileNamed aTempFile = save("Office Open XML Text");
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:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "word/document.xml");
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
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
// not written.
@ -113,10 +113,10 @@ CPPUNIT_TEST_FIXTURE(Test, testCustomShapeArrowExport)
skipValidation();
// When saving that to DOCX:
utl::TempFileNamed aTempFile = save("Office Open XML Text");
save("Office Open XML Text");
// Then the shapes should retain their correct control values.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "word/document.xml");
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
// Without the fix the output OOXML would have no <a:prstGeom> tags in it.
@ -299,9 +299,9 @@ CPPUNIT_TEST_FIXTURE(Test, testCameraRevolutionGrabBag)
loadFromURL(u"camera-rotation-revolution-nonwps.pptx");
// When saving that document:
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// Then make sure the revolution is exported without a problem:
// First shape textbox:
assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:scene3d/a:camera/a:rot", "rev", "5400000");
@ -324,9 +324,9 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToTheme)
loadFromURL(u"refer-to-theme.pptx");
// When saving that document:
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// Then make sure the shape text color is a scheme color:
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
@ -365,7 +365,7 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToThemeShapeFill)
loadFromURL(u"refer-to-theme-shape-fill.odp");
// When saving that document:
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
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:
@ -373,7 +373,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.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
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:
// - XPath '//p:sp[1]/p:spPr/a:solidFill/a:schemeClr/a:lumMod' number of nodes is incorrect
@ -388,9 +388,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSi
loadFromURL(u"endParaRPr-newline-textsize.pptx");
// When saving that document:
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// Make sure the text size is exported correctly:
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 500
@ -407,9 +407,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_endsubpath)
loadFromURL(u"tdf147978_endsubpath.odp");
// When saving that document:
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// Then make sure the pathLst has two child elements,
// Without the accompanying fix in place, only one element a:path was exported.
assertXPathChildren(pXmlDoc, "//a:pathLst", 2);
@ -424,9 +424,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandA)
loadFromURL(u"tdf147978_enhancedPath_commandA.odp");
// When saving that document:
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// 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
// exported as a:lnTo followed by a:arcTo
@ -445,10 +445,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandT)
loadFromURL(u"tdf147978_enhancedPath_commandT.odp");
// Export to pptx had only exported the command M and has used a wrong path size
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// File has draw:viewBox="0 0 216 216"
assertXPath(pXmlDoc, "//a:pathLst/a:path", "w", "216");
assertXPath(pXmlDoc, "//a:pathLst/a:path", "h", "216");
@ -474,10 +474,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandXY)
loadFromURL(u"tdf147978_enhancedPath_commandXY.odp");
// Export to pptx had dropped commands X and Y.
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// File has draw:viewBox="0 0 10 10"
assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "w", "10");
assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "h", "10");
@ -508,10 +508,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_commandHIJK)
loadFromURL(u"tdf147978_enhancedPath_commandHIJK.odp");
// Export to pptx had dropped commands X and Y.
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// File has draw:viewBox="0 0 80 80"
assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "w", "80");
assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "h", "80");
@ -530,10 +530,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_subpath)
loadFromURL(u"tdf147978_enhancedPath_subpath.pptx");
// Export to pptx had dropped the subpaths.
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// File should have four subpaths with increasing path size
assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "w", "10");
assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "h", "10");
@ -550,10 +550,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf100391TextAreaRect)
// The document has a custom shape of type "non-primitive" to trigger the custGeom export
loadFromURL(u"tdf100391_TextAreaRect.odp");
// When saving to PPTX the textarea rect was set to default instead of using the actual area
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup. Without fix the values were l="l", t="t", r="r", b="b"
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "//a:custGeom/a:rect", "l", "textAreaLeft");
assertXPath(pXmlDoc, "//a:custGeom/a:rect", "t", "textAreaTop");
assertXPath(pXmlDoc, "//a:custGeom/a:rect", "r", "textAreaRight");
@ -575,10 +575,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109169_OctagonBevel)
skipValidation();
// Export to docx had not written a:fill or a:stroke attributes at all.
utl::TempFileNamed aTempFile = save("Office Open XML Text");
save("Office Open XML Text");
// Verify the markup:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "word/document.xml");
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
// File should have six subpaths, one with stroke and five with fill
assertXPath(pXmlDoc, "//a:pathLst/a:path[1]", "stroke", "0");
assertXPath(pXmlDoc, "//a:pathLst/a:path[2]", "fill", "darkenLess");
@ -596,10 +596,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFaultyPathCommandsAWT)
// instead of the normally used lnTo. If a lnTo is written, MS Office shows nothing of the shape.
loadFromURL(u"FaultyPathStart.odp");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// 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");
assertXPath(pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo");
@ -614,10 +614,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchXY)
// 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.
loadFromURL(u"tdf148784_StretchXY.odp");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// x-position of last segment should be same as path width. It was 21600 without fix.
sal_Int32 nWidth
@ -650,10 +650,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchCommandQ)
// 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.
loadFromURL(u"tdf148784_StretchCommandQ.odp");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// x-position of second quadBezTo control should be same as path width. It was 21600 without fix.
sal_Int32 nWidth
@ -689,10 +689,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchCommandVW)
// When saving to PPTX the attributes stretchpoint-x and stretchpoint-y were not considered.
// That results in circles instead of ellipses.
loadFromURL(u"tdf148784_StretchCommandVW.odp");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// wR of first ArcTo in first shape should be same as path width/2. It was 10800 without fix.
sal_Int32 nHalfWidth
@ -723,10 +723,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149551VertPadding)
// 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.
loadFromURL(u"tdf149551_vert_and_padding.pptx");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup. The values must be the same as in the original file.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
for (sal_Int32 i = 1; i <= 2; i++)
{
OString sElement = "//p:spTree/p:sp[" + OString::number(i) + "]/p:txBody/a:bodyPr";
@ -745,10 +745,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149538upright)
// attribute but no 'rot' attribute. Without the fix the 'rot' attribute with values from
// the emulation was written out.
loadFromURL(u"tdf149538_upright.pptx");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Verify the markup. The values must be the same as in the original file.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr", "upright", "1");
assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr", "rot");
}
@ -756,8 +756,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149538upright)
CPPUNIT_TEST_FIXTURE(Test, testTdf151008VertAnchor)
{
loadFromURL(u"tdf151008_eaVertAnchor.pptx");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// 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
// easier then.

View file

@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_functionlistobj, \
subsequenttest \
test \
unotest \
utl \
))
$(eval $(call gb_CppunitTest_set_include,sc_functionlistobj,\

View file

@ -34,17 +34,17 @@ public:
void testHtmlSkipImage()
{
loadFromURL(u"BaseForHTMLExport.ods");
utl::TempFileNamed aTempFile = save("HTML (StarCalc)");
htmlDocUniquePtr pDoc = parseHtml(aTempFile);
save("HTML (StarCalc)");
htmlDocUniquePtr pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT (pDoc);
assertXPath(pDoc, "/html/body", 1);
assertXPath(pDoc, "/html/body/table/tr/td/img", 1);
setFilterOptions("SkipImages");
utl::TempFileNamed aTempFile2 = save("HTML (StarCalc)");
save("HTML (StarCalc)");
pDoc = parseHtml(aTempFile2);
pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT (pDoc);
assertXPath(pDoc, "/html/body", 1);
assertXPath(pDoc, "/html/body/table/tr/td/img", 0);

View file

@ -228,10 +228,10 @@ void ScMacrosTest::testMacroButtonFormControlXlsxExport()
loadFromURL(u"macro-button-form-control.xlsm");
// When exporting to XLSM:
utl::TempFileNamed tempFile = save("Calc MS Excel 2007 VBA XML");
save("Calc MS Excel 2007 VBA XML");
// Then make sure that the macro is associated with the control:
xmlDocUniquePtr pSheetDoc = parseExport(tempFile.GetURL(), "xl/worksheets/sheet1.xml");
xmlDocUniquePtr pSheetDoc = parseExport("xl/worksheets/sheet1.xml");
CPPUNIT_ASSERT(pSheetDoc);
// Without the fix in place, this test would have failed with:
// - XPath '//x:controlPr' no attribute 'macro' exist
@ -240,7 +240,7 @@ void ScMacrosTest::testMacroButtonFormControlXlsxExport()
// Then also make sure that there is no defined name for the macro, which is only needed for
// XLS:
xmlDocUniquePtr pWorkbookDoc = parseExport(tempFile.GetURL(), "xl/workbook.xml");
xmlDocUniquePtr pWorkbookDoc = parseExport("xl/workbook.xml");
CPPUNIT_ASSERT(pWorkbookDoc);
assertXPath(pWorkbookDoc, "//x:workbook/definedNames", 0);
}

View file

@ -167,8 +167,8 @@ void SparklineImportExportTest::testSparklinesExportODS()
loadFromURL(u"xlsx/Sparklines.xlsx");
// Save as ODS and check content.xml with XPath
utl::TempFileNamed tempFile = save("calc8");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
save("calc8");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// We have 3 sparkline groups = 3 tables that contain sparklines
assertXPath(pXmlDoc, "//table:table/calcext:sparkline-groups", 3);
@ -233,8 +233,8 @@ void SparklineImportExportTest::testNoSparklinesInDocumentXLSX()
// Load the document containing NO sparklines
loadFromURL(u"xlsx/empty.xlsx");
utl::TempFileNamed tempFile = save("Calc Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "xl/worksheets/sheet1.xml");
save("Calc Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport("xl/worksheets/sheet1.xml");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/x:worksheet", 1);

View file

@ -129,7 +129,7 @@ void ScJumboSheetsTest::testRoundtripColumnRangeOds()
CPPUNIT_ASSERT_EQUAL(OUString("=SUM(C:C)"), pDoc->GetFormula(1, 0, 0));
}
utl::TempFileNamed tempFile = saveAndReload("calc8");
saveAndReload("calc8");
{
ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
CPPUNIT_ASSERT(pModelObj);
@ -137,7 +137,7 @@ void ScJumboSheetsTest::testRoundtripColumnRangeOds()
ScDocument* pDoc = pModelObj->GetDocument();
CPPUNIT_ASSERT_EQUAL(OUString("=SUM(2:2)"), pDoc->GetFormula(0, 0, 0));
CPPUNIT_ASSERT_EQUAL(OUString("=SUM(C:C)"), pDoc->GetFormula(1, 0, 0));
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc,
"/office:document-content/office:body/office:spreadsheet/table:table/"
@ -153,7 +153,7 @@ void ScJumboSheetsTest::testRoundtripColumnRangeOds()
void ScJumboSheetsTest::testRoundtripColumnRangeXlsx()
{
loadFromURL(u"ods/sum-whole-column-row.ods");
utl::TempFileNamed tempFile = saveAndReload("Calc Office Open XML");
saveAndReload("Calc Office Open XML");
{
ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
CPPUNIT_ASSERT(pModelObj);
@ -161,7 +161,7 @@ void ScJumboSheetsTest::testRoundtripColumnRangeXlsx()
ScDocument* pDoc = pModelObj->GetDocument();
CPPUNIT_ASSERT_EQUAL(OUString("=SUM(2:2)"), pDoc->GetFormula(0, 0, 0));
CPPUNIT_ASSERT_EQUAL(OUString("=SUM(C:C)"), pDoc->GetFormula(1, 0, 0));
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "xl/worksheets/sheet1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("xl/worksheets/sheet1.xml");
CPPUNIT_ASSERT(pXmlDoc);
assertXPathContent(pXmlDoc, "/x:worksheet/x:sheetData/x:row[1]/x:c[1]/x:f", "SUM(2:2)");
assertXPathContent(pXmlDoc, "/x:worksheet/x:sheetData/x:row[1]/x:c[2]/x:f", "SUM(C:C)");

View file

@ -204,7 +204,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences)
insertStringToCell(*pModelObj, "D3", u"FISHY");
// Save the document
utl::TempFileNamed aTempFile = saveAndClose("calc8");
saveAndClose("calc8");
// Open a new document
mxComponent = loadFromDesktop("private:factory/scalc");
@ -216,8 +216,8 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences)
// Insert the references to the external document
{
// tdf#115162
OUString aFormula = "=SUMIFS('" + aTempFile.GetURL() + "'#$Sheet1.C1:C3,'"
+ aTempFile.GetURL() + "'#$Sheet1.B1:B3,1,'" + aTempFile.GetURL()
OUString aFormula = "=SUMIFS('" + maTempFile.GetURL() + "'#$Sheet1.C1:C3,'"
+ maTempFile.GetURL() + "'#$Sheet1.B1:B3,1,'" + maTempFile.GetURL()
+ "'#$Sheet1.A1:A3,2015)";
insertStringToCell(*pModelObj, "A1", aFormula);
@ -229,8 +229,8 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences)
{
// tdf#114820
OUString aFormula = "=VLOOKUP('" + aTempFile.GetURL() + "'#$Sheet1.A1;'"
+ aTempFile.GetURL() + "'#$Sheet1.A1:B3,2,0)";
OUString aFormula = "=VLOOKUP('" + maTempFile.GetURL() + "'#$Sheet1.A1;'"
+ maTempFile.GetURL() + "'#$Sheet1.A1:B3,2,0)";
insertStringToCell(*pModelObj, "A1", aFormula);
// Without the fix in place, this test would have failed with
@ -241,7 +241,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences)
{
// tdf#116149
OUString aFormula = "=VAR('" + aTempFile.GetURL() + "'#$Sheet1.C1;'" + aTempFile.GetURL()
OUString aFormula = "=VAR('" + maTempFile.GetURL() + "'#$Sheet1.C1;'" + maTempFile.GetURL()
+ "'#$Sheet1.C2)";
insertStringToCell(*pModelObj, "A1", aFormula);
@ -254,13 +254,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences)
{
// tdf#100847
// Use an empty cell
OUString aFormula = "=+'" + aTempFile.GetURL() + "'#$Sheet1.A1000";
OUString aFormula = "=+'" + maTempFile.GetURL() + "'#$Sheet1.A1000";
insertStringToCell(*pModelObj, "A1", aFormula);
aFormula = "=+'" + aTempFile.GetURL() + "'#$Sheet1.A1000*1";
aFormula = "=+'" + maTempFile.GetURL() + "'#$Sheet1.A1000*1";
insertStringToCell(*pModelObj, "B1", aFormula);
aFormula = "=+N('" + aTempFile.GetURL() + "'#$Sheet1.A1000)*1";
aFormula = "=+N('" + maTempFile.GetURL() + "'#$Sheet1.A1000)*1";
insertStringToCell(*pModelObj, "C1", aFormula);
CPPUNIT_ASSERT_EQUAL(OUString("0"), pDoc->GetString(ScAddress(0, 0, 0)));
@ -274,10 +274,10 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences)
{
//tdf#36387
OUString aAndFormula = "=AND('" + aTempFile.GetURL() + "'#$Sheet1.A1:C1)";
OUString aAndFormula = "=AND('" + maTempFile.GetURL() + "'#$Sheet1.A1:C1)";
insertStringToCell(*pModelObj, "A1", aAndFormula);
OUString aOrFormula = "=OR('" + aTempFile.GetURL() + "'#$Sheet1.A1:C1)";
OUString aOrFormula = "=OR('" + maTempFile.GetURL() + "'#$Sheet1.A1:C1)";
insertStringToCell(*pModelObj, "B1", aOrFormula);
// Without the fix in place, this test would have failed with
@ -289,7 +289,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences)
{
//tdf#113898
OUString aAndFormula = "=SUMPRODUCT(NOT(ISERROR(FIND(\"FISH\";'" + aTempFile.GetURL()
OUString aAndFormula = "=SUMPRODUCT(NOT(ISERROR(FIND(\"FISH\";'" + maTempFile.GetURL()
+ "'#$Sheet1.D1:D3))))";
insertStringToCell(*pModelObj, "A1", aAndFormula);
@ -310,7 +310,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf103994)
insertStringToCell(*pModelObj, "B1", u"2");
// Save the document
utl::TempFileNamed aTempFile = saveAndClose("calc8");
saveAndClose("calc8");
// Open a new document
mxComponent = loadFromDesktop("private:factory/scalc");
@ -320,7 +320,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf103994)
CPPUNIT_ASSERT(pDoc);
// Insert the reference to the external document
OUString aFormula = "='" + aTempFile.GetURL() + "'#$Sheet1.A1";
OUString aFormula = "='" + maTempFile.GetURL() + "'#$Sheet1.A1";
insertStringToCell(*pModelObj, "A1", aFormula);
CPPUNIT_ASSERT_EQUAL(aFormula, pDoc->GetFormula(0, 0, 0));
@ -352,7 +352,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf113541)
insertStringToCell(*pModelObj, "A1", u"50");
// Save the document
utl::TempFileNamed aTempFile = saveAndClose("calc8");
saveAndClose("calc8");
// Open a new document
mxComponent = loadFromDesktop("private:factory/scalc");
@ -365,7 +365,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf113541)
pDoc->SetGrammar(formula::FormulaGrammar::GRAM_ENGLISH_XL_A1);
// Insert the reference to the external document
OUString aFormula = "=['" + aTempFile.GetURL() + "']Sheet1!A1";
OUString aFormula = "=['" + maTempFile.GetURL() + "']Sheet1!A1";
insertStringToCell(*pModelObj, "A1", aFormula);
// Without the fix in place, this test would have failed with

View file

@ -79,10 +79,10 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeExport)
xMasterPage->setPropertyValue("Theme", aTheme);
// When exporting to PPTX:
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Then verify that this color is not lost:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/theme/theme1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/theme/theme1.xml");
assertXPath(pXmlDoc, "//a:clrScheme/a:lt1/a:srgbClr", "val", "000002");
// Without the fix in place, this test would have failed with:
// - Expected: 1
@ -97,10 +97,10 @@ CPPUNIT_TEST_FIXTURE(Test, testLoopingFromAnimation)
loadFromURL(u"video-loop.pptx");
// When exporting that to PPTX:
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Then make sure that the "infinite" repeat count is written:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// Without the fix in place, this test would have failed with:
// - Expected: 1
// - Actual : 0

View file

@ -23,8 +23,8 @@ public:
void testHTMLExport()
{
loadFromURL(u"HtmlExportTestDocument.odp");
utl::TempFileNamed aTempFile = save("impress_html_Export");
htmlDocUniquePtr htmlDoc = parseHtml(aTempFile);
save("impress_html_Export");
htmlDocUniquePtr htmlDoc = parseHtml(maTempFile);
assertXPath(htmlDoc, "/html", 1);
assertXPath(htmlDoc, "/html/body", 1);

View file

@ -48,11 +48,8 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105998)
uno::Reference<drawing::XGraphicExportFilter> xGraphicExporter
= drawing::GraphicExportFilter::create(xContext);
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aDescriptor{
comphelper::makePropertyValue("URL", aTempFile.GetURL()),
comphelper::makePropertyValue("URL", maTempFile.GetURL()),
comphelper::makePropertyValue("FilterName", OUString("PNG"))
};
@ -63,7 +60,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105998)
xGraphicExporter->setSourceDocument(xShape);
xGraphicExporter->filter(aDescriptor);
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
@ -112,11 +109,8 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319)
uno::Reference<drawing::XGraphicExportFilter> xGraphicExporter
= drawing::GraphicExportFilter::create(xContext);
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aDescriptor{
comphelper::makePropertyValue("URL", aTempFile.GetURL()),
comphelper::makePropertyValue("URL", maTempFile.GetURL()),
comphelper::makePropertyValue("FilterName", OUString("PNG"))
};
@ -127,7 +121,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319)
xGraphicExporter->setSourceDocument(xShape);
xGraphicExporter->filter(aDescriptor);
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
@ -185,11 +179,8 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf136632)
uno::Sequence<beans::PropertyValue> aFilterData{ comphelper::makePropertyValue("Translucent",
sal_Int32(0)) };
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aDescriptor{
comphelper::makePropertyValue("URL", aTempFile.GetURL()),
comphelper::makePropertyValue("URL", maTempFile.GetURL()),
comphelper::makePropertyValue("FilterName", OUString("PNG")),
comphelper::makePropertyValue("FilterData", aFilterData)
};
@ -201,7 +192,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf136632)
xGraphicExporter->setSourceDocument(xShape);
xGraphicExporter->filter(aDescriptor);
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
AlphaMask aAlpha = aBMPEx.GetAlpha();
@ -224,11 +215,8 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113163)
comphelper::makePropertyValue("PixelHeight", sal_Int32(100))
};
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aDescriptor{
comphelper::makePropertyValue("URL", aTempFile.GetURL()),
comphelper::makePropertyValue("URL", maTempFile.GetURL()),
comphelper::makePropertyValue("FilterName", OUString("PNG")),
comphelper::makePropertyValue("FilterData", aFilterData)
};
@ -239,7 +227,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113163)
xGraphicExporter->setSourceDocument(xPage);
xGraphicExporter->filter(aDescriptor);
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
@ -278,11 +266,8 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf147119)
comphelper::makePropertyValue("Translucent", sal_Int32(1)),
};
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aDescriptor{
comphelper::makePropertyValue("URL", aTempFile.GetURL()),
comphelper::makePropertyValue("URL", maTempFile.GetURL()),
comphelper::makePropertyValue("FilterName", OUString("PNG")),
comphelper::makePropertyValue("FilterData", aFilterData)
};
@ -293,7 +278,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf147119)
xGraphicExporter->setSourceDocument(xPage);
xGraphicExporter->filter(aDescriptor);
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
@ -329,11 +314,8 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113197)
comphelper::makePropertyValue("PixelHeight", sal_Int32(100)),
};
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aDescriptor{
comphelper::makePropertyValue("URL", aTempFile.GetURL()),
comphelper::makePropertyValue("URL", maTempFile.GetURL()),
comphelper::makePropertyValue("FilterName", OUString("PNG")),
comphelper::makePropertyValue("FilterData", aFilterData)
};
@ -344,7 +326,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113197)
xGraphicExporter->setSourceDocument(xPage);
xGraphicExporter->filter(aDescriptor);
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
@ -383,11 +365,8 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf93124)
comphelper::makePropertyValue("PixelHeight", sal_Int32(180))
};
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aDescriptor{
comphelper::makePropertyValue("URL", aTempFile.GetURL()),
comphelper::makePropertyValue("URL", maTempFile.GetURL()),
comphelper::makePropertyValue("FilterName", OUString("PNG")),
comphelper::makePropertyValue("FilterData", aFilterData)
};
@ -398,7 +377,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf93124)
xGraphicExporter->setSourceDocument(xPage);
xGraphicExporter->filter(aDescriptor);
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
@ -444,11 +423,8 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf99729)
comphelper::makePropertyValue("PixelHeight", sal_Int32(240))
};
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aDescriptor{
comphelper::makePropertyValue("URL", aTempFile.GetURL()),
comphelper::makePropertyValue("URL", maTempFile.GetURL()),
comphelper::makePropertyValue("FilterName", OUString("PNG")),
comphelper::makePropertyValue("FilterData", aFilterData)
};
@ -460,7 +436,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf99729)
xGraphicExporter->setSourceDocument(xPage);
xGraphicExporter->filter(aDescriptor);
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
Bitmap aBMP = aBMPEx.GetBitmap();

View file

@ -104,12 +104,12 @@ public:
void testSVGExportTextDecorations()
{
loadFromURL(u"svg-export-text-decorations.odp");
utl::TempFileNamed aTempFile = save("impress_svg_Export");
save("impress_svg_Export");
xmlDocUniquePtr svgDoc = parseXml(aTempFile);
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
CPPUNIT_ASSERT(svgDoc);
svgDoc->name = reinterpret_cast<char *>(xmlStrdup(reinterpret_cast<xmlChar const *>(OUStringToOString(aTempFile.GetURL(), RTL_TEXTENCODING_UTF8).getStr())));
svgDoc->name = reinterpret_cast<char *>(xmlStrdup(reinterpret_cast<xmlChar const *>(OUStringToOString(maTempFile.GetURL(), RTL_TEXTENCODING_UTF8).getStr())));
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG ), 1);
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2] ), "class", "SlideGroup");
@ -127,9 +127,9 @@ public:
void testSVGExportJavascriptURL()
{
loadFromURL(u"textbox-link-javascript.odp");
utl::TempFileNamed aTempFile = save("impress_svg_Export");
save("impress_svg_Export");
xmlDocUniquePtr svgDoc = parseXml(aTempFile);
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
CPPUNIT_ASSERT(svgDoc);
// There should be only one child (no link to javascript url)
@ -142,9 +142,9 @@ public:
void testSVGExportSlideCustomBackground()
{
loadFromURL(u"slide-custom-background.odp");
utl::TempFileNamed aTempFile = save("impress_svg_Export");
save("impress_svg_Export");
xmlDocUniquePtr svgDoc = parseXml(aTempFile);
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
CPPUNIT_ASSERT(svgDoc);
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_DEFS ), "class", "SlideBackground");
@ -153,9 +153,9 @@ public:
void testSVGExportTextFieldsInMasterPage()
{
loadFromURL(u"text-fields.odp");
utl::TempFileNamed aTempFile = save("impress_svg_Export");
save("impress_svg_Export");
xmlDocUniquePtr svgDoc = parseXml(aTempFile);
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
CPPUNIT_ASSERT(svgDoc);
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2] ), "class", "Master_Slide");
@ -181,9 +181,9 @@ public:
void testSVGExportEmbeddedVideo()
{
loadFromURL(u"slide-video-thumbnail.odp");
utl::TempFileNamed aTempFile = save("impress_svg_Export");
save("impress_svg_Export");
xmlDocUniquePtr svgDoc = parseXml(aTempFile);
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
CPPUNIT_ASSERT(svgDoc);
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG ), 1);
@ -212,9 +212,9 @@ public:
void testSVGExportSlideBitmapBackground()
{
loadFromURL(u"slide-bitmap-background.odp");
utl::TempFileNamed aTempFile = save("impress_svg_Export");
save("impress_svg_Export");
xmlDocUniquePtr svgDoc = parseXml(aTempFile);
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
CPPUNIT_ASSERT(svgDoc);
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9] ), "class", "BackgroundBitmaps");
@ -241,9 +241,9 @@ public:
void testSVGExportSlideTileBitmapBackground()
{
loadFromURL(u"slide-tile-background.odp");
utl::TempFileNamed aTempFile = save("impress_svg_Export");
save("impress_svg_Export");
xmlDocUniquePtr svgDoc = parseXml(aTempFile);
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
CPPUNIT_ASSERT(svgDoc);
// check the bitmap
@ -306,9 +306,9 @@ public:
Application::SetSettings(aSettings);
loadFromURL(u"text-fields.odp");
utl::TempFileNamed aTempFile = save("impress_svg_Export");
save("impress_svg_Export");
xmlDocUniquePtr svgDoc = parseXml(aTempFile);
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
CPPUNIT_ASSERT(svgDoc);
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2] ), "class", "Master_Slide");

View file

@ -213,19 +213,16 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testAnnotationsImportExport)
}
{ // save as PDF and check annotations
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
uno::Sequence<beans::PropertyValue> aFilterData(
comphelper::InitPropertySequence({ { "ExportBookmarks", uno::Any(true) } }));
aMediaDescriptor["FilterData"] <<= aFilterData;
xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
mxComponent->dispose();
SvFileStream aFile(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFile(maTempFile.GetURL(), StreamMode::READ);
SvMemoryStream aMemory;
aMemory.WriteStream(aFile);
@ -249,7 +246,7 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testAnnotationsImportExport)
pPDFAnnotation2->getSubType()); // Pop-up annotation
// Load document again
mxComponent = loadFromDesktop(aTempFile.GetURL());
mxComponent = loadFromDesktop(maTempFile.GetURL());
auto pNewImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
sd::ViewShell* pNewViewShell = pNewImpressDocument->GetDocShell()->GetViewShell();
CPPUNIT_ASSERT(pNewViewShell);

View file

@ -262,8 +262,8 @@ void ShapeImportExportTest::testTextDistancesOOXML_Export()
{
loadFromURL(u"TextDistancesInsets3.pptx");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
CPPUNIT_ASSERT(pXmlDoc);
//Check shape Top/Bottom - 0cm, 4cm
@ -374,8 +374,8 @@ void ShapeImportExportTest::testTextDistancesOOXML_Export()
void ShapeImportExportTest::testTextDistancesODP_OOXML_Export()
{
loadFromURL(u"odp/tdf150966_hugeInset.odp");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
CPPUNIT_ASSERT(pXmlDoc);
// The text ends 5cm below the top edge of the shape.

View file

@ -228,9 +228,9 @@ void checkFontAttributes(const SdrTextObj* pObj, ItemValue nVal, sal_uInt32 nId)
void SdOOXMLExportTest1::testTdf149311()
{
loadFromURL(u"odp/tdf149311.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pRelsDoc = parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pRelsDoc = parseExport("ppt/slides/_rels/slide1.xml.rels");
assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
"slide2.xml");
@ -239,9 +239,9 @@ void SdOOXMLExportTest1::testTdf149311()
void SdOOXMLExportTest1::testTdf149128()
{
loadFromURL(u"odp/tdf149128.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "id",
"42");
assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "idx",
@ -255,9 +255,9 @@ void SdOOXMLExportTest1::testTdf149128()
void SdOOXMLExportTest1::testTdf66228()
{
loadFromURL(u"odp/tdf66228.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:spPr/a:prstGeom", "prst",
"bentConnector3");
}
@ -265,9 +265,9 @@ void SdOOXMLExportTest1::testTdf66228()
void SdOOXMLExportTest1::testTdf147919()
{
loadFromURL(u"odp/tdf147919.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:cxnSp[1]/p:spPr/a:prstGeom", "prst",
"bentConnector2");
@ -334,22 +334,22 @@ void SdOOXMLExportTest1::testTdf147919()
void SdOOXMLExportTest1::testTdf130165()
{
loadFromURL(u"pptx/tdf146223.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "/p:sld", "showMasterSp", "0");
}
void SdOOXMLExportTest1::testTdf124781()
{
loadFromURL(u"odp/tdf124781.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:r[2]/a:rPr", "baseline",
"33000");
xmlDocUniquePtr pXmlDoc2 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc2 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc2, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:r[2]/a:rPr", "baseline",
"-8000");
}
@ -357,39 +357,39 @@ void SdOOXMLExportTest1::testTdf124781()
void SdOOXMLExportTest1::testTdf144914()
{
loadFromURL(u"pptx/tdf144616.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinkshowjump?jump=firstslide");
xmlDocUniquePtr pXmlDoc2 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc2 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc2, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinkshowjump?jump=lastslide");
xmlDocUniquePtr pXmlDoc3 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc3 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc3, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinkshowjump?jump=nextslide");
xmlDocUniquePtr pXmlDoc4 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc4 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc4, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinkshowjump?jump=previousslide");
xmlDocUniquePtr pXmlDoc5 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc5 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc5, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinksldjump");
xmlDocUniquePtr pRelsDoc5 = parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pRelsDoc5 = parseExport("ppt/slides/_rels/slide1.xml.rels");
assertXPath(pRelsDoc5, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
"slide2.xml");
xmlDocUniquePtr pXmlDoc6 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc6 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc6, "/p:sld/p:cSld/p:spTree/p:sp[6]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinkshowjump?jump=endshow");
xmlDocUniquePtr pXmlDoc7 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc7 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc7, "/p:sld/p:cSld/p:spTree/p:sp[7]/p:nvSpPr/p:cNvPr/a:hlinkClick", "id",
"rId2");
xmlDocUniquePtr pRelsDoc7 = parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pRelsDoc7 = parseExport("ppt/slides/_rels/slide1.xml.rels");
assertXPath(pRelsDoc7, "/rels:Relationships/rels:Relationship[@Id='rId2']", "Target",
"http://www.example.com/");
}
@ -397,39 +397,39 @@ void SdOOXMLExportTest1::testTdf144914()
void SdOOXMLExportTest1::testTdf124232()
{
loadFromURL(u"pptx/tdf141704.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinkshowjump?jump=lastslide");
xmlDocUniquePtr pXmlDoc2 = parseExport(tempFile.GetURL(), "ppt/slides/slide2.xml");
xmlDocUniquePtr pXmlDoc2 = parseExport("ppt/slides/slide2.xml");
assertXPath(pXmlDoc2, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinkshowjump?jump=nextslide");
xmlDocUniquePtr pXmlDoc3 = parseExport(tempFile.GetURL(), "ppt/slides/slide3.xml");
xmlDocUniquePtr pXmlDoc3 = parseExport("ppt/slides/slide3.xml");
assertXPath(pXmlDoc3, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinkshowjump?jump=previousslide");
xmlDocUniquePtr pXmlDoc4 = parseExport(tempFile.GetURL(), "ppt/slides/slide4.xml");
xmlDocUniquePtr pXmlDoc4 = parseExport("ppt/slides/slide4.xml");
assertXPath(pXmlDoc4, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "id",
"rId1");
xmlDocUniquePtr pRelsDoc4 = parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide4.xml.rels");
xmlDocUniquePtr pRelsDoc4 = parseExport("ppt/slides/_rels/slide4.xml.rels");
assertXPath(pRelsDoc4, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
"http://www.example.com/");
xmlDocUniquePtr pXmlDoc5 = parseExport(tempFile.GetURL(), "ppt/slides/slide5.xml");
xmlDocUniquePtr pXmlDoc5 = parseExport("ppt/slides/slide5.xml");
assertXPath(pXmlDoc5, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinksldjump");
xmlDocUniquePtr pRelsDoc5 = parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide5.xml.rels");
xmlDocUniquePtr pRelsDoc5 = parseExport("ppt/slides/_rels/slide5.xml.rels");
assertXPath(pRelsDoc5, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
"slide6.xml");
xmlDocUniquePtr pXmlDoc6 = parseExport(tempFile.GetURL(), "ppt/slides/slide6.xml");
xmlDocUniquePtr pXmlDoc6 = parseExport("ppt/slides/slide6.xml");
assertXPath(pXmlDoc6, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinkshowjump?jump=endshow");
xmlDocUniquePtr pXmlDoc7 = parseExport(tempFile.GetURL(), "ppt/slides/slide7.xml");
xmlDocUniquePtr pXmlDoc7 = parseExport("ppt/slides/slide7.xml");
assertXPath(pXmlDoc7, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
"ppaction://hlinkshowjump?jump=firstslide");
}
@ -437,9 +437,9 @@ void SdOOXMLExportTest1::testTdf124232()
void SdOOXMLExportTest1::testTdf143624()
{
loadFromURL(u"pptx/tdf143624.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/presProps.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/presProps.xml");
assertXPath(pXmlDoc, "/p:presentationPr/p:showPr", "useTimings", "0");
@ -457,9 +457,9 @@ void SdOOXMLExportTest1::testTdf142648()
uno::Reference<container::XNamed> xNamed(xDrawPage, uno::UNO_QUERY_THROW);
xNamed->setName("#Slide 1");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pRelsDoc = parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide2.xml.rels");
xmlDocUniquePtr pRelsDoc = parseExport("ppt/slides/_rels/slide2.xml.rels");
assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
"slide1.xml");
@ -468,9 +468,9 @@ void SdOOXMLExportTest1::testTdf142648()
void SdOOXMLExportTest1::testTdf47365()
{
loadFromURL(u"pptx/loopNoPause.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/presProps.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/presProps.xml");
assertXPath(pXmlDoc, "/p:presentationPr/p:showPr", "loop", "1");
@ -480,9 +480,9 @@ void SdOOXMLExportTest1::testTdf47365()
void SdOOXMLExportTest1::testTdf125071()
{
loadFromURL(u"pptx/tdf125071.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/presentation.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/presentation.xml");
assertXPath(pXmlDoc, "/p:presentation/p:custShowLst/p:custShow[1]", "name", "Custom1");
assertXPath(pXmlDoc, "/p:presentation/p:custShowLst/p:custShow[2]", "name", "Custom2");
@ -491,10 +491,10 @@ void SdOOXMLExportTest1::testTdf125071()
void SdOOXMLExportTest1::testTdf54037()
{
loadFromURL(u"pptx/tdf54037.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pRelsDoc = parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
xmlDocUniquePtr pRelsDoc = parseExport("ppt/slides/_rels/slide1.xml.rels");
assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:r/a:rPr/a:hlinkClick",
"action", "ppaction://hlinksldjump");
@ -1240,10 +1240,10 @@ void SdOOXMLExportTest1::testTdf112633()
{
// Load document and export it to a temporary file
loadFromURL(u"pptx/tdf112633.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pRelsDoc = parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
xmlDocUniquePtr pRelsDoc = parseExport("ppt/slides/_rels/slide1.xml.rels");
// Check image with artistic effect exists in the slide
assertXPath(pXmlDoc,
@ -1263,16 +1263,16 @@ void SdOOXMLExportTest1::testTdf112633()
// Check the .wdp file exists
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
tempFile.GetURL());
maTempFile.GetURL());
CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName("ppt/media/hdphoto1.wdp")));
}
void SdOOXMLExportTest1::testTdf128952()
{
loadFromURL(u"pptx/tdf128952.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:off", "x", "360");
assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:off", "y", "-360");
@ -1283,9 +1283,9 @@ void SdOOXMLExportTest1::testTdf128952()
void SdOOXMLExportTest1::testTdf127090()
{
loadFromURL(u"pptx/tdf127090.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr", "rot", "-5400000");
}
@ -1294,11 +1294,11 @@ void SdOOXMLExportTest1::testCustomXml()
{
// Load document and export it to a temporary file
loadFromURL(u"pptx/customxml.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "customXml/item1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("customXml/item1.xml");
CPPUNIT_ASSERT(pXmlDoc);
xmlDocUniquePtr pRelsDoc = parseExport(tempFile.GetURL(), "customXml/_rels/item1.xml.rels");
xmlDocUniquePtr pRelsDoc = parseExport("customXml/_rels/item1.xml.rels");
CPPUNIT_ASSERT(pRelsDoc);
// Check there is a relation to itemProps1.xml.
@ -1306,7 +1306,7 @@ void SdOOXMLExportTest1::testCustomXml()
assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
"itemProps1.xml");
std::unique_ptr<SvStream> pStream = parseExportStream(tempFile.GetURL(), "ddp/ddpfile.xen");
std::unique_ptr<SvStream> pStream = parseExportStream(maTempFile.GetURL(), "ddp/ddpfile.xen");
CPPUNIT_ASSERT(pStream);
}
@ -1314,7 +1314,7 @@ void SdOOXMLExportTest1::testTdf94238()
{
// Load document and export it to a temporary file.
loadFromURL(u"pptx/tdf94238.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY);
CPPUNIT_ASSERT(xDoc.is());
@ -1347,7 +1347,7 @@ void SdOOXMLExportTest1::testPictureTransparency()
{
// Load document and export it to a temporary file.
loadFromURL(u"odp/image_transparency.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY);
CPPUNIT_ASSERT(xDoc.is());
@ -1394,7 +1394,7 @@ void SdOOXMLExportTest1::testRoundtripOwnLineStyles()
}
// Save to pptx, reload and compare the LineDash values
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
uno::Reference<drawing::XDrawPagesSupplier> xDocpptx(mxComponent, uno::UNO_QUERY);
CPPUNIT_ASSERT(xDocpptx.is());
uno::Reference<drawing::XDrawPage> xPagepptx(xDocpptx->getDrawPages()->getByIndex(0),
@ -1421,12 +1421,12 @@ void SdOOXMLExportTest1::testRoundtripPrstDash()
{
// load and save document, compare prstDash values in saved document with original.
loadFromURL(u"pptx/presetDashDot.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
const OUString sOriginal[]
= { "dash", "dashDot", "dot", "lgDash", "lgDashDot",
"lgDashDotDot", "sysDash", "sysDashDot", "sysDashDotDot", "sysDot" };
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
const OString sStart = "/p:sld/p:cSld/p:spTree/p:sp[";
const OString sEnd = "]/p:spPr/a:ln/a:prstDash";
for (sal_uInt16 i = 0; i < 10; i++)
@ -1458,16 +1458,15 @@ void SdOOXMLExportTest1::testDashOnHairline()
{
// load and save document, make sure the custDash has 11 child elements.
loadFromURL(u"odp/tdf127267DashOnHairline.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:ln/a:custDash/a:ds", 11);
}
void SdOOXMLExportTest1::testNarrationNonMediaShape()
{
loadFromURL(u"pptx/narration-non-media-shape.pptx");
utl::TempFileNamed aTempFile;
// Without the accompanying fix in place, this test would have failed,
// beans::UnknownPropertyException was thrown.
saveAndReload("Impress Office Open XML");
@ -1476,9 +1475,9 @@ void SdOOXMLExportTest1::testNarrationNonMediaShape()
void SdOOXMLExportTest1::testCustomshapeBitmapfillSrcrect()
{
loadFromURL(u"pptx/customshape-bitmapfill-srcrect.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// tdf#132680
// We are preventing the side effect of DOCX improvement to PPTX case.
@ -1507,11 +1506,11 @@ void SdOOXMLExportTest1::testCustomshapeBitmapfillSrcrect()
void SdOOXMLExportTest1::testTdf100348FontworkBitmapFill()
{
loadFromURL(u"odp/tdf100348_FontworkBitmapFill.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Make sure the fontwork shape has a blip bitmap fill and a colored outline.
// Without the patch, fill and outline were black.
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr");
assertXPath(pXmlDoc, sPathStart + "/a:blipFill/a:blip", 1);
assertXPath(pXmlDoc, sPathStart + "/a:ln/a:solidFill/a:srgbClr", "val", "ffbf00");
@ -1520,11 +1519,11 @@ void SdOOXMLExportTest1::testTdf100348FontworkBitmapFill()
void SdOOXMLExportTest1::testTdf100348FontworkGradientGlow()
{
loadFromURL(u"odp/tdf100348_FontworkGradientGlow.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Make sure the fontwork shape has a gradient fill and a colored glow.
// Without the patch, fill was black and no glow applied.
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr");
assertXPath(pXmlDoc, sPathStart + "/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", "8d281e");
assertXPath(pXmlDoc, sPathStart + "/a:effectLst/a:glow", "rad", "63360");
@ -1534,20 +1533,20 @@ void SdOOXMLExportTest1::testTdf100348FontworkGradientGlow()
void SdOOXMLExportTest1::testTdf128345FullTransparentGradient()
{
loadFromURL(u"odp/tdf128345_FullTransparentGradient.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Make sure the shape has no fill. Without the patch, fill was solid red.
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:noFill");
}
void SdOOXMLExportTest1::testTdf128345GradientLinear()
{
loadFromURL(u"odp/tdf128345_GradientLinear.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Make sure the shape has a lin fill. Without the patch, fill was solid red.
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill");
assertXPath(pXmlDoc, sPathStart + "/a:lin", "ang", "3600000");
assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2);
@ -1562,11 +1561,11 @@ void SdOOXMLExportTest1::testTdf128345GradientLinear()
void SdOOXMLExportTest1::testTdf128345GradientRadial()
{
loadFromURL(u"odp/tdf128345_GradientRadial.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Make sure the shape has transparency. In OOXML alpha means 'opacity' with default
// 100000 for full opak, so only the full transparency with val 0 should be written.
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill");
assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2);
assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr", "val", "ff0000");
@ -1593,10 +1592,10 @@ void SdOOXMLExportTest1::testTdf128345GradientAxial()
void SdOOXMLExportTest1::testTdf134969TransparencyOnColorGradient()
{
loadFromURL(u"odp/tdf134969_TransparencyOnColorGradient.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Make sure the shape has a transparency in gradient stops.
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill");
assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2);
assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", "60000");
@ -1606,9 +1605,9 @@ void SdOOXMLExportTest1::testTdf134969TransparencyOnColorGradient()
void SdOOXMLExportTest1::testArcTo()
{
loadFromURL(u"pptx/arc-validiert.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
const OString sPath("//a:custGeom/a:pathLst/a:path/a:arcTo");
assertXPath(pXmlDoc, sPath, "wR", "3");
assertXPath(pXmlDoc, sPath, "hR", "3");
@ -1619,8 +1618,8 @@ void SdOOXMLExportTest1::testArcTo()
void SdOOXMLExportTest1::testNarrationMimeType()
{
loadFromURL(u"pptx/narration.pptx");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "[Content_Types].xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml");
// Without the accompanying fix in place, this test would have failed with:
// - Expected: audio/mp4
// - Actual : application/vnd.sun.star.media
@ -1630,10 +1629,10 @@ void SdOOXMLExportTest1::testNarrationMimeType()
"ContentType", "audio/mp4");
// Check if the bitmap of the media shape is exported correctly.
xmlDocUniquePtr pSlideDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pSlideDoc = parseExport("ppt/slides/slide1.xml");
OUString aImageId
= getXPath(pSlideDoc, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip", "embed");
xmlDocUniquePtr pRelsDoc = parseExport(aTempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pRelsDoc = parseExport("ppt/slides/_rels/slide1.xml.rels");
OUString aImagePath = "/rels:Relationships/rels:Relationship[@Id='" + aImageId + "']";
// Something like ../media/image2.png.
OUString aImageStreamName = getXPath(pRelsDoc, aImagePath.toUtf8(), "Target");
@ -1641,7 +1640,7 @@ void SdOOXMLExportTest1::testNarrationMimeType()
// Something like ppt/media/image2.png.
OUString aImageRelName;
CPPUNIT_ASSERT(aImageAbsName.startsWith("file:///", &aImageRelName));
std::unique_ptr<SvStream> pImageStream = parseExportStream(aTempFile.GetURL(), aImageRelName);
std::unique_ptr<SvStream> pImageStream = parseExportStream(maTempFile.GetURL(), aImageRelName);
vcl::PngImageReader aReader(*pImageStream);
BitmapEx aBitmapEx = aReader.read();
// Without the accompanying fix in place, this test would have failed with:
@ -1681,8 +1680,8 @@ void SdOOXMLExportTest1::testNarrationMimeType()
void SdOOXMLExportTest1::testTdf140865Wordart3D()
{
loadFromURL(u"pptx/tdf140865Wordart3D.pptx");
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// without the fix in place a:sp3d was lost on round trip, and so extrusion was lost.
constexpr OStringLiteral sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr");
@ -1699,9 +1698,9 @@ void SdOOXMLExportTest1::testTdf140865Wordart3D()
void SdOOXMLExportTest1::testTdf124457()
{
loadFromURL(u"pptx/tdf124457.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc,
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
@ -1717,9 +1716,9 @@ void SdOOXMLExportTest1::testTdf124457()
void SdOOXMLExportTest1::testTdf143126()
{
loadFromURL(u"pptx/tdf143126.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/presProps.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/presProps.xml");
assertXPath(pXmlDoc, "/p:presentationPr/p:showPr", "showNarration", "1");
assertXPath(pXmlDoc, "/p:presentationPr/p:showPr/p:sldRg", "st", "2");
@ -1729,9 +1728,9 @@ void SdOOXMLExportTest1::testTdf143126()
void SdOOXMLExportTest1::testTdf143129()
{
loadFromURL(u"pptx/tdf143129.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/presProps.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/presProps.xml");
assertXPath(pXmlDoc, "/p:presentationPr/p:showPr", "showNarration", "1");
assertXPath(pXmlDoc, "/p:presentationPr/p:showPr/p:custShow", "id", "0");
@ -1740,9 +1739,9 @@ void SdOOXMLExportTest1::testTdf143129()
void SdOOXMLExportTest1::testTdf118045()
{
loadFromURL(u"odp/tdf118045.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:lnSpc/a:spcPct", "val",
"110000");
}
@ -1750,9 +1749,9 @@ void SdOOXMLExportTest1::testTdf118045()
void SdOOXMLExportTest1::testTdf137675()
{
loadFromURL(u"pptx/tdf137675.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", "fill",
"none");
}

View file

@ -225,9 +225,9 @@ public:
void SdOOXMLExportTest2::testTdf151492()
{
loadFromURL(u"odp/tdf151492.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn",
"idx", "0");
}
@ -235,9 +235,9 @@ void SdOOXMLExportTest2::testTdf151492()
void SdOOXMLExportTest2::testTdf149697()
{
loadFromURL(u"pptx/tdf149697.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent,
"/p:sld/p:cSld/p:spTree/p:cxnSp[1]/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "idx", "5");
assertXPath(pXmlDocContent,
@ -253,9 +253,9 @@ void SdOOXMLExportTest2::testTdf149697()
void SdOOXMLExportTest2::testTdf149126()
{
loadFromURL(u"odp/tdf149126.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom", "prst",
"triangle");
}
@ -263,9 +263,9 @@ void SdOOXMLExportTest2::testTdf149126()
void SdOOXMLExportTest2::testTdf131905()
{
loadFromURL(u"pptx/tdf131905.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(
pXmlDocContent,
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr[1]/a:tc/a:tcPr",
@ -296,24 +296,23 @@ void SdOOXMLExportTest2::testBnc822341()
{
// Check import / export of embedded text document
loadFromURL(u"odp/bnc822341.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Export an LO specific ole object (imported from an ODP document)
{
xmlDocUniquePtr pXmlDocCT = parseExport(tempFile.GetURL(), "[Content_Types].xml");
xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml");
assertXPath(pXmlDocCT,
"/ContentType:Types/ContentType:Override[@ContentType='application/"
"vnd.openxmlformats-officedocument.wordprocessingml.document']",
"PartName", "/ppt/embeddings/oleObject1.docx");
xmlDocUniquePtr pXmlDocRels
= parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/_rels/slide1.xml.rels");
assertXPath(
pXmlDocRels,
"/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
"Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent,
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
"progId", "Word.Document.12");
@ -325,24 +324,23 @@ void SdOOXMLExportTest2::testBnc822341()
CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2, pObj->GetObjIdentifier());
}
utl::TempFileNamed tempFile2 = save("Impress Office Open XML");
save("Impress Office Open XML");
// Export an MS specific ole object (imported from a PPTX document)
{
xmlDocUniquePtr pXmlDocCT = parseExport(tempFile2.GetURL(), "[Content_Types].xml");
xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml");
assertXPath(pXmlDocCT,
"/ContentType:Types/ContentType:Override[@ContentType='application/"
"vnd.openxmlformats-officedocument.wordprocessingml.document']",
"PartName", "/ppt/embeddings/oleObject1.docx");
xmlDocUniquePtr pXmlDocRels
= parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/_rels/slide1.xml.rels");
assertXPath(
pXmlDocRels,
"/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
"Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent,
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
"progId", "Word.Document.12");
@ -359,11 +357,11 @@ void SdOOXMLExportTest2::testMathObject()
{
// Check import / export of math object
loadFromURL(u"odp/math.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Export an LO specific ole object (imported from an ODP document)
{
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
"Requires", "a14");
assertXPathContent(pXmlDocContent,
@ -377,11 +375,11 @@ void SdOOXMLExportTest2::testMathObject()
CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2, pObj->GetObjIdentifier());
}
utl::TempFileNamed tempFile2 = save("Impress Office Open XML");
save("Impress Office Open XML");
// Export an MS specific ole object (imported from a PPTX document)
{
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile2.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
"Requires", "a14");
assertXPathContent(pXmlDocContent,
@ -400,11 +398,11 @@ void SdOOXMLExportTest2::testMathObjectPPT2010()
{
// Check import / export of math object
loadFromURL(u"pptx/Math.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Export an MS specific ole object (imported from a PPTX document)
{
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
"Requires", "a14");
assertXPathContent(pXmlDocContent,
@ -763,9 +761,9 @@ void SdOOXMLExportTest2::testPresetShapesExport()
"val 3770",
};
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocCT = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocCT = parseExport("ppt/slides/slide1.xml");
const OString sPattern(
"/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]");
const OString sT("_T_");
@ -1009,16 +1007,16 @@ void SdOOXMLExportTest2::testTdf92076()
void SdOOXMLExportTest2::testTdf59046()
{
loadFromURL(u"odp/tdf59046.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocRels = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", 1);
}
void SdOOXMLExportTest2::testTdf133502()
{
loadFromURL(u"odp/tdf133502.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocRels = parseExport(tempFile.GetURL(), "ppt/comments/comment1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/comments/comment1.xml");
assertXPathContent(pXmlDocRels, "/p:cmLst/p:cm/p:text", "Test for creator-initials");
@ -1031,7 +1029,7 @@ void SdOOXMLExportTest2::testTdf105739()
{
// Gradient was lost during saving to ODP
loadFromURL(u"pptx/tdf105739.pptx");
utl::TempFileNamed tempFile = save("impress8");
save("impress8");
uno::Reference<drawing::XDrawPage> xPage = getPage(0);
uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY);
uno::Any aAny = xPropSet->getPropertyValue("Background");
@ -1082,10 +1080,10 @@ void SdOOXMLExportTest2::testPageBitmapWithTransparency()
void SdOOXMLExportTest2::testPptmContentType()
{
loadFromURL(u"pptm/macro.pptm");
utl::TempFileNamed tempFile = save("Impress MS PowerPoint 2007 XML VBA");
save("Impress MS PowerPoint 2007 XML VBA");
// Assert that the content type is the one of PPTM
xmlDocUniquePtr pXmlContentType = parseExport(tempFile.GetURL(), "[Content_Types].xml");
xmlDocUniquePtr pXmlContentType = parseExport("[Content_Types].xml");
assertXPath(pXmlContentType,
"/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']",
"ContentType", "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml");
@ -1094,8 +1092,8 @@ void SdOOXMLExportTest2::testPptmContentType()
void SdOOXMLExportTest2::testTdf111798()
{
loadFromURL(u"odp/tdf111798.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
const OUString data[][11] = { { "2700000", "2458080", "2414880", "1439640", "1440000", "gd[1]",
"adj1", "val 50000", "gd[2]", "adj2", "val 25000" },
@ -1130,11 +1128,11 @@ void SdOOXMLExportTest2::testTdf111798()
void SdOOXMLExportTest2::testPptmVBAStream()
{
loadFromURL(u"pptm/macro.pptm");
utl::TempFileNamed tempFile = save("Impress MS PowerPoint 2007 XML VBA");
save("Impress MS PowerPoint 2007 XML VBA");
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
tempFile.GetURL());
maTempFile.GetURL());
// This failed: VBA stream was not roundtripped
CPPUNIT_ASSERT(xNameAccess->hasByName("ppt/vbaProject.bin"));
}
@ -1142,10 +1140,10 @@ void SdOOXMLExportTest2::testPptmVBAStream()
void SdOOXMLExportTest2::testTdf111863()
{
loadFromURL(u"pptx/tdf111863.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// check that transition attribute didn't change from 'out' to 'in'
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent,
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
"p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animEffect",
@ -1155,9 +1153,9 @@ void SdOOXMLExportTest2::testTdf111863()
void SdOOXMLExportTest2::testTdf111518()
{
loadFromURL(u"pptx/tdf111518.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocRels = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
OUString sActual = getXPath(pXmlDocRels,
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
"p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
@ -1169,8 +1167,8 @@ void SdOOXMLExportTest2::testTdf111518()
void SdOOXMLExportTest2::testTdf100387()
{
loadFromURL(u"odp/tdf100387.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn",
"dur", "indefinite");
@ -1221,8 +1219,8 @@ void SdOOXMLExportTest2::testTdf100387()
void SdOOXMLExportTest2::testClosingShapesAndLineCaps()
{
loadFromURL(u"odp/closed-shapes.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent,
"/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo/a:pt",
1);
@ -1268,8 +1266,8 @@ void SdOOXMLExportTest2::testClosingShapesAndLineCaps()
void SdOOXMLExportTest2::testRotateFlip()
{
loadFromURL(u"odp/rotate_flip.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
const OUString data[][4] = { // flipH flipV x y
{ "0", "1", "1170000", "1035720" },
@ -1315,7 +1313,7 @@ void SdOOXMLExportTest2::testRotateFlip()
void SdOOXMLExportTest2::testTdf106867()
{
loadFromURL(u"pptx/tdf106867.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
const SdrPage* pPage = GetPage(1);
@ -1328,12 +1326,12 @@ void SdOOXMLExportTest2::testTdf106867()
// additional checks of the output file
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
tempFile.GetURL());
maTempFile.GetURL());
// check that the document contains the video stream
CPPUNIT_ASSERT(xNameAccess->hasByName("ppt/media/media1.avi"));
// both the ooxml and the extended markup
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile");
assertXPath(pXmlDocContent,
"/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/p:extLst/p:ext/p14:media");
@ -1349,10 +1347,10 @@ void SdOOXMLExportTest2::testTdf106867()
void SdOOXMLExportTest2::testTdf112280()
{
loadFromURL(u"pptx/tdf112280.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// check the animRot value
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent,
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
"p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animRot",
@ -1362,10 +1360,10 @@ void SdOOXMLExportTest2::testTdf112280()
void SdOOXMLExportTest2::testTdf112088()
{
loadFromURL(u"pptx/tdf112088.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// check gradient stops
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPathChildren(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:gradFill/a:gsLst",
2);
}
@ -1373,9 +1371,9 @@ void SdOOXMLExportTest2::testTdf112088()
void SdOOXMLExportTest2::testTdf112333()
{
loadFromURL(u"pptx/tdf112333.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
OUString sTo = getXPath(pXmlDocContent,
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
@ -1421,9 +1419,9 @@ void SdOOXMLExportTest2::testTdf112552()
{
// Background fill was not displayed, but it was because of the wrong geometry
loadFromURL(u"odp/tdf112552.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path",
"w", "21600");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path",
@ -1440,19 +1438,18 @@ void SdOOXMLExportTest2::testTdf112557()
{
// Subtitle shape should be skipped by export.
loadFromURL(u"odp/tdf112557.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent
= parseExport(tempFile.GetURL(), "ppt/slideMasters/slideMaster1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slideMasters/slideMaster1.xml");
assertXPath(pXmlDocContent, "/p:sldMaster/p:cSld/p:spTree/p:sp", 2); // title and object
}
void SdOOXMLExportTest2::testTdf128049()
{
loadFromURL(u"odp/tdf128049.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom", 0);
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:prstGeom", "prst",
"noSmoking");
@ -1465,10 +1462,9 @@ void SdOOXMLExportTest2::testTdf128049()
void SdOOXMLExportTest2::testTdf106026()
{
loadFromURL(u"odp/tdf106026.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlMasterContent
= parseExport(tempFile.GetURL(), "ppt/slideMasters/slideMaster1.xml");
xmlDocUniquePtr pXmlMasterContent = parseExport("ppt/slideMasters/slideMaster1.xml");
assertXPath(pXmlMasterContent,
"/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:pPr/a:spcBef/a:spcPts", "val",
"1417");
@ -1491,7 +1487,7 @@ void SdOOXMLExportTest2::testTdf106026()
"/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[7]/a:pPr/a:spcBef/a:spcPts", "val",
"283");
xmlDocUniquePtr pXmlSlideContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlSlideContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlSlideContent,
"/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr/a:spcAft/a:spcPts", "val",
"11339");
@ -1506,9 +1502,9 @@ void SdOOXMLExportTest2::testTdf106026()
void SdOOXMLExportTest2::testTdf112334()
{
loadFromURL(u"pptx/tdf112334.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
OUString sAttributeName = getXPathContent(
pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
@ -1520,9 +1516,9 @@ void SdOOXMLExportTest2::testTdf112334()
void SdOOXMLExportTest2::testTdf112089()
{
loadFromURL(u"pptx/tdf112089.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
OUString sID = getXPath(
pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id");
@ -1537,9 +1533,9 @@ void SdOOXMLExportTest2::testTdf112089()
void SdOOXMLExportTest2::testTdf112086()
{
loadFromURL(u"pptx/tdf112086.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
OUString sVal = getXPath(pXmlDocContent,
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
@ -1585,9 +1581,9 @@ void SdOOXMLExportTest2::testTdf112647()
void SdOOXMLExportTest2::testGroupRotation()
{
loadFromURL(u"odp/group_rotation.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:grpSpPr/a:xfrm",
"rot");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[1]/p:spPr/a:xfrm", "rot",
@ -1599,9 +1595,9 @@ void SdOOXMLExportTest2::testGroupRotation()
void SdOOXMLExportTest2::testTdf104788()
{
loadFromURL(u"pptx/tdf104788.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide6.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide6.xml");
OUString sVal = getXPath(pXmlDocContent,
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
@ -1629,9 +1625,9 @@ void SdOOXMLExportTest2::testSmartartRotation2()
uno::Sequence<beans::PropertyValue> aInteropGrabBag;
xShape->setPropertyValue("InteropGrabBag", uno::Any(aInteropGrabBag));
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPathContent(pXmlDocContent,
"/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:p/a:r/a:t", "Text");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:bodyPr", "rot",
@ -1649,9 +1645,9 @@ void SdOOXMLExportTest2::testSmartartRotation2()
void SdOOXMLExportTest2::testTdf91999_rotateShape()
{
loadFromURL(u"pptx/tdf91999_rotateShape.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:nvSpPr/p:cNvPr", "name",
"CustomShape 2");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm", "rot", "10800000");
@ -1666,9 +1662,9 @@ void SdOOXMLExportTest2::testTdf91999_rotateShape()
void SdOOXMLExportTest2::testTdf114845_rotateShape()
{
loadFromURL(u"pptx/tdf114845_rotateShape.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:nvCxnSpPr/p:cNvPr", "name",
"Straight Arrow Connector 9");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:xfrm", "flipV", "1");
@ -1685,9 +1681,9 @@ void SdOOXMLExportTest2::testTdf114845_rotateShape()
void SdOOXMLExportTest2::testGroupsPosition()
{
loadFromURL(u"pptx/group.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off",
"x", "5004000");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off",
@ -1701,9 +1697,9 @@ void SdOOXMLExportTest2::testGroupsPosition()
void SdOOXMLExportTest2::testGroupsRotatedPosition()
{
loadFromURL(u"pptx/group-rot.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "x",
"2857320");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "y",
@ -1713,18 +1709,18 @@ void SdOOXMLExportTest2::testGroupsRotatedPosition()
void SdOOXMLExportTest2::testAccentColor()
{
loadFromURL(u"pptx/accent-color.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val",
"accent6");
xmlDocUniquePtr pXmlDocContent2 = parseExport(tempFile.GetURL(), "ppt/slides/slide2.xml");
xmlDocUniquePtr pXmlDocContent2 = parseExport("ppt/slides/slide2.xml");
assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val",
"accent6");
xmlDocUniquePtr pXmlDocTheme1 = parseExport(tempFile.GetURL(), "ppt/theme/theme1.xml");
xmlDocUniquePtr pXmlDocTheme1 = parseExport("ppt/theme/theme1.xml");
assertXPath(pXmlDocTheme1, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val",
"70ad47");
xmlDocUniquePtr pXmlDocTheme2 = parseExport(tempFile.GetURL(), "ppt/theme/theme2.xml");
xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme2.xml");
assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val",
"deb340");
@ -1739,9 +1735,9 @@ void SdOOXMLExportTest2::testAccentColor()
void SdOOXMLExportTest2::testThemeColors()
{
loadFromURL(u"pptx/tdf84205.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocTheme2 = parseExport(tempFile.GetURL(), "ppt/theme/theme2.xml");
xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme2.xml");
assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
"44546a");
assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent3/a:srgbClr", "val",
@ -1751,9 +1747,9 @@ void SdOOXMLExportTest2::testThemeColors()
void SdOOXMLExportTest2::testTdf111785()
{
loadFromURL(u"odp/tdf111785.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocRels = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
// Without the fix in place, this test would have failed with
// - Expected: ed1c24
@ -1765,8 +1761,8 @@ void SdOOXMLExportTest2::testTdf111785()
void SdOOXMLExportTest2::testTdf118825()
{
loadFromURL(u"odp/tdf118825-motionpath.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
CPPUNIT_ASSERT_MOTIONPATH(
u"M 0.0449285714285714 0.00368253968253968 C 0.0575714285714285 -0.00095238095238096 "
@ -1825,7 +1821,7 @@ void SdOOXMLExportTest2::testTextColumns_tdf140852()
CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(1000)),
xColProps->getPropertyValue("AutomaticDistance"));
}
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
{
uno::Reference<drawing::XDrawPage> xPage(getPage(0));
@ -1844,7 +1840,7 @@ void SdOOXMLExportTest2::testTextColumns_tdf140852()
xColProps->getPropertyValue("AutomaticDistance"));
}
xmlDocUniquePtr pXmlDocRels = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "numCol", "1");
assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "spcCol",
"360000");
@ -1871,7 +1867,7 @@ void SdOOXMLExportTest2::testTextColumns_3columns()
CPPUNIT_ASSERT_LESS(sal_Int16(100), nScale);
}
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
{
uno::Reference<drawing::XDrawPage> xPage(getPage(0));
@ -1891,7 +1887,7 @@ void SdOOXMLExportTest2::testTextColumns_3columns()
CPPUNIT_ASSERT_LESS(sal_Int16(100), nScale);
}
xmlDocUniquePtr pXmlDocRels = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "numCol", "3");
assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "spcCol",
"108000");
@ -1901,7 +1897,7 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters()
{
loadFromURL(u"pptx/tdf59323.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xDoc->getDrawPages()->getCount());
@ -1916,13 +1912,12 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters()
}
// Test placeholder indexes
xmlDocUniquePtr pXmlDocMaster
= parseExport(tempFile.GetURL(), "ppt/slideMasters/slideMaster1.xml");
xmlDocUniquePtr pXmlDocMaster = parseExport("ppt/slideMasters/slideMaster1.xml");
assertXPath(pXmlDocMaster, "//p:ph [@type='dt']", "idx", "1");
assertXPath(pXmlDocMaster, "//p:ph [@type='ftr']", "idx", "2");
assertXPath(pXmlDocMaster, "//p:ph [@type='sldNum']", "idx", "3");
xmlDocUniquePtr pXmlDocSlide1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocSlide1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocSlide1, "//p:ph [@type='dt']", "idx", "1");
assertXPath(pXmlDocSlide1, "//p:ph [@type='ftr']", "idx", "2");
assertXPath(pXmlDocSlide1, "//p:ph [@type='sldNum']", "idx", "3");
@ -1951,10 +1946,9 @@ void SdOOXMLExportTest2::testTdf53970()
// Linked media file
{
loadFromURL(u"odp/tdf53970_linked.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlRels
= parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pXmlRels = parseExport("ppt/slides/_rels/slide1.xml.rels");
CPPUNIT_ASSERT(pXmlRels);
assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@TargetMode='External']", 2);

View file

@ -230,9 +230,9 @@ public:
void SdOOXMLExportTest3::testTdf129430()
{
loadFromURL(u"odp/tdf129430.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:pPr/a:lnSpc/a:spcPct",
"val", "100000");
}
@ -240,12 +240,12 @@ void SdOOXMLExportTest3::testTdf129430()
void SdOOXMLExportTest3::testTdf114848()
{
loadFromURL(u"pptx/tdf114848.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocTheme1 = parseExport(tempFile.GetURL(), "ppt/theme/theme1.xml");
xmlDocUniquePtr pXmlDocTheme1 = parseExport("ppt/theme/theme1.xml");
assertXPath(pXmlDocTheme1, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
"1f497d");
xmlDocUniquePtr pXmlDocTheme2 = parseExport(tempFile.GetURL(), "ppt/theme/theme2.xml");
xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme2.xml");
assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
"1f497d");
}
@ -253,9 +253,9 @@ void SdOOXMLExportTest3::testTdf114848()
void SdOOXMLExportTest3::testTdf147586()
{
loadFromURL(u"pptx/tdf147586.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
// Without the fix in place, this test would have failed with
// - Expected: 227fc7
// - Actual : 4f4f4f
@ -270,9 +270,9 @@ void SdOOXMLExportTest3::testTdf147586()
void SdOOXMLExportTest3::testTdf68759()
{
loadFromURL(u"odp/tdf68759.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "x",
"1687320");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "y",
@ -293,18 +293,18 @@ void SdOOXMLExportTest3::testTdf68759()
void SdOOXMLExportTest3::testTdf127901()
{
loadFromURL(u"odp/tdf127901.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "bright",
"70000");
assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "contrast",
"-70000");
xmlDocUniquePtr pXmlDocContent2 = parseExport(tempFile.GetURL(), "ppt/slides/slide2.xml");
xmlDocUniquePtr pXmlDocContent2 = parseExport("ppt/slides/slide2.xml");
assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:grayscl", 1);
xmlDocUniquePtr pXmlDocContent3 = parseExport(tempFile.GetURL(), "ppt/slides/slide3.xml");
xmlDocUniquePtr pXmlDocContent3 = parseExport("ppt/slides/slide3.xml");
assertXPath(pXmlDocContent3, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:biLevel",
"thresh", "50000");
}
@ -312,9 +312,9 @@ void SdOOXMLExportTest3::testTdf127901()
void SdOOXMLExportTest3::testTdf48735()
{
loadFromURL(u"odp/tdf48735.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:srcRect", "b", "23627");
assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:srcRect", "l", "23627");
assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:srcRect", "r", "23627");
@ -324,9 +324,9 @@ void SdOOXMLExportTest3::testTdf48735()
void SdOOXMLExportTest3::testTdf90626()
{
loadFromURL(u"odp/tdf90626.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr/a:buSzPct",
"val", "100000");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buSzPct",
@ -340,7 +340,7 @@ void SdOOXMLExportTest3::testTdf90626()
void SdOOXMLExportTest3::testTdf107608()
{
loadFromURL(u"pptx/tdf107608.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_SET_THROW);
@ -363,7 +363,7 @@ void SdOOXMLExportTest3::testTdf111786()
// Export line transparency with the color
loadFromURL(u"pptx/tdf111786.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_SET_THROW);
@ -380,8 +380,8 @@ void SdOOXMLExportTest3::testTdf111786()
void SdOOXMLExportTest3::testFontScale()
{
loadFromURL(u"pptx/font-scale.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
// Rounding errors possible, approximate value (+/- 1%)
OUString sScale = getXPath(
@ -392,8 +392,8 @@ void SdOOXMLExportTest3::testFontScale()
void SdOOXMLExportTest3::testShapeAutofitPPTX()
{
loadFromURL(u"pptx/testShapeAutofit.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
CPPUNIT_ASSERT(pXmlDocContent);
// TextAutoGrowHeight --> "Resize shape to fit text" --> true
@ -405,8 +405,8 @@ void SdOOXMLExportTest3::testShapeAutofitPPTX()
void SdOOXMLExportTest3::testLegacyShapeAutofitPPTX()
{
loadFromURL(u"odp/testLegacyShapeAutofit.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
CPPUNIT_ASSERT(pXmlDocContent);
// Text in a legacy rectangle
@ -420,7 +420,7 @@ void SdOOXMLExportTest3::testLegacyShapeAutofitPPTX()
void SdOOXMLExportTest3::testTdf115394()
{
loadFromURL(u"pptx/tdf115394.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
SdXImpressDocument* pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pXImpressDocument);
@ -456,7 +456,7 @@ void SdOOXMLExportTest3::testTdf115394()
void SdOOXMLExportTest3::testTdf115394Zero()
{
loadFromURL(u"pptx/tdf115394-zero.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
double fTransitionDuration;
SdXImpressDocument* pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
@ -470,11 +470,11 @@ void SdOOXMLExportTest3::testTdf115394Zero()
void SdOOXMLExportTest3::testTdf115005()
{
loadFromURL(u"odp/tdf115005.odp");
utl::TempFileNamed tempFile = save("impress8");
save("impress8");
// additional checks of the output file
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, tempFile.GetURL());
= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, maTempFile.GetURL());
// check that the document contains original vector images
const uno::Sequence<OUString> names = xNameAccess->getElementNames();
@ -503,11 +503,11 @@ int SdOOXMLExportTest3::testTdf115005_FallBack_Images(bool bAddReplacementImages
}
// save the file with already set options
utl::TempFileNamed tempFile = save("impress8");
save("impress8");
// additional checks of the output file
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, tempFile.GetURL());
= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, maTempFile.GetURL());
// check that the document contains original vector images
const uno::Sequence<OUString> names = xNameAccess->getElementNames();
@ -541,16 +541,16 @@ void SdOOXMLExportTest3::testTdf115005_FallBack_Images_Off()
void SdOOXMLExportTest3::testTdf118806()
{
loadFromURL(u"odp/tdf118806.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "//p:animMotion", "origin", "layout");
}
void SdOOXMLExportTest3::testTdf130058()
{
loadFromURL(u"pptx/tdf130058.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
bool bHasShadow = false;
@ -580,7 +580,7 @@ void SdOOXMLExportTest3::testTdf111789()
// Shadow properties were not exported for text shapes.
loadFromURL(u"pptx/tdf111789.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// First text shape has some shadow
{
@ -619,8 +619,8 @@ void SdOOXMLExportTest3::testTdf111789()
void SdOOXMLExportTest3::testTdf145162()
{
loadFromURL(u"pptx/tdf145162.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buNone");
// Before the fix, that tag was missing so PP put bullet to each para.
@ -631,11 +631,11 @@ void SdOOXMLExportTest3::testZeroIndentExport()
// Load the bugdoc and save to pptx then.
loadFromURL(u"odp/testZeroIndent.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// There are 3 slides, get them
xmlDocUniquePtr pSlide1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pSlide2 = parseExport(tempFile.GetURL(), "ppt/slides/slide2.xml");
xmlDocUniquePtr pSlide3 = parseExport(tempFile.GetURL(), "ppt/slides/slide3.xml");
xmlDocUniquePtr pSlide1 = parseExport("ppt/slides/slide1.xml");
xmlDocUniquePtr pSlide2 = parseExport("ppt/slides/slide2.xml");
xmlDocUniquePtr pSlide3 = parseExport("ppt/slides/slide3.xml");
CPPUNIT_ASSERT(pSlide1);
CPPUNIT_ASSERT(pSlide2);
@ -662,10 +662,10 @@ void SdOOXMLExportTest3::testZeroIndentExport()
void SdOOXMLExportTest3::testTdf100348_convert_Fontwork2TextWarp()
{
loadFromURL(u"odp/tdf100348_Fontwork2TextWarp.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Resulting pptx has to contain the TextWarp shape
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
const OString sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp");
assertXPath(pXmlDocContent, sPathStart + "[@prst='textWave1']");
const OString sPathAdj(sPathStart + "/a:avLst/a:gd");
@ -714,11 +714,11 @@ void SdOOXMLExportTest3::testTdf100348_convert_Fontwork2TextWarp()
void SdOOXMLExportTest3::testTdf1225573_FontWorkScaleX()
{
loadFromURL(u"pptx/tdf125573_FontWorkScaleX.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Error was, that attribute 'fromWordArt' was ignored
// ensure, resulting pptx has fromWordArt="1" on textArchDown shape
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent,
"/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr[@fromWordArt='1']");
@ -745,10 +745,10 @@ void SdOOXMLExportTest3::testTdf99497_keepAppearanceOfCircleKind()
// Adjustment values need to exist and their values need to correspond to the
// original angles. Shape 'arc' needs to be unfilled.
loadFromURL(u"odp/tdf99497_CircleKind.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// slide 1 45° -> adj1 = 20493903, 270° -> adj2 = 5400000, <a:noFill/> exists
xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
const OString sPathStart1("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
assertXPath(pXmlDocContent1, sPathStart1 + "[@prst='arc']");
const OString sPathAdj1(sPathStart1 + "/a:avLst/a:gd");
@ -757,7 +757,7 @@ void SdOOXMLExportTest3::testTdf99497_keepAppearanceOfCircleKind()
assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:noFill");
// slide 2 270° -> adj1 = 5400000, 180° -> adj2 = 10800000
xmlDocUniquePtr pXmlDocContent2 = parseExport(tempFile.GetURL(), "ppt/slides/slide2.xml");
xmlDocUniquePtr pXmlDocContent2 = parseExport("ppt/slides/slide2.xml");
const OString sPathStart2("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
assertXPath(pXmlDocContent2, sPathStart2 + "[@prst='chord']");
const OString sPathAdj2(sPathStart2 + "/a:avLst/a:gd");
@ -765,7 +765,7 @@ void SdOOXMLExportTest3::testTdf99497_keepAppearanceOfCircleKind()
assertXPath(pXmlDocContent2, sPathAdj2 + "[@name='adj2' and @fmla='val 10800000']");
// slide 3 120° -> adj1 = 12600000, 30° -> adj2 = 20946396
xmlDocUniquePtr pXmlDocContent3 = parseExport(tempFile.GetURL(), "ppt/slides/slide3.xml");
xmlDocUniquePtr pXmlDocContent3 = parseExport("ppt/slides/slide3.xml");
const OString sPathStart3("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
assertXPath(pXmlDocContent3, sPathStart3 + "[@prst='pie']");
const OString sPathAdj3(sPathStart3 + "/a:avLst/a:gd");
@ -776,9 +776,9 @@ void SdOOXMLExportTest3::testTdf99497_keepAppearanceOfCircleKind()
void SdOOXMLExportTest3::testTdf104792()
{
loadFromURL(u"pptx/tdf104792-smart-art-animation.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent,
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/"
"p:par[1]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/"
@ -789,9 +789,9 @@ void SdOOXMLExportTest3::testTdf104792()
void SdOOXMLExportTest3::testTdf90627()
{
loadFromURL(u"odp/tdf90627.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
// Don't export empty endCondLst without cond.
assertXPath(pXmlDocContent,
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/"
@ -803,9 +803,9 @@ void SdOOXMLExportTest3::testTdf90627()
void SdOOXMLExportTest3::testTdf104786()
{
loadFromURL(u"pptx/tdf104786.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide2.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide2.xml");
// Don't export empty 'to'
assertXPath(pXmlDocContent,
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/"
@ -817,9 +817,9 @@ void SdOOXMLExportTest3::testTdf104786()
void SdOOXMLExportTest3::testTdf118783()
{
loadFromURL(u"odp/tdf118783.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
OUString sAttributeName
= getXPathContent(pXmlDocContent, "//p:animRot/p:cBhvr/p:attrNameLst/p:attrName");
CPPUNIT_ASSERT_EQUAL(OUString("r"), sAttributeName);
@ -828,9 +828,9 @@ void SdOOXMLExportTest3::testTdf118783()
void SdOOXMLExportTest3::testTdf104789()
{
loadFromURL(u"pptx/tdf104789.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
OUString sAttributeName = getXPathContent(
pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
"p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
@ -845,7 +845,7 @@ void SdOOXMLExportTest3::testOpenDocumentAsReadOnly()
CPPUNIT_ASSERT(pXImpressDocument);
sd::DrawDocShell* pDocShell = pXImpressDocument->GetDocShell();
CPPUNIT_ASSERT(pDocShell->IsSecurityOptOpenReadOnly());
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pXImpressDocument);
pDocShell = pXImpressDocument->GetDocShell();
@ -855,9 +855,9 @@ void SdOOXMLExportTest3::testOpenDocumentAsReadOnly()
void SdOOXMLExportTest3::testTdf118835()
{
loadFromURL(u"odp/tdf118835.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "(//p:animClr)[1]", "clrSpc", "rgb");
assertXPathContent(pXmlDocContent, "(//p:animClr)[1]//p:attrName", "style.color");
assertXPath(pXmlDocContent, "(//p:animClr)[1]//p:to/a:srgbClr", "val", "ed1c24");
@ -880,9 +880,9 @@ void SdOOXMLExportTest3::testTdf118835()
void SdOOXMLExportTest3::testTdf118768()
{
loadFromURL(u"odp/tdf118768-brake.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "//p:anim[1]", "from", "(-#ppt_w/2)");
assertXPath(pXmlDocContent, "//p:anim[1]", "to", "(#ppt_x)");
assertXPath(pXmlDocContent, "//p:anim[2]", "from", "0");
@ -897,9 +897,9 @@ void SdOOXMLExportTest3::testTdf118768()
void SdOOXMLExportTest3::testTdf118836()
{
loadFromURL(u"odp/tdf118836.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "//p:animScale/p:by", "x", "250000");
assertXPath(pXmlDocContent, "//p:animScale/p:by", "y", "250000");
}
@ -986,9 +986,9 @@ void SdOOXMLExportTest3::testTdf116350TextEffects()
CPPUNIT_ASSERT_EQUAL(true, bScaleX);
// Export
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "//p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp", "prst", "textArchUp");
assertXPath(pXmlDocContent, "//p:sp[14]/p:txBody/a:bodyPr/a:prstTxWarp", "prst", "textCircle");
assertXPath(pXmlDocContent, "//p:sp[14]/p:spPr/a:solidFill/a:srgbClr", 0);
@ -997,15 +997,15 @@ void SdOOXMLExportTest3::testTdf116350TextEffects()
void SdOOXMLExportTest3::testTdf128096()
{
loadFromURL(u"odp/tdf128096.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent1,
"//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", "val",
"ffff00");
// Check that underlined content is also highlighted
xmlDocUniquePtr pXmlDocContent2 = parseExport(tempFile.GetURL(), "ppt/slides/slide2.xml");
xmlDocUniquePtr pXmlDocContent2 = parseExport("ppt/slides/slide2.xml");
assertXPath(pXmlDocContent2,
"//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", "val",
"ffff00");
@ -1013,19 +1013,18 @@ void SdOOXMLExportTest3::testTdf128096()
void SdOOXMLExportTest3::testTdf120573()
{
loadFromURL(u"pptx/tdf120573.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:audioFile", 1);
assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile", 0);
xmlDocUniquePtr pXmlDocRels
= parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/_rels/slide1.xml.rels");
assertXPath(pXmlDocRels,
"(/rels:Relationships/rels:Relationship[@Target='../media/media1.wav'])[1]", "Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
xmlDocUniquePtr pXmlContentType = parseExport(tempFile.GetURL(), "[Content_Types].xml");
xmlDocUniquePtr pXmlContentType = parseExport("[Content_Types].xml");
assertXPath(pXmlContentType,
"/ContentType:Types/ContentType:Override[@PartName='/ppt/media/media1.wav']",
"ContentType", "audio/x-wav");
@ -1034,8 +1033,8 @@ void SdOOXMLExportTest3::testTdf120573()
void SdOOXMLExportTest3::testTdf119118()
{
loadFromURL(u"pptx/tdf119118.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "//p:iterate", "type", "lt");
assertXPath(pXmlDocContent, "//p:tmAbs", "val", "200");
}
@ -1043,8 +1042,8 @@ void SdOOXMLExportTest3::testTdf119118()
void SdOOXMLExportTest3::testTdf99213()
{
loadFromURL(u"odp/tdf99213-target-missing.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
// Number of nodes with p:attrNameLst was 3, including one that missed tgtEl
assertXPath(pXmlDocContent, "//p:attrNameLst", 2);
// Timenode that miss its target element should be filtered.
@ -1057,10 +1056,10 @@ void SdOOXMLExportTest3::testPotxExport()
mxComponent = loadFromDesktop("private:factory/simpress");
// Export as a POTM template
utl::TempFileNamed tempFile = save("Impress Office Open XML Template");
save("Impress Office Open XML Template");
// Load and check content type
xmlDocUniquePtr pContentTypes = parseExport(tempFile.GetURL(), "[Content_Types].xml");
xmlDocUniquePtr pContentTypes = parseExport("[Content_Types].xml");
CPPUNIT_ASSERT(pContentTypes);
assertXPath(pContentTypes,
"/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']",
@ -1071,17 +1070,17 @@ void SdOOXMLExportTest3::testPotxExport()
void SdOOXMLExportTest3::testTdf44223()
{
loadFromURL(u"pptx/tdf44223.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
std::unique_ptr<SvStream> const pStream1(
parseExportStream(tempFile.GetURL(), "ppt/media/audio1.wav"));
parseExportStream(maTempFile.GetURL(), "ppt/media/audio1.wav"));
CPPUNIT_ASSERT_EQUAL(sal_uInt64(11140), pStream1->remainingSize());
std::unique_ptr<SvStream> const pStream2(
parseExportStream(tempFile.GetURL(), "ppt/media/audio2.wav"));
parseExportStream(maTempFile.GetURL(), "ppt/media/audio2.wav"));
CPPUNIT_ASSERT_EQUAL(sal_uInt64(28074), pStream2->remainingSize());
xmlDocUniquePtr pXmlContentType = parseExport(tempFile.GetURL(), "[Content_Types].xml");
xmlDocUniquePtr pXmlContentType = parseExport("[Content_Types].xml");
assertXPath(pXmlContentType,
"/ContentType:Types/ContentType:Override[@PartName='/ppt/media/audio1.wav']",
"ContentType", "audio/x-wav");
@ -1090,17 +1089,17 @@ void SdOOXMLExportTest3::testTdf44223()
"/ContentType:Types/ContentType:Override[@PartName='/ppt/media/audio2.wav']",
"ContentType", "audio/x-wav");
xmlDocUniquePtr pDoc1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pDoc1 = parseExport("ppt/slides/slide1.xml");
// Start condition: 0s after timenode id 5 begins.
assertXPath(pDoc1, "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "evt", "begin");
assertXPath(pDoc1, "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "delay", "0");
assertXPath(pDoc1, "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond/p:tn", "val", "5");
xmlDocUniquePtr pDoc2 = parseExport(tempFile.GetURL(), "ppt/slides/slide2.xml");
xmlDocUniquePtr pDoc2 = parseExport("ppt/slides/slide2.xml");
assertXPath(pDoc2, "//p:transition/p:sndAc/p:stSnd/p:snd[@r:embed]", 2);
xmlDocUniquePtr pRels1 = parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pRels1 = parseExport("ppt/slides/_rels/slide1.xml.rels");
assertXPath(pRels1, "//rels:Relationship[@Id='rId1']", "Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
assertXPath(pRels1, "//rels:Relationship[@Id='rId1']", "Target", "../media/audio1.wav");
@ -1109,9 +1108,9 @@ void SdOOXMLExportTest3::testTdf44223()
void SdOOXMLExportTest3::testTdf135843()
{
loadFromURL(u"pptx/tdf135843_export.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
const OString sPathStart("/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl");
assertXPath(pXmlDoc, sPathStart + "/a:tr[1]/a:tc[1]/a:tcPr/a:lnL/a:solidFill");
assertXPath(pXmlDoc, sPathStart + "/a:tr[1]/a:tc[1]/a:tcPr/a:lnR/a:solidFill");
@ -1132,9 +1131,9 @@ void SdOOXMLExportTest3::testTdf135843()
void SdOOXMLExportTest3::testSmartArtPreserve()
{
loadFromURL(u"pptx/smartart-preserve.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr");
assertXPath(pXmlDoc,
"//p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/dgm:relIds");
@ -1144,8 +1143,7 @@ void SdOOXMLExportTest3::testSmartArtPreserve()
assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/"
"p:extLst/p:ext/p14:modId");
xmlDocUniquePtr pXmlDocRels
= parseExport(tempFile.GetURL(), "ppt/slides/_rels/slide1.xml.rels");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/_rels/slide1.xml.rels");
assertXPath(
pXmlDocRels,
"(/rels:Relationships/rels:Relationship[@Target='../diagrams/layout1.xml'])[1]", "Type",
@ -1162,7 +1160,7 @@ void SdOOXMLExportTest3::testSmartArtPreserve()
"(/rels:Relationships/rels:Relationship[@Target='../diagrams/quickStyle1.xml'])[1]", "Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle");
xmlDocUniquePtr pXmlContentType = parseExport(tempFile.GetURL(), "[Content_Types].xml");
xmlDocUniquePtr pXmlContentType = parseExport("[Content_Types].xml");
assertXPath(pXmlContentType,
"/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/layout1.xml']",
"ContentType",
@ -1186,7 +1184,7 @@ void SdOOXMLExportTest3::testTdf125346()
// There are two themes in the test document, make sure we use the right theme
loadFromURL(u"pptx/tdf125346.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_SET_THROW);
@ -1206,7 +1204,7 @@ void SdOOXMLExportTest3::testTdf125346_2()
// Test more slides with different themes
loadFromURL(u"pptx/tdf125346_2.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
{
uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
@ -1259,7 +1257,7 @@ void SdOOXMLExportTest3::testTdf125360()
xShape->setPropertyValue("FillTransparence", uno::Any(static_cast<sal_Int32>(23)));
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xShape.set(getShapeFromPage(0, 0));
@ -1279,7 +1277,7 @@ void SdOOXMLExportTest3::testTdf125360_1()
xShape->setPropertyValue("FillTransparence", uno::Any(static_cast<sal_Int32>(23)));
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xShape.set(getShapeFromPage(0, 0));
@ -1303,7 +1301,7 @@ void SdOOXMLExportTest3::testTdf125360_2()
xShape->setPropertyValue("FillTransparence", uno::Any(static_cast<sal_Int32>(23)));
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xShape.set(getShapeFromPage(0, 0));
@ -1315,7 +1313,7 @@ void SdOOXMLExportTest3::testTdf125360_2()
void SdOOXMLExportTest3::testTdf125551()
{
loadFromURL(u"pptx/tdf125551.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
uno::Reference<drawing::XShapes> xGroupShape(getShapeFromPage(0, 0), uno::UNO_QUERY);
uno::Reference<drawing::XShape> xShapeBg(xGroupShape->getByIndex(0), uno::UNO_QUERY);
@ -1329,7 +1327,7 @@ void SdOOXMLExportTest3::testTdf125551()
void SdOOXMLExportTest3::testTdf136830()
{
loadFromURL(u"pptx/tdf136830.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Without the fix in place, the X position of the shapes would have been 0
uno::Reference<drawing::XShapes> xGroupShape(getShapeFromPage(0, 0), uno::UNO_QUERY);
@ -1350,7 +1348,7 @@ void SdOOXMLExportTest3::testTdf136830()
void SdOOXMLExportTest3::testTdf126234()
{
loadFromURL(u"pptx/tdf126234.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// check relative size of the bullet, 400% is a legitimate value for MS Office document
// Without a fix, it will fail to set the size correctly
@ -1366,7 +1364,7 @@ void SdOOXMLExportTest3::testTdf126234()
void SdOOXMLExportTest3::testTdf126741()
{
loadFromURL(u"pptx/tdf126741.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// dash dot dot line style import fix
// The original fixed values are replaced with the percent values, because
@ -1441,18 +1439,18 @@ void SdOOXMLExportTest3::testTdf98603()
void SdOOXMLExportTest3::testTdf128213()
{
loadFromURL(u"pptx/tdf128213.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm", "rot");
}
void SdOOXMLExportTest3::testTdf79082()
{
loadFromURL(u"pptx/tdf79082.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent,
"/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[1]", "pos",
"360000");
@ -1594,8 +1592,8 @@ void SdOOXMLExportTest3::testTdf132282()
void SdOOXMLExportTest3::testTdf132201EffectOrder()
{
loadFromURL(u"pptx/effectOrder.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
assertXPathChildren(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst", 2);
// The relative order of effects is important: glow must be before shadow
CPPUNIT_ASSERT_EQUAL(0, getXPathPosition(pXmlDocContent,
@ -1632,9 +1630,9 @@ void SdOOXMLExportTest3::testShapeShadowBlurEffect()
void SdOOXMLExportTest3::testTdf119223()
{
loadFromURL(u"odp/tdf119223.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocRels = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocRels, "//p:cNvPr[@name='SomeCustomShape']");
assertXPath(pXmlDocRels, "//p:cNvPr[@name='SomePicture']");
@ -1653,9 +1651,9 @@ void SdOOXMLExportTest3::testTdf119223()
void SdOOXMLExportTest3::testTdf128213ShapeRot()
{
loadFromURL(u"pptx/tdf128213-shaperot.pptx");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocRels = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:scene3d");
assertXPath(pXmlDocRels,
@ -1668,9 +1666,9 @@ void SdOOXMLExportTest3::testTdf125560_textDeflate()
loadFromURL(u"pptx/ShapePlusImage.pptx");
// This problem did not affect the pptx export, only the ODP so assert that
utl::TempFileNamed tempFile = save("impress8");
save("impress8");
xmlDocUniquePtr pXmlDocRels = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDocRels = parseExport("content.xml");
assertXPath(pXmlDocRels,
"/office:document-content/office:body/office:presentation/draw:page/"
"draw:custom-shape/draw:enhanced-geometry",
@ -1682,9 +1680,9 @@ void SdOOXMLExportTest3::testTdf125560_textInflateTop()
loadFromURL(u"pptx/ShapeTextInflateTop.pptx");
// This problem did not affect the pptx export, only the ODP so assert that
utl::TempFileNamed tempFile = save("impress8");
save("impress8");
xmlDocUniquePtr pXmlDocRels = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDocRels = parseExport("content.xml");
assertXPath(pXmlDocRels,
"/office:document-content/office:body/office:presentation/draw:page/"
"draw:custom-shape/draw:enhanced-geometry",
@ -1695,10 +1693,10 @@ void SdOOXMLExportTest3::testTdf142235_TestPlaceholderTextAlignment()
{
loadFromURL(u"odp/placeholder-box-textalignment.odp");
utl::TempFileNamed tmpfile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXml1 = parseExport(tmpfile.GetURL(), "ppt/slides/slide2.xml");
xmlDocUniquePtr pXml2 = parseExport(tmpfile.GetURL(), "ppt/slides/slide3.xml");
xmlDocUniquePtr pXml1 = parseExport("ppt/slides/slide2.xml");
xmlDocUniquePtr pXml2 = parseExport("ppt/slides/slide3.xml");
// Without the fix in place many of these asserts failed, because alignment was bad.
@ -1770,9 +1768,9 @@ void SdOOXMLExportTest3::testTdf143315()
{
loadFromURL(u"ppt/tdf143315-WordartWithoutBullet.ppt");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
xmlDocUniquePtr pXml = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXml = parseExport("ppt/slides/slide1.xml");
// Without the fix in place, this would have failed with
// - Expected:
@ -1801,10 +1799,10 @@ void SdOOXMLExportTest3::testTdf147121()
// Save the font size
const auto nFontSizeBefore = xRun->getPropertyValue("CharHeight").get<float>() * 100;
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Parse the export
xmlDocUniquePtr pXml = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXml = parseExport("ppt/slides/slide1.xml");
const auto nFontSizeAfter
= getXPath(pXml, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:br[1]/a:rPr", "sz").toFloat();
@ -1847,11 +1845,11 @@ void SdOOXMLExportTest3::testEnhancedPathViewBox()
void SdOOXMLExportTest3::testTdf74670()
{
loadFromURL(u"odp/tdf74670.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
tempFile.GetURL());
maTempFile.GetURL());
const uno::Sequence<OUString> aNames(xNameAccess->getElementNames());
int nImageFiles = 0;
for (const auto& rElementName : aNames)
@ -1953,8 +1951,8 @@ void SdOOXMLExportTest3::testTdf149551_tbrl90()
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL90, eWritingMode);
// Test, that it is exported to vert="vert"
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "//a:bodyPr", "vert", "vert");
// Test, that the shape has writing mode TB_RL90 after read from pptx
@ -1964,8 +1962,8 @@ void SdOOXMLExportTest3::testTdf149551_tbrl90()
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL90, eWritingMode2);
// Test, that it is written to odp with loext:writing-mode="tb-rl90"
utl::TempFileNamed aTempFile2 = save("impress8");
pXmlDoc = parseExport(aTempFile2.GetURL(), "content.xml");
save("impress8");
pXmlDoc = parseExport("content.xml");
assertXPath(
pXmlDoc,
"//style:style[@style:name='gr1']/style:graphic-properties[@loext:writing-mode='tb-rl90']");
@ -1985,8 +1983,8 @@ void SdOOXMLExportTest3::testTdf149551_btlr()
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, eWritingMode);
// Test, that it is exported to vert="vert270"
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "ppt/slides/slide1.xml");
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "//a:bodyPr", "vert", "vert270");
// Test, that the shape has writing mode BT_LR after read from pptx
@ -1996,8 +1994,8 @@ void SdOOXMLExportTest3::testTdf149551_btlr()
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, eWritingMode2);
// Test, that it is written to odp with loext:writing-mode="bt-lr"
utl::TempFileNamed aTempFile2 = save("impress8");
pXmlDoc = parseExport(aTempFile2.GetURL(), "content.xml");
save("impress8");
pXmlDoc = parseExport("content.xml");
assertXPath(
pXmlDoc,
"//style:style[@style:name='gr1']/style:graphic-properties[@loext:writing-mode='bt-lr']");
@ -2014,7 +2012,7 @@ void SdOOXMLExportTest3::testTdf94122_autoColor()
loadFromURL(u"odp/tdf94122_autocolor.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Without the accompanying fix in place, these tests would have failed with:
// - Expected: 1
@ -2022,17 +2020,17 @@ void SdOOXMLExportTest3::testTdf94122_autoColor()
// - In ..., XPath '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr' number of nodes is incorrect
// i.e. automatic color wasn't resolved & exported
xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent1,
"/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr", "val",
"000000");
xmlDocUniquePtr pXmlDocContent2 = parseExport(tempFile.GetURL(), "ppt/slides/slide2.xml");
xmlDocUniquePtr pXmlDocContent2 = parseExport("ppt/slides/slide2.xml");
assertXPath(pXmlDocContent2,
"/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr", "val",
"ffffff");
xmlDocUniquePtr pXmlDocContent3 = parseExport(tempFile.GetURL(), "ppt/slides/slide3.xml");
xmlDocUniquePtr pXmlDocContent3 = parseExport("ppt/slides/slide3.xml");
assertXPath(pXmlDocContent3,
"/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr",
"val", "ffffff");
@ -2062,7 +2060,7 @@ void SdOOXMLExportTest3::testAutofittedTextboxIndent()
{
loadFromURL(u"odp/autofitted-textbox-indent.odp");
utl::TempFileNamed tempFile = save("Impress Office Open XML");
save("Impress Office Open XML");
// Without the accompanying fix in place, these tests would have failed with:
// - Expected: 691200
@ -2070,7 +2068,7 @@ void SdOOXMLExportTest3::testAutofittedTextboxIndent()
// i.e. paragraph indent wasn't scaled proportionally to autofitted textbox
// font scale on export
xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile.GetURL(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:pPr", "marL",
"712800");
}

View file

@ -336,9 +336,9 @@ void SdExportTest::testMediaEmbedding()
void SdExportTest::testFillBitmapUnused()
{
loadFromURL(u"odp/fillbitmap2.odp");
utl::TempFileNamed aTempFile = save("impress8");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// shapes
assertXPath(
pXmlDoc,
@ -359,7 +359,7 @@ void SdExportTest::testFillBitmapUnused()
"//style:style[@style:family='graphic']/style:graphic-properties[@draw:fill='solid']",
"fill-color", "#808080");
xmlDocUniquePtr pStyles = parseExport(aTempFile.GetURL(), "styles.xml");
xmlDocUniquePtr pStyles = parseExport("styles.xml");
// master slide presentation style
assertXPath(pStyles,
"/office:document-styles/office:styles/style:style[@style:family='presentation' "
@ -451,7 +451,7 @@ void SdExportTest::testTdf97630()
CPPUNIT_ASSERT_EQUAL(drawing::TextFitToSizeType_ALLLINES, tmp);
}
utl::TempFileNamed aTempFile = saveAndReload("impress8");
saveAndReload("impress8");
{
uno::Reference<drawing::XDrawPage> xDP(getPage(0));
@ -480,7 +480,7 @@ void SdExportTest::testTdf97630()
CPPUNIT_ASSERT_EQUAL(drawing::TextFitToSizeType_PROPORTIONAL, tmp);
}
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// text shapes
assertXPath(pXmlDoc,
"//style:style[@style:family='presentation']/"
@ -586,11 +586,11 @@ void SdExportTest::testOOoXMLAnimations()
// FIXME: Error: unexpected attribute "presentation:preset-property"
skipValidation();
utl::TempFileNamed aTempFile = save("impress8");
save("impress8");
// the problem was that legacy OOoXML animations were lost if store
// immediately follows load because they were "converted" async by a timer
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "//anim:par[@presentation:node-type='timing-root']", 26);
// currently getting 52 of these without the fix (depends on timing)
assertXPath(pXmlDoc, "//anim:par", 223);
@ -656,9 +656,9 @@ void SdExportTest::testUnknownAttributes()
// FIXME: Error: unexpected attribute "foo:non-existent-att"
skipValidation();
utl::TempFileNamed aTempFile = save("impress8");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/"
"style:style[@style:name='gr1']/"
"style:graphic-properties[@foo:non-existent-att='bar']");
@ -791,8 +791,8 @@ void SdExportTest::testLinkedGraphicRT()
void SdExportTest::testTdf79082()
{
loadFromURL(u"ppt/tdf79082.ppt");
utl::TempFileNamed tempFile = save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// P1 should have 6 tab stops defined
assertXPathChildren(
@ -1010,9 +1010,9 @@ void SdExportTest::testDefaultSubscripts()
void SdExportTest::testTdf98477()
{
loadFromURL(u"pptx/tdf98477grow.pptx");
utl::TempFileNamed tempFile = save("impress8");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "//anim:animateTransform", "by", "0.5,0.5");
}
@ -1035,9 +1035,9 @@ void SdExportTest::testTdf50499()
{
loadFromURL(u"pptx/tdf50499.pptx");
utl::TempFileNamed tempFile = save("impress8");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "//anim:animate[1]", "from", "(-width/2)");
assertXPath(pXmlDoc, "//anim:animate[1]", "to", "(x)");
assertXPath(pXmlDoc, "//anim:animate[3]", "by", "(height/3+width*0.1)");
@ -1271,9 +1271,9 @@ void SdExportTest::testTdf113822()
// Was unable to export iterate container (tdf#99213).
saveAndReload("Impress Office Open XML");
// Was unable to import iterate container (tdf#113822).
utl::TempFileNamed tempFile = save("impress8");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// IterateContainer was created as ParallelTimeContainer before, so
// the iterate type is not set too.
@ -1289,9 +1289,9 @@ void SdExportTest::testTdf113818()
loadFromURL(u"pptx/tdf113818-swivel.pptx");
saveAndReload("MS PowerPoint 97");
saveAndReload("Impress Office Open XML");
utl::TempFileNamed tempFile = save("impress8");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "//anim:animate[1]", "formula", "width*sin(2.5*pi*$)");
assertXPath(pXmlDoc, "//anim:animate[1]", "values", "0;1");
}
@ -1300,9 +1300,9 @@ void SdExportTest::testTdf119629()
{
loadFromURL(u"ppt/tdf119629.ppt");
saveAndReload("MS PowerPoint 97");
utl::TempFileNamed tempFile = save("impress8");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// MSO's effect node type Click parallel node, with group node, after group node
// were missing.
@ -1347,8 +1347,8 @@ void SdExportTest::testTdf123557()
{
loadFromURL(u"pptx/trigger.pptx");
saveAndReload("Impress Office Open XML");
utl::TempFileNamed tempFile = save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Contains 2 interactive sequences and 3 triggered effects.
assertXPath(pXmlDoc, "//draw:page", 1);
@ -1388,7 +1388,7 @@ void SdExportTest::testTdf126761()
void SdExportTest::testGlow()
{
loadFromURL(u"odg/glow.odg");
utl::TempFileNamed tempFile = saveAndReload("draw8");
saveAndReload("draw8");
uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
// Check glow properties
@ -1403,7 +1403,7 @@ void SdExportTest::testGlow()
CPPUNIT_ASSERT_EQUAL(sal_Int16(60), nGlowEffectTransparency); // 60%
// Test ODF element
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// check that we actually test graphic style
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[2]",
@ -1426,7 +1426,7 @@ void SdExportTest::testGlow()
void SdExportTest::testSoftEdges()
{
loadFromURL(u"odg/softedges.odg");
utl::TempFileNamed tempFile = saveAndReload("draw8");
saveAndReload("draw8");
auto xShapeProps(getShapeFromPage(0, 0));
// Check property
@ -1435,7 +1435,7 @@ void SdExportTest::testSoftEdges()
CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRad); // 18 pt
// Test ODF element
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// check that we actually test graphic style
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[2]",
@ -1450,14 +1450,14 @@ void SdExportTest::testSoftEdges()
void SdExportTest::testShadowBlur()
{
loadFromURL(u"odg/shadow-blur.odg");
utl::TempFileNamed tempFile = saveAndReload("draw8");
saveAndReload("draw8");
uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
sal_Int32 nRad = 0;
CPPUNIT_ASSERT(xShape->getPropertyValue("ShadowBlur") >>= nRad);
CPPUNIT_ASSERT_EQUAL(sal_Int32(388), nRad); // 11 pt = 388 Hmm
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[3]",
"family", "graphic");
@ -1484,8 +1484,8 @@ void SdExportTest::testTdf91060()
void SdExportTest::testTdf128550()
{
loadFromURL(u"pptx/tdf128550.pptx");
utl::TempFileNamed tempFile = save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "//anim:iterate[@anim:sub-item='background']", 1);
assertXPath(pXmlDoc, "//anim:iterate[@anim:sub-item='text']", 4);
}
@ -1582,7 +1582,7 @@ void SdExportTest::testMasterPageBackgroundFullSize()
sal_Int16(0), xBackgroundProps->getPropertyValue("FillTransparence").get<sal_Int16>());
}
utl::TempFileNamed tempFile = saveAndReload("impress8");
saveAndReload("impress8");
xMPS.set(mxComponent, uno::UNO_QUERY);
xMPs.set(xMPS->getMasterPages());
@ -1657,7 +1657,7 @@ void SdExportTest::testMasterPageBackgroundFullSize()
sal_Int16(0), xBackgroundProps->getPropertyValue("FillTransparence").get<sal_Int16>());
}
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "styles.xml");
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
assertXPath(pXmlDoc,
"/office:document-styles/office:automatic-styles/"
"style:style[@style:family='drawing-page' and @style:name = "
@ -1714,7 +1714,7 @@ void SdExportTest::testColumnsODG()
CPPUNIT_ASSERT_EQUAL(sal_Int32(700), pTextObj->GetTextColumnsSpacing());
}
utl::TempFileNamed tempFile = saveAndReload("draw8");
saveAndReload("draw8");
{
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent,
@ -1738,7 +1738,7 @@ void SdExportTest::testColumnsODG()
CPPUNIT_ASSERT_EQUAL(sal_Int32(700), pTextObj->GetTextColumnsSpacing());
}
xmlDocUniquePtr pXmlDoc = parseExport(tempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc,
"/office:document-content/office:automatic-styles/style:style/"
"style:graphic-properties/style:columns",

View file

@ -473,10 +473,10 @@ void SdMiscTest::testTdf101242_ODF_add_settings()
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(true, pBatch);
pBatch->commit();
utl::TempFileNamed aTempFile = save("draw8");
save("draw8");
// Verify, that the saved document still has the ODF attributes
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc);
const OString sPathStart(
"/office:document-styles/office:master-styles/draw:layer-set/draw:layer");
@ -486,7 +486,7 @@ void SdMiscTest::testTdf101242_ODF_add_settings()
assertXPath(pXmlDoc, sPathStart + "[@draw:name='measurelines' and @draw:display='printer']");
// Verify, that the saved document has got the items in settings.xml
xmlDocUniquePtr pXmlDoc2 = parseExport(aTempFile.GetURL(), "settings.xml");
xmlDocUniquePtr pXmlDoc2 = parseExport("settings.xml");
CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2);
const OString sPathStart2("/office:document-settings/office:settings/"
"config:config-item-set[@config:name='ooo:view-settings']/"
@ -527,10 +527,10 @@ void SdMiscTest::testTdf101242_ODF_no_settings()
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(false, pBatch);
pBatch->commit();
utl::TempFileNamed aTempFile = save("draw8");
save("draw8");
// Verify, that the saved document still has the ODF attributes
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc);
const OString sPathStart(
"/office:document-styles/office:master-styles/draw:layer-set/draw:layer");
@ -540,7 +540,7 @@ void SdMiscTest::testTdf101242_ODF_no_settings()
assertXPath(pXmlDoc, sPathStart + "[@draw:name='measurelines' and @draw:display='printer']");
// Verify, that the saved document has no layer items in settings.xml
xmlDocUniquePtr pXmlDoc2 = parseExport(aTempFile.GetURL(), "settings.xml");
xmlDocUniquePtr pXmlDoc2 = parseExport("settings.xml");
CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2);
const OString sPathStart2("/office:document-settings/office:settings/"
"config:config-item-set[@config:name='ooo:view-settings']/"
@ -573,10 +573,10 @@ void SdMiscTest::testTdf101242_settings_keep()
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(true, pBatch);
pBatch->commit();
utl::TempFileNamed aTempFile = save("draw8");
save("draw8");
// Verify, that the saved document has the ODF attributes
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc);
const OString sPathStart(
"/office:document-styles/office:master-styles/draw:layer-set/draw:layer");
@ -586,7 +586,7 @@ void SdMiscTest::testTdf101242_settings_keep()
assertXPath(pXmlDoc, sPathStart + "[@draw:name='measurelines' and @draw:display='printer']");
// Verify, that the saved document still has the items in settings.xml
xmlDocUniquePtr pXmlDoc2 = parseExport(aTempFile.GetURL(), "settings.xml");
xmlDocUniquePtr pXmlDoc2 = parseExport("settings.xml");
CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2);
const OString sPathStart2("/office:document-settings/office:settings/"
"config:config-item-set[@config:name='ooo:view-settings']/"
@ -628,10 +628,10 @@ void SdMiscTest::testTdf101242_settings_remove()
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(false, pBatch);
pBatch->commit();
utl::TempFileNamed aTempFile = save("draw8");
save("draw8");
// Verify, that the saved document has the ODF attributes
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc);
const OString sPathStart(
"/office:document-styles/office:master-styles/draw:layer-set/draw:layer");
@ -641,7 +641,7 @@ void SdMiscTest::testTdf101242_settings_remove()
assertXPath(pXmlDoc, sPathStart + "[@draw:name='measurelines' and @draw:display='printer']");
// Verify, that the saved document has no layer items in settings.xml
xmlDocUniquePtr pXmlDoc2 = parseExport(aTempFile.GetURL(), "settings.xml");
xmlDocUniquePtr pXmlDoc2 = parseExport("settings.xml");
CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2);
const OString sPathStart2("/office:document-settings/office:settings/"
"config:config-item-set[@config:name='ooo:view-settings']/"
@ -682,10 +682,10 @@ void SdMiscTest::testTdf119392()
pPageView->SetLayerVisible("-P-", false);
pPageView->SetLayerPrintable("-P-", true);
pPageView->SetLayerLocked("-P-", false);
utl::TempFileNamed aTempFile = save("draw8");
save("draw8");
// Verify correct bit order in bitfield in the config items in settings.xml
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "settings.xml");
xmlDocUniquePtr pXmlDoc = parseExport("settings.xml");
CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc);
const OString sPathStart("/office:document-settings/office:settings/"
"config:config-item-set[@config:name='ooo:view-settings']/"
@ -784,8 +784,8 @@ void SdMiscTest::testTdf98839_ShearVFlipH()
pShape->Mirror(Point(4000, 2000), Point(4000, 10000));
// Save and examine attribute draw:transform
utl::TempFileNamed aTempFile = save("draw8");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
save("draw8");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
CPPUNIT_ASSERT_MESSAGE("Failed to get 'content.xml'", pXmlDoc);
const OString sPathStart("/office:document-content/office:body/office:drawing/draw:page");
assertXPath(pXmlDoc, sPathStart);

View file

@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sfx2_classification, \
cppuhelper \
test \
unotest \
utl \
vcl \
sal \
subsequenttest \

View file

@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sfx2_view, \
subsequenttest \
test \
unotest \
utl \
sfx \
svl \
))

View file

@ -72,18 +72,15 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testODFCustomMetadata)
uno::Sequence<beans::PropertyValue> mimeArgs({
beans::PropertyValue("MediaType", -1, uno::Any(OUString("application/vnd.oasis.opendocument.text")), beans::PropertyState_DIRECT_VALUE)
});
utl::TempFileNamed aTempFile;
xProps->storeToMedium(aTempFile.GetURL(), mimeArgs);
xProps->storeToMedium(maTempFile.GetURL(), mimeArgs);
// check that custom metadata is preserved
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "meta.xml");
xmlDocUniquePtr pXmlDoc = parseExport("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);
assertXPath(pXmlDoc, "/office:document-meta/office:meta/foo:bar/baz:foo[@baz:bar='foo']");
assertXPathContent(pXmlDoc, "/office:document-meta/office:meta/foo:bar/foo:baz", "bar");
aTempFile.EnableKillingFile();
}
CPPUNIT_TEST_FIXTURE(MiscTest, testNoThumbnail)
@ -97,21 +94,19 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testNoThumbnail)
#endif
uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
CPPUNIT_ASSERT(xStorable.is());
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aProperties(
comphelper::InitPropertySequence({ { "NoThumbnail", uno::Any(true) } }));
osl::File::remove(aTempFile.GetURL());
xStorable->storeToURL(aTempFile.GetURL(), aProperties);
osl::File::remove(maTempFile.GetURL());
xStorable->storeToURL(maTempFile.GetURL(), aProperties);
uno::Reference<packages::zip::XZipFileAccess2> xZipFile
= packages::zip::ZipFileAccess::createWithURL(m_xContext, aTempFile.GetURL());
= packages::zip::ZipFileAccess::createWithURL(m_xContext, maTempFile.GetURL());
CPPUNIT_ASSERT(!xZipFile->hasByName("Thumbnails/thumbnail.png"));
#ifndef _WIN32
// Check permissions of the URL after store.
osl::DirectoryItem aItem;
CPPUNIT_ASSERT_EQUAL(osl::DirectoryItem::E_None,
osl::DirectoryItem::get(aTempFile.GetURL(), aItem));
osl::DirectoryItem::get(maTempFile.GetURL(), aItem));
osl::FileStatus aStatus(osl_FileStatus_Mask_Attributes);
CPPUNIT_ASSERT_EQUAL(osl::DirectoryItem::E_None, aItem.getFileStatus(aStatus));
@ -122,7 +117,7 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testNoThumbnail)
CPPUNIT_ASSERT(aStatus.getAttributes() & osl_File_Attribute_OthRead);
// Now "save as" again to trigger the "overwrite" case.
xStorable->storeToURL(aTempFile.GetURL(), {});
xStorable->storeToURL(maTempFile.GetURL(), {});
CPPUNIT_ASSERT_EQUAL(osl::DirectoryItem::E_None, aItem.getFileStatus(aStatus));
// The following check used to fail in the past, result had temp file
// permissions.
@ -174,25 +169,23 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testHardLinks)
CPPUNIT_TEST_FIXTURE(MiscTest, testOverwrite)
{
// tdf#60237 - try to overwrite an existing file using the different settings of the Overwrite option
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
mxComponent
= loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
= loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument");
uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
CPPUNIT_ASSERT(xStorable.is());
// overwrite the file using the default case of the Overwrite option (true)
CPPUNIT_ASSERT_NO_THROW(xStorable->storeToURL(aTempFile.GetURL(), {}));
CPPUNIT_ASSERT_NO_THROW(xStorable->storeToURL(maTempFile.GetURL(), {}));
// explicitly overwrite the file using the Overwrite option
CPPUNIT_ASSERT_NO_THROW(xStorable->storeToURL(
aTempFile.GetURL(),
maTempFile.GetURL(),
comphelper::InitPropertySequence({ { "Overwrite", uno::Any(true) } })));
try
{
// overwrite an existing file with the Overwrite flag set to false
xStorable->storeToURL(aTempFile.GetURL(), comphelper::InitPropertySequence(
xStorable->storeToURL(maTempFile.GetURL(), comphelper::InitPropertySequence(
{ { "Overwrite", uno::Any(false) } }));
CPPUNIT_ASSERT_MESSAGE("We expect an exception on overwriting an existing file", false);
}

View file

@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svx_styles, \
subsequenttest \
test \
unotest \
utl \
))
$(eval $(call gb_CppunitTest_use_sdk_api,svx_styles))

View file

@ -43,16 +43,15 @@ CPPUNIT_TEST_FIXTURE(Test, testChartExportToPdf)
uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
// When exporting that chart to PDF:
utl::TempFileNamed aTempFile;
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "application/pdf",
aTempFile.GetURL());
maTempFile.GetURL());
// Then make sure we get a valid, non-empty PDF:
auto pPdfium = vcl::pdf::PDFiumLibrary::get();
if (!pPdfium)
return;
SvMemoryStream aMemory;
aMemory.WriteStream(*aTempFile.GetStream(StreamMode::READ));
aMemory.WriteStream(*maTempFile.GetStream(StreamMode::READ));
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= pPdfium->openDocument(aMemory.GetData(), aMemory.GetSize(), OString());
// Without the accompanying fix in place, this test would have failed, because the output was

View file

@ -162,14 +162,12 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_NonUI)
// Generate bitmap from shape
uno::Reference<drawing::XShape> xShape = getShape(0);
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", aTempFile.GetURL());
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", maTempFile.GetURL());
// Read bitmap and test color
// The expected values are taken from an image generated by Word
// Without the changed methods the colors were in range RGB(17,11,17) to RGB(87,55,89).
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
Bitmap aBMP = aBMPEx.GetBitmap();
@ -200,14 +198,12 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_FrontLightDim)
// Generate bitmap from shape
uno::Reference<drawing::XShape> xShape = getShape(0);
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", aTempFile.GetURL());
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", maTempFile.GetURL());
// Read bitmap and test color
// The expected values are taken from an image generated by Word
// Without the changed methods the nColorDistance was 476 and 173 respectively.
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
Bitmap aBMP = aBMPEx.GetBitmap();
@ -231,12 +227,10 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_FirstLightHarsh)
// Generate bitmap from shape
uno::Reference<drawing::XShape> xShape = getShape(0);
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", aTempFile.GetURL());
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", maTempFile.GetURL());
// Read bitmap and test color in center
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
Bitmap aBMP = aBMPEx.GetBitmap();
@ -1198,9 +1192,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf148501_OctagonBevel)
// Generate bitmap from shape
uno::Reference<drawing::XShape> xShape = getShape(0);
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", aTempFile.GetURL());
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", maTempFile.GetURL());
// Read bitmap and test color
// expected in order top-left, top, top-right, right, bottom-right:
@ -1208,7 +1200,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf148501_OctagonBevel)
// Without applied patch the colors were:
// RGB(193|214,236), RGB(193|214,236), RGB(80|111|145), RGB(23|32|41), RGB(193|214|236)
// So we test segments top, right and bottom-right.
SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
Bitmap aBMP = aBMPEx.GetBitmap();

View file

@ -494,10 +494,10 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testPageViewDrawLayerClip)
loadFromURL(u"page-view-draw-layer-clip.docx");
// When saving that document to PDF:
utl::TempFileNamed aTempFile = save("writer_pdf_Export");
save("writer_pdf_Export");
// Then make sure that line shape gets clipped:
SvFileStream aFile(aTempFile.GetURL(), StreamMode::READ);
SvFileStream aFile(maTempFile.GetURL(), StreamMode::READ);
SvMemoryStream aMemory;
aMemory.WriteStream(aFile);
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();

View file

@ -66,10 +66,8 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testWriterGraphicExport)
// picture.
xExportFilter->setSourceDocument(xShape);
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aProperties(
comphelper::InitPropertySequence({ { "URL", uno::Any(aTempFile.GetURL()) },
comphelper::InitPropertySequence({ { "URL", uno::Any(maTempFile.GetURL()) },
{ "MediaType", uno::Any(OUString("image/jpeg")) } }));
CPPUNIT_ASSERT(xExportFilter->filter(aProperties));
}

View file

@ -49,15 +49,13 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, testPdfGraphicExport)
GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, aStream));
// Export it.
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
XOutFlags const eFlags = XOutFlags::DontExpandFilename | XOutFlags::DontAddExtension
| XOutFlags::UseNativeIfPossible;
OUString aTempURL = aTempFile.GetURL();
OUString aTempURL = maTempFile.GetURL();
XOutBitmap::WriteGraphic(aGraphic, aTempURL, "pdf", eFlags);
// Assert that the output looks like a PDF.
SvStream* pStream = aTempFile.GetStream(StreamMode::READ);
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream->TellEnd() > 5);
sal_uInt8 sFirstBytes[5];
pStream->ReadBytes(sFirstBytes, 5);
@ -77,14 +75,12 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, testTdf60684)
GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, aStream));
// Export it.
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
XOutFlags const eFlags = XOutFlags::DontExpandFilename | XOutFlags::DontAddExtension
| XOutFlags::UseNativeIfPossible;
OUString aTempURL = aTempFile.GetURL();
OUString aTempURL = maTempFile.GetURL();
XOutBitmap::WriteGraphic(aGraphic, aTempURL, "png", eFlags);
SvStream* pStream = aTempFile.GetStream(StreamMode::READ);
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream->TellEnd() > 4);
sal_uInt8 sFirstBytes[4];
pStream->ReadBytes(sFirstBytes, 4);

View file

@ -26,6 +26,7 @@ UnoApiTest::UnoApiTest(OUString path)
: mbSkipValidation(false)
, m_aBaseString(std::move(path))
{
maTempFile.EnableKillingFile();
}
void UnoApiTest::setUp()
@ -81,63 +82,55 @@ uno::Any UnoApiTest::executeMacro(const OUString& rScriptURL,
return aRet;
}
utl::TempFileNamed UnoApiTest::save(const OUString& rFilter)
void UnoApiTest::save(const OUString& rFilter)
{
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
utl::MediaDescriptor aMediaDescriptor;
aMediaDescriptor["FilterName"] <<= rFilter;
if (!maFilterOptions.isEmpty())
aMediaDescriptor["FilterOptions"] <<= maFilterOptions;
css::uno::Reference<frame::XStorable> xStorable(mxComponent, css::uno::UNO_QUERY_THROW);
xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
if (!mbSkipValidation)
{
if (rFilter == "Office Open XML Text")
validate(aTempFile.GetFileName(), test::OOXML);
validate(maTempFile.GetFileName(), test::OOXML);
else if (rFilter == "Calc Office Open XML")
validate(aTempFile.GetFileName(), test::OOXML);
validate(maTempFile.GetFileName(), test::OOXML);
else if (rFilter == "Impress Office Open XML")
validate(aTempFile.GetFileName(), test::OOXML);
validate(maTempFile.GetFileName(), test::OOXML);
else if (rFilter == "writer8")
validate(aTempFile.GetFileName(), test::ODF);
validate(maTempFile.GetFileName(), test::ODF);
else if (rFilter == "calc8")
validate(aTempFile.GetFileName(), test::ODF);
validate(maTempFile.GetFileName(), test::ODF);
else if (rFilter == "impress8")
validate(aTempFile.GetFileName(), test::ODF);
validate(maTempFile.GetFileName(), test::ODF);
else if (rFilter == "draw8")
validate(aTempFile.GetFileName(), test::ODF);
validate(maTempFile.GetFileName(), test::ODF);
else if (rFilter == "OpenDocument Text Flat XML")
validate(aTempFile.GetFileName(), test::ODF);
validate(maTempFile.GetFileName(), test::ODF);
else if (rFilter == "MS Word 97")
validate(aTempFile.GetFileName(), test::MSBINARY);
validate(maTempFile.GetFileName(), test::MSBINARY);
else if (rFilter == "MS Excel 97")
validate(aTempFile.GetFileName(), test::MSBINARY);
validate(maTempFile.GetFileName(), test::MSBINARY);
else if (rFilter == "MS PowerPoint 97")
validate(aTempFile.GetFileName(), test::MSBINARY);
validate(maTempFile.GetFileName(), test::MSBINARY);
}
return aTempFile;
}
utl::TempFileNamed UnoApiTest::saveAndClose(const OUString& rFilter)
void UnoApiTest::saveAndClose(const OUString& rFilter)
{
utl::TempFileNamed aTempFile = save(rFilter);
save(rFilter);
mxComponent->dispose();
mxComponent.clear();
return aTempFile;
}
utl::TempFileNamed UnoApiTest::saveAndReload(const OUString& rFilter)
void UnoApiTest::saveAndReload(const OUString& rFilter)
{
utl::TempFileNamed aTempFile = saveAndClose(rFilter);
saveAndClose(rFilter);
mxComponent = loadFromDesktop(aTempFile.GetURL());
return aTempFile;
mxComponent = loadFromDesktop(maTempFile.GetURL());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -26,9 +26,9 @@ UnoApiXmlTest::UnoApiXmlTest(OUString path)
{
}
xmlDocUniquePtr UnoApiXmlTest::parseExport(OUString const& url, OUString const& rStreamName)
xmlDocUniquePtr UnoApiXmlTest::parseExport(OUString const& rStreamName)
{
std::unique_ptr<SvStream> const pStream(parseExportStream(url, rStreamName));
std::unique_ptr<SvStream> const pStream(parseExportStream(maTempFile.GetURL(), rStreamName));
xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
return pXmlDoc;
}

View file

@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,vcl_gen, \
test \
tl \
unotest \
utl \
vcl \
))

View file

@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerfilter_dmapper, \
subsequenttest \
test \
unotest \
utl \
vcl \
))

View file

@ -33,6 +33,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerfilter_rtftok, \
subsequenttest \
test \
unotest \
utl \
vcl \
))

View file

@ -89,8 +89,8 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle)
loadFromURL(u"tdf141301_Extrusion_Skew.odg");
// Prepare use of XPath
utl::TempFileNamed aTempFile = save("draw8");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
save("draw8");
xmlDocUniquePtr pXmlDoc = parseExport("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.
@ -115,10 +115,10 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport)
xMasterPage->setPropertyValue("Theme", aTheme);
// Export to ODP:
utl::TempFileNamed aTempFile = save("impress8");
save("impress8");
// Check if the 12 colors are written in the XML:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 12
// - Actual : 0
@ -154,9 +154,9 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot)
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1356), rCrop.Right);
// Execute ODP export:
utl::TempFileNamed aTempFile = save("impress8");
save("impress8");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Check that the preview was exported:
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
@ -195,10 +195,10 @@ 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");
save("impress8");
// Make sure the export result has the theme reference:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - XPath '//style:style[@style:name='T1']/style:text-properties' no attribute 'theme-color' exist
// i.e. only the direct color was written, but not the theme reference.
@ -305,16 +305,16 @@ 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::TempFileNamed aTempFile = save("writer8");
save("writer8");
// assert XML.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", "true");
assertXPath(pXmlDoc,
"//draw:enhanced-geometry[@loext:extrusion-metal-type='loext:MetalMSCompatible']");
// reload
mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
mxComponent = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument");
// verify properties
uno::Reference<drawing::XShape> xShapeReload(getShape(0));
lcl_assertMetalProperties("from ODF 1.3 extended", xShapeReload);
@ -328,10 +328,10 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict)
// added to ODF.
const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion());
SetODFDefaultVersion(SvtSaveOptions::ODFVER_013);
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// assert XML.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", "true");
assertXPath(pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-metal-type]", 0);
@ -366,16 +366,16 @@ 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");
save("writer8");
// assert XML.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='100%']");
assertXPath(pXmlDoc,
"//draw:enhanced-geometry[@loext:extrusion-specularity-loext='122.0703125%']");
// reload and verify, that the loext value is used
mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
mxComponent = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument");
// verify properties
uno::Reference<drawing::XShape> xShapeReload(getShape(0));
lcl_assertSpecularityProperty("from ODF 1.3 extended", xShapeReload);
@ -389,7 +389,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::TempFileNamed aTempFile = save("writer8");
save("writer8");
SetODFDefaultVersion(nCurrentODFVersion);
}

View file

@ -85,10 +85,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFontSorting)
mxComponent = loadFromDesktop("private:factory/swriter");
// When saving that document to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure <style:font-face> elements are sorted (by style:name="..."):
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
xmlXPathObjectPtr pXPath
= getXPathNode(pXmlDoc, "/office:document-content/office:font-face-decls/style:font-face");
xmlNodeSetPtr pXmlNodes = pXPath->nodesetval;
@ -181,10 +181,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR)
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch);
pBatch->commit();
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// With applied fix for tdf150407 still loext:writing-mode="bt-lr" has to be written.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
assertXPath(pXmlDoc,
"/office:document-styles/office:styles/style:style[@style:name='FrameBTLR']/"
"style:graphic-properties[@loext:writing-mode]");
@ -201,11 +201,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR)
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch);
pBatch->commit();
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Without the fix an faulty 'writing-mode="bt-lr"' attribute was written in productive build.
// A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey().
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
assertXPathNoAttribute(pXmlDoc,
"/office:document-styles/office:styles/"
"style:style[@style:name='FrameBTLR']/style:graphic-properties",
@ -234,11 +234,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin)
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch);
pBatch->commit();
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// With applied fix for tdf150407 still loext:vertical-rel="page-content-bottom" has to be
// written.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(
pXmlDoc,
"/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/"
@ -257,11 +257,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin)
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch);
pBatch->commit();
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Without the fix an faulty 'vertical-rel="page-content-bottom"' attribute was written in
// productive build. A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey().
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPathNoAttribute(pXmlDoc,
"/office:document-content/office:automatic-styles/"
"style:style[@style:name='gr1']/style:graphic-properties",
@ -290,11 +290,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin)
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch);
pBatch->commit();
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// With applied fix for tdf150407 still loext:vertical-rel="page-content-top has to be
// written.
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(
pXmlDoc,
"/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/"
@ -313,11 +313,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin)
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch);
pBatch->commit();
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Without the fix an faulty 'vertical-rel="page-content-top"' attribute was written in
// productive build. A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey().
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPathNoAttribute(pXmlDoc,
"/office:document-content/office:automatic-styles/"
"style:style[@style:name='gr1']/style:graphic-properties",

View file

@ -151,10 +151,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testParaStyleListLevel)
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), nNumberingLevel);
// Test the export as well:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure we save the style's numbering level:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
xmlDocUniquePtr pXmlDoc = parseExport("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.
@ -190,10 +190,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId)
loadFromURL(u"list-id.fodt");
// When storing that document as ODF:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure that unreferenced xml:id="..." attributes are not written:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this failed with:
// - XPath '//text:list' unexpected 'id' attribute
// i.e. xml:id="..." was written unconditionally, even when no other list needed it.
@ -217,10 +217,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakExport)
xText->insertTextContent(xCursor, xLineBreak, /*bAbsorb=*/false);
// When exporting to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure the expected markup is used:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this failed with:
// - XPath '//text:line-break' number of nodes is incorrect
// i.e. the clearing break was lost on export.
@ -285,9 +285,9 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRelativeWidth)
// Body frame width is 16cm.
xStyle->setPropertyValue("Width", uno::Any(static_cast<sal_Int32>(20000)));
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this failed with:
// - Expected: 3.1492in (8cm)
// - Actual : 0.0161in (0.04 cm)
@ -315,10 +315,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testScaleWidthAndHeight)
xText->insertTextContent(xCursor, xTextFrame, /*bAbsorb=*/false);
// When exporting to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure that we still export a non-zero size:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this failed with:
// - Expected: 0.7874in
// - Actual : 0in
@ -344,10 +344,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlExport)
xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
// When exporting to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure the expected markup is used:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this failed with:
// - XPath '//loext:content-control' number of nodes is incorrect
// i.e. the content control was lost on export.
@ -406,10 +406,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlExport)
xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
// When exporting to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure the expected markup is used:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
assertXPath(pXmlDoc, "//loext:content-control", "checkbox", "true");
assertXPath(pXmlDoc, "//loext:content-control", "checked", "true");
assertXPath(pXmlDoc, "//loext:content-control", "checked-state", u"");
@ -492,10 +492,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlExport)
xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
// When exporting to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure the expected markup is used:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this failed with:
// - Expected: 1
// - Actual : 0
@ -576,10 +576,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPictureContentControlExport)
xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
// When exporting to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure the expected markup is used:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - XPath '//loext:content-control' no attribute 'picture' exist
assertXPath(pXmlDoc, "//loext:content-control", "picture", "true");
@ -634,10 +634,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDateContentControlExport)
xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
// When exporting to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure the expected markup is used:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - XPath '//loext:content-control' no attribute 'date' exist
assertXPath(pXmlDoc, "//loext:content-control", "date", "true");
@ -700,10 +700,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPlainTextContentControlExport)
xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
// When exporting to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure the expected markup is used:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - XPath '//loext:content-control' no attribute 'plain-text' exist
// i.e. the plain text content control was turned into a rich text one on export.
@ -755,10 +755,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testComboBoxContentControlExport)
xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
// When exporting to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure the expected markup is used:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - XPath '//loext:content-control' no attribute 'combobox' exist
// i.e. the combo box content control was turned into a drop-down one on export.
@ -784,10 +784,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testAliasContentControlExport)
xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
// When exporting to ODT:
utl::TempFileNamed aTempFile = save("writer8");
save("writer8");
// Then make sure the expected markup is used:
xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - Expression: prop
// - XPath '//loext:content-control' no attribute 'alias' exist
@ -866,11 +866,9 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlAutostyleExport)
uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({
{ "FilterName", uno::Any(OUString("writer8")) },
});
utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
// Without the accompanying fix in place, this test would have failed, we had duplicated XML
// attributes.
xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
xStorable->storeToURL(maTempFile.GetURL(), aStoreProps);
}
CPPUNIT_PLUGIN_IMPLEMENT();