diff options
author | Tibor Nagy <nagy.tibor2@nisz.hu> | 2022-06-03 15:32:50 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2022-06-23 16:02:58 +0200 |
commit | db39e5359d7f9b4e42c6101dd75bc5e8d809ad41 (patch) | |
tree | f70177f513027d5b24c5cab59d0fcc7945481b7c /sd | |
parent | 12fd3f7ba73d2fd03b88513160545fab8edc8a20 (diff) |
tdf#149126 fix export of PPTX preset shapes
Follow-up to commit 63cd67e5e18f01aca303131e148c80398a181a41
"tdf#92525 tdf#142398: fix export of simple custom shapes" and
commit 744e6c0b758fefe6011f09860b44f03ab70fbcfe
"tdf#147459 PPTX: add "glue points" to some basic shapes".
Thanks to Regina Henschel for the code pointer.
Change-Id: I378ffffc2ba09fcffcaa4e5dcf74bfd19e9f704d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135361
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/odp/tdf149126.odp | bin | 0 -> 11886 bytes | |||
-rw-r--r-- | sd/qa/unit/data/xml/tdf92001_0.xml | 32 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 59 |
3 files changed, 50 insertions, 41 deletions
diff --git a/sd/qa/unit/data/odp/tdf149126.odp b/sd/qa/unit/data/odp/tdf149126.odp Binary files differnew file mode 100644 index 000000000000..1d9c3c8c2318 --- /dev/null +++ b/sd/qa/unit/data/odp/tdf149126.odp diff --git a/sd/qa/unit/data/xml/tdf92001_0.xml b/sd/qa/unit/data/xml/tdf92001_0.xml index 1bacf2f2559c..08d9622583d3 100644 --- a/sd/qa/unit/data/xml/tdf92001_0.xml +++ b/sd/qa/unit/data/xml/tdf92001_0.xml @@ -15,7 +15,10 @@ </Transformation> <CustomShapeGeometry> <PropertyValue name="AdjustmentValues"> - <AdjustmentValues/> + <AdjustmentValues> + <EnhancedCustomShapeAdjustmentValue value="47433" propertyState="DIRECT_VALUE"/> + <EnhancedCustomShapeAdjustmentValue value="90654" propertyState="DIRECT_VALUE"/> + </AdjustmentValues> </PropertyValue> <PropertyValue name="Equations" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="Handles" handle="0" propertyState="DIRECT_VALUE"/> @@ -27,31 +30,31 @@ <Coordinates> <EnhancedCustomShapeParameterPair> <First value="0" type="0"/> - <Second value="5677" type="0"/> + <Second value="8" type="1"/> </EnhancedCustomShapeParameterPair> <EnhancedCustomShapeParameterPair> - <First value="8631" type="0"/> - <Second value="5677" type="0"/> + <First value="5" type="1"/> + <Second value="8" type="1"/> </EnhancedCustomShapeParameterPair> <EnhancedCustomShapeParameterPair> - <First value="8631" type="0"/> + <First value="5" type="1"/> <Second value="0" type="0"/> </EnhancedCustomShapeParameterPair> <EnhancedCustomShapeParameterPair> - <First value="21600" type="0"/> - <Second value="10800" type="0"/> + <First value="14" type="1"/> + <Second value="7" type="1"/> </EnhancedCustomShapeParameterPair> <EnhancedCustomShapeParameterPair> - <First value="8631" type="0"/> - <Second value="21600" type="0"/> + <First value="5" type="1"/> + <Second value="13" type="1"/> </EnhancedCustomShapeParameterPair> <EnhancedCustomShapeParameterPair> - <First value="8631" type="0"/> - <Second value="15923" type="0"/> + <First value="5" type="1"/> + <Second value="9" type="1"/> </EnhancedCustomShapeParameterPair> <EnhancedCustomShapeParameterPair> <First value="0" type="0"/> - <Second value="15923" type="0"/> + <Second value="9" type="1"/> </EnhancedCustomShapeParameterPair> </Coordinates> </PropertyValue> @@ -63,11 +66,12 @@ <EnhancedCustomShapeSegment command="5" count="0"/> </Segments> </PropertyValue> - <PropertyValue name="SubViewSize" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="TextFrames" handle="0" propertyState="DIRECT_VALUE"/> </Path> </PropertyValue> - <PropertyValue name="Type" value="ooxml-non-primitive" handle="0" propertyState="DIRECT_VALUE"/> + <PropertyValue name="TextCameraZRotateAngle" value="0" handle="0" propertyState="DIRECT_VALUE"/> + <PropertyValue name="TextPreRotateAngle" value="0" handle="0" propertyState="DIRECT_VALUE"/> + <PropertyValue name="Type" value="ooxml-rightArrow" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="ViewBox"> <ViewBox x="0" y="0" width="0" height="0"/> </PropertyValue> diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index b9c1f437c64c..0029f882463b 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -70,6 +70,7 @@ static void assertMotionPath(std::u16string_view rStr1, std::u16string_view rStr class SdOOXMLExportTest2 : public SdModelTestBaseXML { public: + void testTdf149126(); void testTdf131905(); void testTdf93883(); void testTdf91378(); @@ -137,6 +138,7 @@ public: CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); + CPPUNIT_TEST(testTdf149126); CPPUNIT_TEST(testTdf131905); CPPUNIT_TEST(testTdf93883); CPPUNIT_TEST(testTdf91378); @@ -210,6 +212,20 @@ public: } }; +void SdOOXMLExportTest2::testTdf149126() +{ + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149126.odp"), ODP); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom", "prst", + "triangle"); + + xDocShRef->DoClose(); +} + void SdOOXMLExportTest2::testTdf131905() { ::sd::DrawDocShellRef xDocShRef @@ -661,7 +677,7 @@ void SdOOXMLExportTest2::testPresetShapesExport() "donut", "adj","val 9601", "bevel", - "adj","val 42587", + "adj","val 42592", "foldedCorner", "adj","val 10750", "verticalScroll", @@ -692,9 +708,9 @@ void SdOOXMLExportTest2::testPresetShapesExport() "adj5","val -22375", "adj6","val -134550", "blockArc", - "adj1","val 13020000", - "adj2","val 19380000", - "adj3","val 3773", + "adj1","val 12975429", + "adj2","val 19424571", + "adj3","val 3770", }; utl::TempFile tempFile; @@ -720,9 +736,8 @@ void SdOOXMLExportTest2::testPresetShapesExport() void SdOOXMLExportTest2::testTdf92527() { - // We draw a diamond in an empty document. A newly created diamond shape does not have - // CustomShapeGeometry - Path - Segments property, and previously DrawingML exporter - // did not export custom shapes which did not have CustomShapeGeometry - Path - Segments property. + // We draw a diamond in an empty document. + // If custom shape has name and preset information in OOXML, should be export as preset shape. sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/empty.fodp"), FODG ); uno::Reference<css::lang::XMultiServiceFactory> xFactory(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape1(xFactory->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY); @@ -759,8 +774,8 @@ void SdOOXMLExportTest2::testTdf92527() aCoordinates = rProp.Value.get< uno::Sequence<drawing::EnhancedCustomShapeParameterPair> >(); } - // 5 coordinate pairs, 1 MoveTo, 4 LineTo - CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aCoordinates.getLength()); + // 4 coordinate pairs + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aCoordinates.getLength()); xDocShRef->DoClose(); } @@ -1050,27 +1065,17 @@ void SdOOXMLExportTest2::testTdf111798() xDocShRef->DoClose(); xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); - const OUString data[][26] = + const OUString data[][11] = { { "2700000", "2458080", "2414880", "1439640", "1440000", - "moveTo", "0", "5400", - "lnTo[1]", "16200", "5400", - "lnTo[2]", "16200", "0", - "lnTo[3]", "21600", "10800", - "lnTo[4]", "16200", "21600", - "lnTo[5]", "16200", "16200", - "lnTo[6]", "0", "16200" + "gd[1]", "adj1", "val 50000", + "gd[2]", "adj2", "val 25000" }, { "2700000", "6778080", "2414880", "1439640", "1440000", - "moveTo", "5400", "0", - "lnTo[1]", "5400", "16200", - "lnTo[2]", "0", "16200", - "lnTo[3]", "10800", "21600", - "lnTo[4]", "21600", "16200", - "lnTo[5]", "16200", "16200", - "lnTo[6]", "16200", "0" + "gd[1]", "adj1", "val 50000", + "gd[2]", "adj2", "val 25006" } }; @@ -1090,9 +1095,9 @@ void SdOOXMLExportTest2::testTdf111798() while (nDataIndex < SAL_N_ELEMENTS(data[nShapeIndex])) { - const OString sPt = sSpPr + "/a:custGeom/a:pathLst/a:path/a:" + data[nShapeIndex][nDataIndex++].toUtf8() + "/a:pt"; - assertXPath(pXmlDoc, sPt, "x", data[nShapeIndex][nDataIndex++]); - assertXPath(pXmlDoc, sPt, "y", data[nShapeIndex][nDataIndex++]); + const OString sGd = sSpPr + "/a:prstGeom/a:avLst/a:" + data[nShapeIndex][nDataIndex++].toUtf8() + ""; + assertXPath(pXmlDoc, sGd, "name", data[nShapeIndex][nDataIndex++]); + assertXPath(pXmlDoc, sGd, "fmla", data[nShapeIndex][nDataIndex++]); } } } |