From 60c5955cb9f75a066cde0be3a3e39de83845279b Mon Sep 17 00:00:00 2001 From: Paul Trojahn Date: Fri, 25 Aug 2017 14:22:35 +0200 Subject: PPTX export tests for flipped shapes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib159cdde381ebe906b54070245dedcb6decbe44e Reviewed-on: https://gerrit.libreoffice.org/41587 Tested-by: Jenkins Reviewed-by: Tamás Zolnai --- sd/qa/unit/data/odp/rotate_flip.odp | Bin 0 -> 12254 bytes sd/qa/unit/export-tests-ooxml2.cxx | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 sd/qa/unit/data/odp/rotate_flip.odp diff --git a/sd/qa/unit/data/odp/rotate_flip.odp b/sd/qa/unit/data/odp/rotate_flip.odp new file mode 100644 index 000000000000..675b3fb85077 Binary files /dev/null and b/sd/qa/unit/data/odp/rotate_flip.odp differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 66d2bf5ae645..7f1bff9a7639 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -103,6 +103,7 @@ public: void testPptmVBAStream(); void testTdf111518(); void testTdf100387(); + void testRotateFlip(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -133,6 +134,7 @@ public: CPPUNIT_TEST(testPptmVBAStream); CPPUNIT_TEST(testTdf111518); CPPUNIT_TEST(testTdf100387); + CPPUNIT_TEST(testRotateFlip); CPPUNIT_TEST_SUITE_END(); @@ -944,6 +946,51 @@ void SdOOXMLExportTest2::testTdf100387() "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "end", "2"); } +void SdOOXMLExportTest2::testRotateFlip() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/rotate_flip.odp"), ODP); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + xDocShRef->DoClose(); + xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + + const OUString data[][4] = + {// flipH flipV x y + { "0", "1", "1170000", "1035720" }, + { "1", "1", "7108560", "1036440" }, + { "1", "0", "4140000", "1036440" } + }; + + const OUString points[][2] = { {"221", "293"}, {"506", "12" }, {"367", "0" }, {"29", "406"}, {"431", "347"}, {"145", "645"}, + {"99", "520"}, {"0", "861"}, {"326", "765"}, {"209", "711"}, {"640", "233"}, {"640", "233"} }; + + for (size_t nShapeIndex = 0; nShapeIndex < SAL_N_ELEMENTS(data); nShapeIndex++) + { + size_t nDataIndex = 0; + + const OString sSpPr = "/p:sld/p:cSld/p:spTree/p:sp[" + OString::number(nShapeIndex + 1) + "]/p:spPr"; + const OString sXfrm = sSpPr + "/a:xfrm"; + if(data[nShapeIndex][nDataIndex++] == "1") + assertXPath(pXmlDocContent, sXfrm, "flipH", "1"); + if(data[nShapeIndex][nDataIndex++] == "1") + assertXPath(pXmlDocContent, sXfrm, "flipV", "1"); + assertXPath(pXmlDocContent, sXfrm, "rot", "20400000"); + const OString sOff = sXfrm + "/a:off"; + assertXPath(pXmlDocContent, sOff, "x", data[nShapeIndex][nDataIndex++]); + assertXPath(pXmlDocContent, sOff, "y", data[nShapeIndex][nDataIndex++]); + const OString sExt = sXfrm + "/a:ext"; + assertXPath(pXmlDocContent, sExt, "cx", "1800000"); + assertXPath(pXmlDocContent, sExt, "cy", "3600000"); + + for (size_t nPointIndex = 0; nPointIndex < SAL_N_ELEMENTS(points); nPointIndex++) + { + const OString sPt = sSpPr + "/a:custGeom/a:pathLst/a:path/a:lnTo[" + OString::number(nPointIndex + 1) + "]/a:pt"; + assertXPath(pXmlDocContent, sPt, "x", points[nPointIndex][0]); + assertXPath(pXmlDocContent, sPt, "y", points[nPointIndex][1]); + } + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit