Kaydet (Commit) 0efccbc5 authored tarafından Tamas Bunth's avatar Tamas Bunth Kaydeden (comit) Tamás Bunth

Add unit test for pptx import, crop to shape

Change-Id: I2a987278320a5685780962de2d3dfc165f3ef3aa
Reviewed-on: https://gerrit.libreoffice.org/72309
Tested-by: Jenkins
Reviewed-by: 's avatarTamás Bunth <btomi96@gmail.com>
üst 7661e356
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <com/sun/star/presentation/ClickAction.hpp> #include <com/sun/star/presentation/ClickAction.hpp>
#include <com/sun/star/presentation/XPresentationPage.hpp> #include <com/sun/star/presentation/XPresentationPage.hpp>
#include <com/sun/star/presentation/XPresentationSupplier.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/GraphicExportFilter.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
...@@ -204,6 +205,7 @@ public: ...@@ -204,6 +205,7 @@ public:
void testTdf47365(); void testTdf47365();
void testTdf122899(); void testTdf122899();
void testOOXTheme(); void testOOXTheme();
void testCropToShape();
CPPUNIT_TEST_SUITE(SdImportTest); CPPUNIT_TEST_SUITE(SdImportTest);
...@@ -294,6 +296,7 @@ public: ...@@ -294,6 +296,7 @@ public:
CPPUNIT_TEST(testTdf47365); CPPUNIT_TEST(testTdf47365);
CPPUNIT_TEST(testTdf122899); CPPUNIT_TEST(testTdf122899);
CPPUNIT_TEST(testOOXTheme); CPPUNIT_TEST(testOOXTheme);
CPPUNIT_TEST(testCropToShape);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };
...@@ -2775,6 +2778,29 @@ void SdImportTest::testOOXTheme() ...@@ -2775,6 +2778,29 @@ void SdImportTest::testOOXTheme()
xDocShRef->DoClose(); 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_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment