[Libreoffice-commits] core.git: sw/CppunitTest_sw_odfimport.mk sw/qa

Michael Stahl mstahl at redhat.com
Tue Sep 3 15:20:34 PDT 2013


 sw/CppunitTest_sw_odfimport.mk           |    1 
 sw/qa/extras/odfimport/data/fdo68839.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx     |   35 +++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+)

New commits:
commit 3c8bee809d248ef1fd39ebeae68de84ce70d358a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Sep 4 00:16:48 2013 +0200

    fdo#68839: add unit test
    
    Change-Id: Ic47bfdeb1466a3772c95008dbf035f294cc3ece4

diff --git a/sw/CppunitTest_sw_odfimport.mk b/sw/CppunitTest_sw_odfimport.mk
index d302127..55805a8 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
new file mode 100644
index 0000000..92a25b8
Binary files /dev/null and b/sw/qa/extras/odfimport/data/fdo68839.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index d5e1c97..a773eb3 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();


More information about the Libreoffice-commits mailing list