summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2013-05-18 01:25:52 +0200
committerThorsten Behrens <tbehrens@suse.com>2013-05-18 01:27:54 +0200
commit8230290c98f9fd77c933e350ca6c861566fefec6 (patch)
tree2d29e0f9e8341e340be1a0b9cc3c9804e812f0a3 /sd/qa
parentcb5000280e292042f36b07f2484026a4382899f9 (diff)
Add unit test for xml:id loading.
Guard against xml:id load breakage, that cause fdo#64512 and fdo#60075. Both connector shape and animation references need it to work. Change-Id: I7883d1d27eae02f605c83217a2e1b83934b31483
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/data/fdo64512.odpbin0 -> 14699 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx52
2 files changed, 52 insertions, 0 deletions
diff --git a/sd/qa/unit/data/fdo64512.odp b/sd/qa/unit/data/fdo64512.odp
new file mode 100644
index 000000000000..ffb9f044bebb
--- /dev/null
+++ b/sd/qa/unit/data/fdo64512.odp
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8ca2348b4b8d..0acc91c2775b 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -16,6 +16,14 @@
#include <editeng/fhgtitem.hxx>
#include <svx/svdotext.hxx>
+#include <animations/animationnodehelper.hxx>
+
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
using namespace ::com::sun::star;
@@ -27,12 +35,14 @@ public:
void testSmoketest();
void testN759180();
void testN778859();
+ void testFdo64512();
CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testDocumentLayout);
CPPUNIT_TEST(testSmoketest);
CPPUNIT_TEST(testN759180);
CPPUNIT_TEST(testN778859);
+ CPPUNIT_TEST(testFdo64512);
CPPUNIT_TEST_SUITE_END();
};
@@ -154,6 +164,48 @@ void SdFiltersTest::testN778859()
}
}
+void SdFiltersTest::testFdo64512()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo64512.odp"));
+ CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
+ CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
+
+ uno::Reference< drawing::XDrawPagesSupplier > xDoc(
+ xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
+ CPPUNIT_ASSERT_MESSAGE( "not exactly one page", xDoc->getDrawPages()->getCount() == 1 );
+
+ uno::Reference< drawing::XDrawPage > xPage(
+ xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
+ CPPUNIT_ASSERT_MESSAGE( "no exactly three shapes", xPage->getCount() == 3 );
+
+ uno::Reference< beans::XPropertySet > xConnectorShape(
+ xPage->getByIndex(2), uno::UNO_QUERY );
+ CPPUNIT_ASSERT_MESSAGE( "no connector shape", xConnectorShape.is() );
+
+ uno::Reference< beans::XPropertySet > xSvgShape(
+ xConnectorShape->getPropertyValue("StartShape"), uno::UNO_QUERY );
+ CPPUNIT_ASSERT_MESSAGE( "no start shape", xSvgShape.is() );
+
+ uno::Reference< beans::XPropertySet > xCustomShape(
+ xConnectorShape->getPropertyValue("EndShape"), uno::UNO_QUERY );
+ CPPUNIT_ASSERT_MESSAGE( "no end shape", xCustomShape.is() );
+
+ uno::Reference< animations::XAnimationNodeSupplier > xAnimNodeSupplier(
+ xPage, uno::UNO_QUERY_THROW );
+ uno::Reference< animations::XAnimationNode > xRootNode(
+ xAnimNodeSupplier->getAnimationNode() );
+ std::vector< uno::Reference< animations::XAnimationNode > > aAnimVector;
+ anim::create_deep_vector(xRootNode, aAnimVector);
+ CPPUNIT_ASSERT_MESSAGE( "not 8 animation nodes", aAnimVector.size() == 8 );
+
+ uno::Reference< animations::XAnimate > xNode(
+ aAnimVector[7], uno::UNO_QUERY_THROW );
+ uno::Reference< drawing::XShape > xTargetShape(
+ xNode->getTarget(), uno::UNO_QUERY_THROW );
+ CPPUNIT_ASSERT_MESSAGE( "inner node not referencing svg shape",
+ xTargetShape != xSvgShape );
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
CPPUNIT_PLUGIN_IMPLEMENT();