bump product version to 6.3.0.0.beta1
[LibreOffice.git] / test / source / sheet / functiondescription.cxx
blobe629331175ae8566ee58ea22e0efdd0f21c04b59
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <vector>
12 #include <test/sheet/functiondescription.hxx>
14 #include <com/sun/star/beans/PropertyValue.hpp>
15 #include <com/sun/star/sheet/FunctionArgument.hpp>
16 #include <com/sun/star/uno/Reference.hxx>
18 #include <cppunit/extensions/HelperMacros.h>
20 using namespace com::sun::star;
21 using namespace com::sun::star::uno;
23 namespace apitest
25 void FunctionDescription::testFunctionDescriptionProperties()
27 uno::Sequence<beans::PropertyValue> aFunctionDescription(init());
29 std::vector<OUString> names;
30 // Only test the get/read operation of the values, because set/write operation doesn't
31 // make any sense. It doesn't trigger any changes.
32 // See discussion: nabble.documentfoundation.org/Testing-UNO-API-service-properties-td4236286.html.
33 for (auto& value : aFunctionDescription)
35 if (value.Name == "Id")
37 names.push_back(value.Name);
38 sal_Int32 nValue = 0;
39 CPPUNIT_ASSERT(value.Value >>= nValue);
41 else if (value.Name == "Category")
43 names.push_back(value.Name);
44 sal_Int32 nValue = 0;
45 CPPUNIT_ASSERT(value.Value >>= nValue);
47 else if (value.Name == "Name")
49 names.push_back(value.Name);
50 OUString sValue;
51 CPPUNIT_ASSERT(value.Value >>= sValue);
53 else if (value.Name == "Description")
55 names.push_back(value.Name);
56 OUString sValue;
57 CPPUNIT_ASSERT(value.Value >>= sValue);
59 else if (value.Name == "Arguments")
61 names.push_back(value.Name);
62 uno::Sequence<sheet::FunctionArgument> sArguments;
63 CPPUNIT_ASSERT(value.Value >>= sArguments);
65 else
67 OString aMsg = "Unsupported PropertyValue: "
68 + OUStringToOString(value.Name, RTL_TEXTENCODING_UTF8);
69 CPPUNIT_FAIL(aMsg.getStr());
73 CPPUNIT_ASSERT_MESSAGE("Property Id not found",
74 std::count(std::begin(names), std::end(names), "Id"));
75 CPPUNIT_ASSERT_MESSAGE("Property Category not found",
76 std::count(std::begin(names), std::end(names), "Category"));
77 CPPUNIT_ASSERT_MESSAGE("Property Name not found",
78 std::count(std::begin(names), std::end(names), "Name"));
79 CPPUNIT_ASSERT_MESSAGE("Property Description not found",
80 std::count(std::begin(names), std::end(names), "Description"));
81 CPPUNIT_ASSERT_MESSAGE("Property Arguments not found",
82 std::count(std::begin(names), std::end(names), "Arguments"));
84 } // namespace apitest
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */