Kaydet (Commit) d757b121 authored tarafından Jens Carl's avatar Jens Carl

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: 's avatarJens Carl <j.carl43@gmx.de>
üst 8d45d5ee
......@@ -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;
......
"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()"
......
......@@ -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"))
{
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment