diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-09-04 00:16:48 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-09-04 00:17:18 +0200 |
commit | 3c8bee809d248ef1fd39ebeae68de84ce70d358a (patch) | |
tree | 739d101124f5759f93760d1668bddb0840dbe20d /sw | |
parent | ba083e5c5a4723db90acacb769c4f1624f182287 (diff) |
fdo#68839: add unit test
Change-Id: Ic47bfdeb1466a3772c95008dbf035f294cc3ece4
Diffstat (limited to 'sw')
-rw-r--r-- | sw/CppunitTest_sw_odfimport.mk | 1 | ||||
-rw-r--r-- | sw/qa/extras/odfimport/data/fdo68839.odt | bin | 0 -> 17657 bytes | |||
-rw-r--r-- | sw/qa/extras/odfimport/odfimport.cxx | 35 |
3 files changed, 36 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_odfimport.mk b/sw/CppunitTest_sw_odfimport.mk index d302127bf948..55805a85f258 100644 --- a/sw/CppunitTest_sw_odfimport.mk +++ b/sw/CppunitTest_sw_odfimport.mk @@ -51,6 +51,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_odfimport,\ basic/util/sb \ comphelper/util/comphelp \ configmgr/source/configmgr \ + embeddedobj/util/embobj \ fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ diff --git a/sw/qa/extras/odfimport/data/fdo68839.odt b/sw/qa/extras/odfimport/data/fdo68839.odt Binary files differnew file mode 100644 index 000000000000..92a25b8f7ea4 --- /dev/null +++ b/sw/qa/extras/odfimport/data/fdo68839.odt diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index d5e1c970a394..a773eb3ca8f7 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -27,6 +27,7 @@ public: void testFdo60842(); void testFdo56272(); void testFdo55814(); + void testFdo68839(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -50,6 +51,7 @@ void Test::run() {"fdo60842.odt", &Test::testFdo60842}, {"fdo56272.odt", &Test::testFdo56272}, {"fdo55814.odt", &Test::testFdo55814}, + {"fdo68839.odt", &Test::testFdo68839}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -320,6 +322,39 @@ void Test::testFdo55814() CPPUNIT_ASSERT_EQUAL(OUString("Hide==\"Yes\""), getProperty<OUString>(xSections->getByIndex(0), "Condition")); } +void lcl_CheckShape( + uno::Reference<drawing::XShape> const& xShape, OUString const& rExpected) +{ + uno::Reference<container::XNamed> const xNamed(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT(xNamed.is()); + CPPUNIT_ASSERT_EQUAL(rExpected, xNamed->getName()); +} + +void Test::testFdo68839() +{ + // check names + lcl_CheckShape(getShape(1), "FrameXXX"); + lcl_CheckShape(getShape(2), "ObjectXXX"); + lcl_CheckShape(getShape(3), "FrameY"); + lcl_CheckShape(getShape(4), "graphicsXXX"); + try { + uno::Reference<drawing::XShape> xShape = getShape(5); + CPPUNIT_ASSERT(!"IndexOutOfBoundsException expected"); + } catch (lang::IndexOutOfBoundsException const&) { } + // check prev/next chain + uno::Reference<beans::XPropertySet> xFrame1(getShape(1), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xFrame2(getShape(3), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(), + getProperty<OUString>(xFrame1, "ChainPrevName")); + CPPUNIT_ASSERT_EQUAL(OUString("FrameY"), + getProperty<OUString>(xFrame1, "ChainNextName")); + CPPUNIT_ASSERT_EQUAL(OUString("FrameXXX"), + getProperty<OUString>(xFrame2, "ChainPrevName")); + CPPUNIT_ASSERT_EQUAL(OUString(), + getProperty<OUString>(xFrame2, "ChainNextName")); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |