summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2022-04-15 15:04:16 +0200
committerAndras Timar <andras.timar@collabora.com>2022-04-19 13:23:15 +0200
commit9d0a4e213c6c6201f141316d1e7b76143729f6ce (patch)
tree774ca660af1ed6cf2e36823b767f51cbe6d71d1f /sd
parentb998b8dbb4894c33441051c06a47a27388cfc758 (diff)
tdf#109169 use custGeom for Octagon Bevel shape
The shapes 'Octagon Bevel', type col_60da8460, and 'Diamond Bevel', type col-502ad400, are LO specific preset shapes. They have neither a counterpart in MS binary nor in OOXML. So they need to be exported with custGeom. To force custGeom these shape types are moved from vDenylist to vAllowlist. These shapes were exported as prst='rect' before. Change-Id: I9619345812b6dba8f14ec2cc6a92ae808a56b595 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133069 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133113
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/odp/tdf109169_Diamond.odpbin0 -> 14664 bytes
-rw-r--r--sd/qa/unit/data/odp/tdf109169_Octagon.odpbin0 -> 13380 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml3.cxx46
3 files changed, 46 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/tdf109169_Diamond.odp b/sd/qa/unit/data/odp/tdf109169_Diamond.odp
new file mode 100644
index 000000000000..cd6a18d1b318
--- /dev/null
+++ b/sd/qa/unit/data/odp/tdf109169_Diamond.odp
Binary files differ
diff --git a/sd/qa/unit/data/odp/tdf109169_Octagon.odp b/sd/qa/unit/data/odp/tdf109169_Octagon.odp
new file mode 100644
index 000000000000..f35e746f3b28
--- /dev/null
+++ b/sd/qa/unit/data/odp/tdf109169_Octagon.odp
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx
index 40031977345d..96642cdc73ec 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -11,6 +11,7 @@
#include "sdmodeltestbase.hxx"
#include <comphelper/propertysequence.hxx>
#include <comphelper/sequence.hxx>
+#include <comphelper/sequenceashashmap.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/editobj.hxx>
#include <editeng/outlobj.hxx>
@@ -34,6 +35,7 @@
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/style/LineSpacing.hpp>
#include <com/sun/star/style/LineSpacingMode.hpp>
@@ -126,6 +128,8 @@ public:
void testTdf147121();
void testTdf140912_PicturePlaceholder();
void testEnhancedPathViewBox();
+ void testTdf109169_OctagonBevel();
+ void testTdf109169_DiamondBevel();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
@@ -202,6 +206,8 @@ public:
CPPUNIT_TEST(testTdf147121);
CPPUNIT_TEST(testTdf140912_PicturePlaceholder);
CPPUNIT_TEST(testEnhancedPathViewBox);
+ CPPUNIT_TEST(testTdf109169_OctagonBevel);
+ CPPUNIT_TEST(testTdf109169_DiamondBevel);
CPPUNIT_TEST_SUITE_END();
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -1912,6 +1918,46 @@ void SdOOXMLExportTest3::testEnhancedPathViewBox()
CPPUNIT_ASSERT_EQUAL(sal_Int32(2045), aBoundRectangle.Width);
}
+void SdOOXMLExportTest3::testTdf109169_OctagonBevel()
+{
+ // The document has a shape 'Octagon Bevel'. It consists of an octagon with 8 points and eight
+ // facets with 4 points each, total 8+8*4=40 points. Without the patch it was exported as
+ // rectangle and thus had 4 points.
+ ::sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf109169_Octagon.odp"), ODP);
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+
+ auto xPropSet(getShapeFromPage(0, 0, xDocShRef));
+ auto aGeomPropSeq = xPropSet->getPropertyValue("CustomShapeGeometry")
+ .get<uno::Sequence<beans::PropertyValue>>();
+ comphelper::SequenceAsHashMap aCustomShapeGeometry(aGeomPropSeq);
+ auto aPathSeq((aCustomShapeGeometry["Path"]).get<uno::Sequence<beans::PropertyValue>>());
+ comphelper::SequenceAsHashMap aPath(aPathSeq);
+ auto aCoordinates(
+ (aPath["Coordinates"]).get<uno::Sequence<drawing::EnhancedCustomShapeParameterPair>>());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(40), aCoordinates.getLength());
+}
+
+void SdOOXMLExportTest3::testTdf109169_DiamondBevel()
+{
+ // The document has a shape 'Diamond Bevel'. It consists of a diamond with 4 points and four
+ // facets with 4 points each, total 4+4*4=20 points. Without the patch it was exported as
+ // rectangle and thus had 4 points.
+ ::sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf109169_Diamond.odp"), ODP);
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+
+ auto xPropSet(getShapeFromPage(0, 0, xDocShRef));
+ auto aGeomPropSeq = xPropSet->getPropertyValue("CustomShapeGeometry")
+ .get<uno::Sequence<beans::PropertyValue>>();
+ comphelper::SequenceAsHashMap aCustomShapeGeometry(aGeomPropSeq);
+ auto aPathSeq((aCustomShapeGeometry["Path"]).get<uno::Sequence<beans::PropertyValue>>());
+ comphelper::SequenceAsHashMap aPath(aPathSeq);
+ auto aCoordinates(
+ (aPath["Coordinates"]).get<uno::Sequence<drawing::EnhancedCustomShapeParameterPair>>());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(20), aCoordinates.getLength());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3);
CPPUNIT_PLUGIN_IMPLEMENT();