summaryrefslogtreecommitdiff
path: root/test/source/container
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2018-12-04 07:27:25 +0000
committerJens Carl <j.carl43@gmx.de>2018-12-04 10:18:55 +0100
commite01b46b4229bfb7ba54127f590dec837d798ebd4 (patch)
tree1874907a71d96c5c67bfee137a1b3140161c6a18 /test/source/container
parent88b46b8383019d331ae0ddc76afcd5739f511936 (diff)
tdf#45904 Move XNamed Java tests to C++
Move XNamed Java tests to C++ for ScDDELinkObj and refactor class XNamed. ScDDELinkObj doesn't allow to set the name, so test that a exception of type RuntimeException is thrown. Change-Id: Ie110c3c0ea22d205d4f2c4575f3db3676dda9ce3 Reviewed-on: https://gerrit.libreoffice.org/64497 Tested-by: Jenkins Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'test/source/container')
-rw-r--r--test/source/container/xnamed.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/test/source/container/xnamed.cxx b/test/source/container/xnamed.cxx
index a405ddc60a66..c8234f6dde4f 100644
--- a/test/source/container/xnamed.cxx
+++ b/test/source/container/xnamed.cxx
@@ -7,8 +7,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <com/sun/star/container/XNamed.hpp>
#include <test/container/xnamed.hxx>
+
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
#include <cppunit/extensions/HelperMacros.h>
using namespace css;
@@ -19,7 +24,7 @@ namespace apitest {
void XNamed::testGetName()
{
uno::Reference< container::XNamed > xNamed(init(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT_EQUAL(maTestName, xNamed->getName());
+ CPPUNIT_ASSERT_EQUAL(m_aTestName, xNamed->getName());
}
void XNamed::testSetName()
@@ -31,14 +36,17 @@ void XNamed::testSetName()
CPPUNIT_ASSERT_EQUAL(aTestName, xNamed->getName());
// restore old name
- xNamed->setName(maTestName);
- CPPUNIT_ASSERT_EQUAL(maTestName, xNamed->getName());
+ xNamed->setName(m_aTestName);
+ CPPUNIT_ASSERT_EQUAL(m_aTestName, xNamed->getName());
}
-XNamed::~XNamed()
+void XNamed::testSetNameThrowsException()
{
-}
+ uno::Reference<container::XNamed> xNamed(init(), uno::UNO_QUERY_THROW);
+ OUString aTestName("NewName");
+ CPPUNIT_ASSERT_THROW(xNamed->setName(aTestName), uno::RuntimeException);
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */