diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-02-09 13:08:13 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-02-09 13:17:10 +0100 |
commit | dbc31190532be3d3f0d8fb313b9d7247c2eb6135 (patch) | |
tree | 35c110f5f75f9cef2455b75a37c477ae99c6d38a /sd/qa | |
parent | ae00898f12b9087e1d9b59d9a7820d64b5501775 (diff) |
i#124243 sd: add unit test for ODF import of glue points on SVG shape
Change-Id: Ib6434063f4dfebb5f3e180c7136b411dbf0d94d0
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/data/odg/ooo124143-1.odg | bin | 0 -> 14818 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 49 | ||||
-rw-r--r-- | sd/qa/unit/sdmodeltestbase.hxx | 4 |
3 files changed, 52 insertions, 1 deletions
diff --git a/sd/qa/unit/data/odg/ooo124143-1.odg b/sd/qa/unit/data/odg/ooo124143-1.odg Binary files differnew file mode 100644 index 000000000000..8e341cbc72d8 --- /dev/null +++ b/sd/qa/unit/data/odg/ooo124143-1.odg diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 2f5faa874985..3ef78f28a939 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -48,6 +48,9 @@ #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/drawing/XMasterPagesSupplier.hpp> +#include <com/sun/star/drawing/XGluePointsSupplier.hpp> +#include <com/sun/star/drawing/GluePoint2.hpp> +#include <com/sun/star/container/XIdentifierAccess.hpp> #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> #include <com/sun/star/animations/XAnimationNode.hpp> #include <com/sun/star/animations/XAnimate.hpp> @@ -132,6 +135,7 @@ public: void testTdf99030(); void testTdf49561(); void testTdf103473(); + void testAoo124143(); void testTdf103567(); void testTdf103792(); void testTdf103876(); @@ -196,6 +200,7 @@ public: CPPUNIT_TEST(testTdf99030); CPPUNIT_TEST(testTdf49561); CPPUNIT_TEST(testTdf103473); + CPPUNIT_TEST(testAoo124143); CPPUNIT_TEST(testTdf103567); CPPUNIT_TEST(testTdf103792); CPPUNIT_TEST(testTdf103876); @@ -1531,6 +1536,50 @@ void SdImportTest::testTdf103473() xDocShRef->DoClose(); } +void SdImportTest::testAoo124143() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odg/ooo124143-1.odg"), ODG); + + uno::Reference<beans::XPropertySet> const xImage(getShapeFromPage(0, 0, xDocShRef)); + uno::Reference<drawing::XGluePointsSupplier> const xGPS(xImage, uno::UNO_QUERY); + uno::Reference<container::XIdentifierAccess> const xGluePoints(xGPS->getGluePoints(), uno::UNO_QUERY); + + uno::Sequence<sal_Int32> const ids(xGluePoints->getIdentifiers()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(6), ids.getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ids[0]); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), ids[1]); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), ids[2]); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), ids[3]); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), ids[4]); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), ids[5]); + + // interesting ones are custom 4, 5 + drawing::GluePoint2 glue4; + xGluePoints->getByIdentifier(4) >>= glue4; + CPPUNIT_ASSERT_EQUAL( 2470, glue4.Position.X); + CPPUNIT_ASSERT_EQUAL(-1810, glue4.Position.Y); + + drawing::GluePoint2 glue5; + xGluePoints->getByIdentifier(5) >>= glue5; + CPPUNIT_ASSERT_EQUAL(-2975, glue5.Position.X); + CPPUNIT_ASSERT_EQUAL(-2165, glue5.Position.Y); + + // now check connectors + uno::Reference<beans::XPropertySet> const xEllipse(getShapeFromPage(1, 0, xDocShRef)); + uno::Reference<beans::XPropertySet> const xConn1(getShapeFromPage(2, 0, xDocShRef)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xConn1->getPropertyValue("StartGluePointIndex").get<sal_Int32>()); + CPPUNIT_ASSERT_EQUAL(xEllipse, xConn1->getPropertyValue("StartShape").get<uno::Reference<beans::XPropertySet>>()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xConn1->getPropertyValue("EndGluePointIndex").get<sal_Int32>()); + CPPUNIT_ASSERT_EQUAL(xImage, xConn1->getPropertyValue("EndShape").get<uno::Reference<beans::XPropertySet>>()); + uno::Reference<beans::XPropertySet> const xConn2(getShapeFromPage(3, 0, xDocShRef)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xConn2->getPropertyValue("StartGluePointIndex").get<sal_Int32>()); + CPPUNIT_ASSERT_EQUAL(xEllipse, xConn2->getPropertyValue("StartShape").get<uno::Reference<beans::XPropertySet>>()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xConn2->getPropertyValue("EndGluePointIndex").get<sal_Int32>()); + CPPUNIT_ASSERT_EQUAL(xImage, xConn2->getPropertyValue("EndShape").get<uno::Reference<beans::XPropertySet>>()); + + xDocShRef->DoClose(); +} + void SdImportTest::testTdf103567() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf103567.odp"), ODP); diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index 8060618f09f4..19322686df6a 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -76,6 +76,7 @@ FileFormat aFileFormats[] = { "fodg", "OpenDocument Drawing Flat XML", "Flat XML ODF Drawing", "", FODG_FORMAT_TYPE }, { "fodp", "OpenDocument Presentation Flat XML", "Flat XML ODF Presentation", "", FODP_FORMAT_TYPE }, { "sxi", "StarOffice XML (Impress)", "OpenOffice.org 1.0 Presentation", "", SXI_FORMAT_TYPE }, + { "odg", "draw8", "draw8", "", ODP_FORMAT_TYPE }, { nullptr, nullptr, nullptr, nullptr, SfxFilterFlags::NONE } }; @@ -87,6 +88,7 @@ FileFormat aFileFormats[] = #define FODG 5 #define FODP 6 #define SXI 7 +#define ODG 8 /// Base class for filter tests loading or roundtriping a document, and asserting the document model. class SdModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest @@ -204,7 +206,7 @@ protected: pTempFile = pNewTempFile.get(); } save(pShell, pFormat, *pTempFile); - if(nExportType == ODP) + if (nExportType == ODP || nExportType == ODG) { // BootstrapFixture::validate(pTempFile->GetFileName(), test::ODF); } |