diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2019-05-14 19:16:44 +0200 |
---|---|---|
committer | Tamás Bunth <btomi96@gmail.com> | 2019-05-15 09:10:40 +0200 |
commit | 0efccbc58b41008b03f5b1ecc0a97cfcd1d4eafd (patch) | |
tree | 14dbfb879b5459a463565bfd4b70992f19fbf48e /sd | |
parent | 7661e356c42e30bf4e2c2842c663f1c3a5ffebc2 (diff) |
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@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/crop-to-shape.pptx | bin | 0 -> 83338 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 26 |
2 files changed, 26 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/crop-to-shape.pptx b/sd/qa/unit/data/pptx/crop-to-shape.pptx Binary files differnew file mode 100644 index 000000000000..929b07e009ce --- /dev/null +++ b/sd/qa/unit/data/pptx/crop-to-shape.pptx 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(); |