[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sd/qa
Michael Stahl
mstahl at redhat.com
Fri Feb 10 09:41:20 UTC 2017
sd/qa/unit/data/odg/ooo124143-1.odg |binary
sd/qa/unit/import-tests.cxx | 49 ++++++++++++++++++++++++++++++++++++
sd/qa/unit/sdmodeltestbase.hxx | 4 ++
3 files changed, 52 insertions(+), 1 deletion(-)
New commits:
commit 076aea2fc77ab37172797ecec5d70f3e9ee8b38f
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Feb 9 13:08:13 2017 +0100
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/34086
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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 0000000..8e341cb
Binary files /dev/null and b/sd/qa/unit/data/odg/ooo124143-1.odg differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 4fb3f82..b6f3462 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>
@@ -131,6 +134,7 @@ public:
void testTdf99030();
void testTdf49561();
void testTdf103473();
+ void testAoo124143();
void testTdf103567();
void testTdf103792();
void testTdf103876();
@@ -189,6 +193,7 @@ public:
CPPUNIT_TEST(testTdf99030);
CPPUNIT_TEST(testTdf49561);
CPPUNIT_TEST(testTdf103473);
+ CPPUNIT_TEST(testAoo124143);
CPPUNIT_TEST(testTdf103567);
CPPUNIT_TEST(testTdf103792);
CPPUNIT_TEST(testTdf103876);
@@ -1520,6 +1525,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 bfbb642..943a5e9 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);
}
More information about the Libreoffice-commits
mailing list