[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sd/qa
Tamas Bunth (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 15 07:27:21 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 da284440060f69d43399277a3d2596140675545c
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
AuthorDate: Tue May 14 19:16:44 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 15 09:26:30 2019 +0200
Add unit test for pptx import, crop to shape
Change-Id: I2a987278320a5685780962de2d3dfc165f3ef3aa
Reviewed-on: https://gerrit.libreoffice.org/72311
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.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 879e13d8f90f..14a907316d70 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/document/XEventsSupplier.hpp>
#include <com/sun/star/presentation/ClickAction.hpp>
#include <com/sun/star/presentation/XPresentationPage.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>
@@ -192,6 +193,7 @@ public:
void testTdf123090();
void testTdf120028();
void testTdf120028b();
+ void testCropToShape();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -277,6 +279,7 @@ public:
CPPUNIT_TEST(testTdf123090);
CPPUNIT_TEST(testTdf120028);
CPPUNIT_TEST(testTdf120028b);
+ CPPUNIT_TEST(testCropToShape);
CPPUNIT_TEST_SUITE_END();
};
@@ -2647,6 +2650,29 @@ void SdImportTest::testTdf120028b()
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