summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2018-03-20 04:53:31 +0000
committerJens Carl <j.carl43@gmx.de>2018-04-15 00:58:31 +0200
commitc8c74a0b4ca6f3a3619f423b6548c80c52392ae0 (patch)
tree711f4dbb45e0840f26f66a3d984fe17627d1f776 /test
parent3fb48f0b6a542bb6d91cc35c0dbd3454758ffb2d (diff)
tdf#45904 Move _FunctionDescription Java tests to C++
Change-Id: Ib4baf75dddb3b63bab25ab13967a20c65d692ce2 Reviewed-on: https://gerrit.libreoffice.org/52613 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/functiondescription.cxx86
2 files changed, 87 insertions, 0 deletions
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index dd6509ce81c9..885d645c240c 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/datapilotfield \
test/source/sheet/datapilotitem \
test/source/sheet/documentsettings \
+ test/source/sheet/functiondescription \
test/source/sheet/globalsheetsettings \
test/source/sheet/scenario \
test/source/sheet/spreadsheetdocumentsettings \
diff --git a/test/source/sheet/functiondescription.cxx b/test/source/sheet/functiondescription.cxx
new file mode 100644
index 000000000000..c5fc4ec3c5c1
--- /dev/null
+++ b/test/source/sheet/functiondescription.cxx
@@ -0,0 +1,86 @@
+/* -*- 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 <vector>
+
+#include <test/sheet/functiondescription.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/sheet/FunctionArgument.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void FunctionDescription::testFunctionDescriptionProperties()
+{
+ uno::Sequence<beans::PropertyValue> aFunctionDescription(init());
+
+ std::vector<OUString> names;
+ // Only test the the get/read operation of the values, because set/write operation doesn't
+ // make any sense. It doesn't trigger any changes.
+ // See discussion: nabble.documentfoundation.org/Testing-UNO-API-service-properties-td4236286.html.
+ for (auto& value : aFunctionDescription)
+ {
+ if (value.Name == "Id")
+ {
+ names.push_back(value.Name);
+ sal_Int32 nValue = 0;
+ CPPUNIT_ASSERT(value.Value >>= nValue);
+ }
+ else if (value.Name == "Category")
+ {
+ names.push_back(value.Name);
+ sal_Int32 nValue = 0;
+ CPPUNIT_ASSERT(value.Value >>= nValue);
+ }
+ else if (value.Name == "Name")
+ {
+ names.push_back(value.Name);
+ OUString sValue;
+ CPPUNIT_ASSERT(value.Value >>= sValue);
+ }
+ else if (value.Name == "Description")
+ {
+ names.push_back(value.Name);
+ OUString sValue;
+ CPPUNIT_ASSERT(value.Value >>= sValue);
+ }
+ else if (value.Name == "Arguments")
+ {
+ names.push_back(value.Name);
+ uno::Sequence<sheet::FunctionArgument> sArguments;
+ CPPUNIT_ASSERT(value.Value >>= sArguments);
+ }
+ else
+ {
+ OString aMsg = "Unsupported PropertyValue: "
+ + OUStringToOString(value.Name, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_FAIL(aMsg.getStr());
+ }
+ }
+
+ CPPUNIT_ASSERT_MESSAGE("Property Id not found",
+ std::count(std::begin(names), std::end(names), "Id"));
+ CPPUNIT_ASSERT_MESSAGE("Property Category not found",
+ std::count(std::begin(names), std::end(names), "Category"));
+ CPPUNIT_ASSERT_MESSAGE("Property Name not found",
+ std::count(std::begin(names), std::end(names), "Name"));
+ CPPUNIT_ASSERT_MESSAGE("Property Description not found",
+ std::count(std::begin(names), std::end(names), "Description"));
+ CPPUNIT_ASSERT_MESSAGE("Property Arguments not found",
+ std::count(std::begin(names), std::end(names), "Arguments"));
+}
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */