[Libreoffice-commits] core.git: sd/qa
Tamas Bunth (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 15 07:11:46 UTC 2019
sd/qa/unit/data/pptx/crop-to-shape.pptx |binary
sd/qa/unit/import-tests.cxx | 26 ++++++++++++++++++++++++++
2 files changed, 26 insertions(+)
New commits:
commit 0efccbc58b41008b03f5b1ecc0a97cfcd1d4eafd
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
AuthorDate: Tue May 14 19:16:44 2019 +0200
Commit: Tamás Bunth <btomi96 at gmail.com>
CommitDate: Wed May 15 09:10:40 2019 +0200
Add unit test for pptx import, crop to shape
Change-Id: I2a987278320a5685780962de2d3dfc165f3ef3aa
Reviewed-on: https://gerrit.libreoffice.org/72309
Tested-by: Jenkins
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
diff --git a/sd/qa/unit/data/pptx/crop-to-shape.pptx b/sd/qa/unit/data/pptx/crop-to-shape.pptx
new file mode 100644
index 000000000000..929b07e009ce
Binary files /dev/null and b/sd/qa/unit/data/pptx/crop-to-shape.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 331bc251c82f..04ac4b474ab8 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -52,6 +52,7 @@
#include <com/sun/star/presentation/ClickAction.hpp>
#include <com/sun/star/presentation/XPresentationPage.hpp>
#include <com/sun/star/presentation/XPresentationSupplier.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
#include <com/sun/star/drawing/GraphicExportFilter.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@@ -204,6 +205,7 @@ public:
void testTdf47365();
void testTdf122899();
void testOOXTheme();
+ void testCropToShape();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -294,6 +296,7 @@ public:
CPPUNIT_TEST(testTdf47365);
CPPUNIT_TEST(testTdf122899);
CPPUNIT_TEST(testOOXTheme);
+ CPPUNIT_TEST(testCropToShape);
CPPUNIT_TEST_SUITE_END();
};
@@ -2775,6 +2778,29 @@ void SdImportTest::testOOXTheme()
xDocShRef->DoClose();
}
+void SdImportTest::testCropToShape()
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/crop-to-shape.pptx"), PPTX);
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(
+ xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", xDrawPagesSupplier.is());
+ uno::Reference<drawing::XDrawPages> xDrawPages(xDrawPagesSupplier->getDrawPages());
+ uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPages->getByIndex(0), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage.is());
+ uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<drawing::XShapeDescriptor> xDesc(xShape, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString{"com.sun.star.drawing.CustomShape"}, xDesc->getShapeType());
+ CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape.is());
+ uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
+ css::drawing::FillStyle fillStyle;
+ xShapeProps->getPropertyValue("FillStyle") >>= fillStyle;
+ CPPUNIT_ASSERT_EQUAL(css::drawing::FillStyle_BITMAP, fillStyle);
+ css::drawing::BitmapMode bitmapmode;
+ xShapeProps->getPropertyValue("FillBitmapMode") >>= bitmapmode;
+ CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH, bitmapmode);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list