diff options
author | Jens Carl <j.carl43@gmx.de> | 2019-03-29 00:30:18 +0000 |
---|---|---|
committer | Jens Carl <j.carl43@gmx.de> | 2019-03-29 02:47:05 +0100 |
commit | d757b121e3f0f5de03da1be430ed51bf830dce67 (patch) | |
tree | e1aac974bbeec03e7cf568df460db46202d7d52e | |
parent | 8d45d5ee399d0148672e79c379f5d29e1c8ba6f3 (diff) |
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@gmx.de>
-rw-r--r-- | include/test/container/xnamed.hxx | 2 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSheetLinkObj.csv | 2 | ||||
-rw-r--r-- | sc/qa/extras/scsheetlinkobj.cxx | 7 | ||||
-rw-r--r-- | test/source/container/xnamed.cxx | 14 |
4 files changed, 23 insertions, 2 deletions
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); |