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/qa/extras/odfimport/odfimport.cxx | |
parent | ba083e5c5a4723db90acacb769c4f1624f182287 (diff) |
fdo#68839: add unit test
Change-Id: Ic47bfdeb1466a3772c95008dbf035f294cc3ece4
Diffstat (limited to 'sw/qa/extras/odfimport/odfimport.cxx')
-rw-r--r-- | sw/qa/extras/odfimport/odfimport.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
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(); |