summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2015-11-20 23:49:12 +0100
committerAndras Timar <andras.timar@collabora.com>2015-11-21 08:01:54 +0000
commitaa94dd9a5b5db3c51d5de1b5a3e9c8d9e7a22b5c (patch)
treeff0efbac082d8891b6898ce8808c36d4830fdf69 /sd/qa
parent01de2fc790b50c04f13907026f1a7782009fea61 (diff)
tdf#92527 unit test
Change-Id: I05eb8e99d919eea267df174e948cec29bdf04e75 Reviewed-on: https://gerrit.libreoffice.org/20100 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/data/empty.fodp2
-rw-r--r--sd/qa/unit/export-tests.cxx52
2 files changed, 54 insertions, 0 deletions
diff --git a/sd/qa/unit/data/empty.fodp b/sd/qa/unit/data/empty.fodp
new file mode 100644
index 000000000000..3c2a4cf2cda5
--- /dev/null
+++ b/sd/qa/unit/data/empty.fodp
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.presentation"><office:body><office:presentation><draw:page/></office:presentation></office:body></office:document>
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index eba8d7b2620e..32175f4d5efe 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -10,6 +10,7 @@
#include "sdmodeltestbase.hxx"
#include "Outliner.hxx"
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
#include <svl/stritem.hxx>
#include <editeng/editobj.hxx>
#include <editeng/outlobj.hxx>
@@ -61,6 +62,7 @@
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
@@ -139,6 +141,7 @@ public:
void testBnc822341();
#endif
void testTdf80224();
+ void testTdf92527();
CPPUNIT_TEST_SUITE(SdExportTest);
CPPUNIT_TEST(testFdo90607);
@@ -181,6 +184,7 @@ public:
CPPUNIT_TEST(testTdf80224);
CPPUNIT_TEST(testExportTransitionsPPTX);
+ CPPUNIT_TEST(testTdf92527);
CPPUNIT_TEST_SUITE_END();
};
@@ -1282,6 +1286,54 @@ void SdExportTest::testExportTransitionsPPTX()
CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 74, TransitionType::ZOOM, TransitionSubType::ROTATEIN));
}
+void SdExportTest::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.
+ sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/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);
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc1(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xPage1(xDoc1->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+ xPage1->add(xShape1);
+ xShape1->setSize(awt::Size(10000, 10000));
+ xShape1->setPosition(awt::Point(1000, 1000));
+ uno::Sequence<beans::PropertyValue> aShapeGeometry(comphelper::InitPropertySequence(
+ {
+ {"Type", uno::makeAny(OUString("diamond"))},
+ }));
+ uno::Reference<beans::XPropertySet> xPropertySet1(xShape1, uno::UNO_QUERY);
+ xPropertySet1->setPropertyValue("CustomShapeGeometry", uno::makeAny(aShapeGeometry));
+
+ xDocShRef = saveAndReload(xDocShRef, PPTX);
+
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc2(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xPage2(xDoc2->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XShape> xShape2(xPage2->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropertySet2( xShape2, uno::UNO_QUERY_THROW );
+ uno::Sequence<beans::PropertyValue> aProps;
+ xPropertySet2->getPropertyValue("CustomShapeGeometry") >>= aProps;
+ uno::Sequence<beans::PropertyValue> aPathProps;
+ for (int i = 0; i < aProps.getLength(); ++i)
+ {
+ const beans::PropertyValue& rProp = aProps[i];
+ if (rProp.Name == "Path")
+ aPathProps = rProp.Value.get< uno::Sequence<beans::PropertyValue> >();
+ }
+ uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates;
+ for (int i = 0; i < aPathProps.getLength(); ++i)
+ {
+ const beans::PropertyValue& rProp = aPathProps[i];
+ if (rProp.Name == "Coordinates")
+ aCoordinates = rProp.Value.get< uno::Sequence<drawing::EnhancedCustomShapeParameterPair> >();
+ }
+
+ // 5 coordinate pairs, 1 MoveTo, 4 LineTo
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aCoordinates.getLength());
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();