summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-02-09 13:08:13 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-02-13 08:28:10 +0000
commitc11b40c5eb32a8b3bb78621983d70d43d6c9b276 (patch)
treec0bfb3dd83d07695c9f8a4d407449ea560bc2ec0
parent3d507dbcd08e07af3ae6e7f5f0962e5422187087 (diff)
i#124243 sd: add unit test for ODF import of glue points on SVG shape
Change-Id: Ib6434063f4dfebb5f3e180c7136b411dbf0d94d0 (cherry picked from commit dbc31190532be3d3f0d8fb313b9d7247c2eb6135) Reviewed-on: https://gerrit.libreoffice.org/34089 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sd/qa/unit/data/odg/ooo124143-1.odgbin0 -> 14818 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx49
-rw-r--r--sd/qa/unit/sdmodeltestbase.hxx4
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
new file mode 100644
index 000000000000..8e341cbc72d8
--- /dev/null
+++ b/sd/qa/unit/data/odg/ooo124143-1.odg
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 204574fd504d..6ed765f99cbc 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>
@@ -127,6 +130,7 @@ public:
void testTdf99030();
void testTdf49561();
void testTdf103473();
+ void testAoo124143();
void testTdf103567();
void testTdf103792();
void testTdf103876();
@@ -184,6 +188,7 @@ public:
CPPUNIT_TEST(testTdf99030);
CPPUNIT_TEST(testTdf49561);
CPPUNIT_TEST(testTdf103473);
+ CPPUNIT_TEST(testAoo124143);
CPPUNIT_TEST(testTdf103567);
CPPUNIT_TEST(testTdf103792);
CPPUNIT_TEST(testTdf103876);
@@ -1447,6 +1452,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(sal_Int32( 2470), glue4.Position.X);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1810), glue4.Position.Y);
+
+ drawing::GluePoint2 glue5;
+ xGluePoints->getByIdentifier(5) >>= glue5;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-2975), glue5.Position.X);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-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 9532cb28c3db..795e237f7253 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -71,6 +71,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 }
};
@@ -82,6 +83,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
@@ -199,7 +201,7 @@ protected:
pTempFile = pNewTempFile.get();
}
save(pShell, pFormat, *pTempFile);
- if(nExportType == ODP)
+ if (nExportType == ODP || nExportType == ODG)
{
// BootstrapFixture::validate(pTempFile->GetFileName(), test::ODF);
}