summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2017-12-08 09:14:27 +0000
committerJens Carl <j.carl43@gmx.de>2017-12-08 19:30:22 +0100
commit13ca879fba12c53f2856186f5cd8509efe625774 (patch)
tree630736498e28941fd9309bb90f741b1d9df0fd1e /test
parent09da6dfcfb732dd621670f2b919eb5b5bf09b7ec (diff)
tdf#45904 Move _XDatabaseRanges Java tests to C++
Change-Id: Iee6753fd60fefc1ecd17ba8fe0acef58f17d64e6 Reviewed-on: https://gerrit.libreoffice.org/46076 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'test')
-rw-r--r--test/Library_subsequenttest.mk1
-rw-r--r--test/source/sheet/xdatabaseranges.cxx47
2 files changed, 48 insertions, 0 deletions
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index a03fb5b822f4..e2a8f3f64a09 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -56,6 +56,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xcellseries \
test/source/sheet/xgoalseek \
test/source/sheet/xdatabaserange \
+ test/source/sheet/xdatabaseranges \
test/source/sheet/xdatapilotdescriptor \
test/source/sheet/xdatapilotfield \
test/source/sheet/xdatapilotfieldgrouping \
diff --git a/test/source/sheet/xdatabaseranges.cxx b/test/source/sheet/xdatabaseranges.cxx
new file mode 100644
index 000000000000..972631014e64
--- /dev/null
+++ b/test/source/sheet/xdatabaseranges.cxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <random>
+
+#include <test/sheet/xdatabaseranges.hxx>
+
+#include <com/sun/star/sheet/XDatabaseRanges.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest
+{
+void XDatabaseRanges::testAddRemoveDbRanges()
+{
+ uno::Reference<sheet::XDatabaseRanges> xDbRanges(init(), UNO_QUERY_THROW);
+
+ xDbRanges->addNewByName("addNewRange", table::CellRangeAddress(0, 1, 2, 3, 4));
+ CPPUNIT_ASSERT_MESSAGE("Unable to add new db range", xDbRanges->hasByName("addNewRange"));
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "No execption thrown, when adding range with existing name",
+ xDbRanges->addNewByName("addNewRange", table::CellRangeAddress(0, 1, 2, 3, 4)),
+ css::uno::RuntimeException);
+
+ xDbRanges->removeByName("addNewRange");
+ CPPUNIT_ASSERT_MESSAGE("Unable to remove db range", !xDbRanges->hasByName("addNewRange"));
+
+ CPPUNIT_ASSERT_THROW_MESSAGE("No execption, when removing none-existing range",
+ xDbRanges->removeByName("addNewRange"),
+ css::uno::RuntimeException);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */