[Libreoffice-commits] core.git: include/test qadevOOo/objdsc sc/qa test/source

Jens Carl (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 29 01:47:34 UTC 2019


 include/test/container/xnamed.hxx                              |    2 +
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSheetLinkObj.csv |    2 -
 sc/qa/extras/scsheetlinkobj.cxx                                |    7 +++++
 test/source/container/xnamed.cxx                               |   14 ++++++++++
 4 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit d757b121e3f0f5de03da1be430ed51bf830dce67
Author:     Jens Carl <j.carl43 at gmx.de>
AuthorDate: Fri Mar 29 00:30:18 2019 +0000
Commit:     Jens Carl <j.carl43 at gmx.de>
CommitDate: Fri Mar 29 02:47:05 2019 +0100

    tdf#45904 Move XNamed Java tests to C++
    
    Move XNamed Java tests to C++ for ScSheetLinkObj.
    
    Change-Id: I64904ed6bae1b96767f8b0a65b0850a8694b10c2
    Reviewed-on: https://gerrit.libreoffice.org/69907
    Tested-by: Jenkins
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/include/test/container/xnamed.hxx b/include/test/container/xnamed.hxx
index 1b1a762ef8b4..de8618ce4436 100644
--- a/include/test/container/xnamed.hxx
+++ b/include/test/container/xnamed.hxx
@@ -30,6 +30,8 @@ public:
 
     void testGetName();
     void testSetName();
+    // special case, here name is equal to links URL
+    void testSetNameByScSheetLinkObj();
     void testSetNameThrowsException();
 
     virtual css::uno::Reference< css::uno::XInterface > init() = 0;
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSheetLinkObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSheetLinkObj.csv
index 2d72f6819568..63be54e69d85 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSheetLinkObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSheetLinkObj.csv
@@ -1,5 +1,3 @@
-"ScSheetLinkObj";"com::sun::star::container::XNamed";"getName()"
-"ScSheetLinkObj";"com::sun::star::container::XNamed";"setName()"
 "ScSheetLinkObj";"com::sun::star::beans::XPropertySet";"getPropertySetInfo()"
 "ScSheetLinkObj";"com::sun::star::beans::XPropertySet";"setPropertyValue()"
 "ScSheetLinkObj";"com::sun::star::beans::XPropertySet";"getPropertyValue()"
diff --git a/sc/qa/extras/scsheetlinkobj.cxx b/sc/qa/extras/scsheetlinkobj.cxx
index 2819c915b6f0..5239a3288cee 100644
--- a/sc/qa/extras/scsheetlinkobj.cxx
+++ b/sc/qa/extras/scsheetlinkobj.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <test/calc_unoapi_test.hxx>
+#include <test/container/xnamed.hxx>
 #include <test/sheet/sheetlink.hxx>
 #include <test/util/xrefreshable.hxx>
 #include <sfx2/app.hxx>
@@ -31,6 +32,7 @@ namespace sc_apitest
 {
 class ScSheetLinkObj : public CalcUnoApiTest,
                        public apitest::SheetLink,
+                       public apitest::XNamed,
                        public apitest::XRefreshable
 {
 public:
@@ -46,6 +48,10 @@ public:
     // SheetLink
     CPPUNIT_TEST(testSheetLinkProperties);
 
+    // XNamed
+    CPPUNIT_TEST(testGetName);
+    CPPUNIT_TEST(testSetNameByScSheetLinkObj);
+
     // XRefreshable
     CPPUNIT_TEST(testRefreshListener);
 
@@ -57,6 +63,7 @@ private:
 
 ScSheetLinkObj::ScSheetLinkObj()
     : CalcUnoApiTest("/sc/qa/extras/testdocuments")
+    , XNamed(m_directories.getURLFromSrc("/sc/qa/extras/testdocuments/ScSheetLinkObj.ods"))
 {
 }
 
diff --git a/test/source/container/xnamed.cxx b/test/source/container/xnamed.cxx
index c8234f6dde4f..3b8023b6bc95 100644
--- a/test/source/container/xnamed.cxx
+++ b/test/source/container/xnamed.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <test/container/xnamed.hxx>
+#include <rtl/ustring.hxx>
 
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/uno/RuntimeException.hpp>
@@ -40,6 +41,19 @@ void XNamed::testSetName()
     CPPUNIT_ASSERT_EQUAL(m_aTestName, xNamed->getName());
 }
 
+void XNamed::testSetNameByScSheetLinkObj()
+{
+    uno::Reference<container::XNamed> xNamed(init(), uno::UNO_QUERY_THROW);
+    OUString aTestName(m_aTestName.replaceAll("ScSheetLinkObj", "NewScSheetLinkObj"));
+
+    xNamed->setName(aTestName);
+    CPPUNIT_ASSERT_EQUAL(aTestName, xNamed->getName());
+
+    // restore old name
+    xNamed->setName(m_aTestName);
+    CPPUNIT_ASSERT_EQUAL(m_aTestName, xNamed->getName());
+}
+
 void XNamed::testSetNameThrowsException()
 {
     uno::Reference<container::XNamed> xNamed(init(), uno::UNO_QUERY_THROW);


More information about the Libreoffice-commits mailing list