13#include <com/sun/star/beans/PropertyValue.hpp>
14#include <com/sun/star/util/XSortable.hpp>
15#include <com/sun/star/table/CellAddress.hpp>
16#include <com/sun/star/table/TableSortField.hpp>
17#include <com/sun/star/uno/Reference.hxx>
18#include <com/sun/star/uno/Sequence.hxx>
20#include <cppunit/TestAssert.h>
31 uno::Reference<util::XSortable> xSortable(
init(), UNO_QUERY_THROW);
32 const uno::Sequence<beans::PropertyValue>
values = xSortable->createSortDescriptor();
34 std::vector<OUString> names;
40 if (
value.Name ==
"BindFormatsToContent")
42 names.push_back(
value.Name);
44 CPPUNIT_ASSERT(
value.Value >>= bValue);
46 else if (
value.Name ==
"IsUserListEnabled")
48 names.push_back(
value.Name);
50 CPPUNIT_ASSERT(
value.Value >>= bValue);
52 else if (
value.Name ==
"UserListIndex")
54 names.push_back(
value.Name);
58 else if (
value.Name ==
"CopyOutputData")
60 names.push_back(
value.Name);
62 CPPUNIT_ASSERT(
value.Value >>= bValue);
64 else if (
value.Name ==
"OutputPosition")
66 names.push_back(
value.Name);
67 table::CellAddress cellAddr;
68 CPPUNIT_ASSERT(
value.Value >>= cellAddr);
70 else if (
value.Name ==
"SortFields")
72 names.push_back(
value.Name);
73 uno::Sequence<table::TableSortField> sSortFields;
74 CPPUNIT_ASSERT(
value.Value >>= sSortFields);
76 else if (
value.Name ==
"MaxFieldCount")
78 names.push_back(
value.Name);
82 else if (
value.Name ==
"IsSortColumns")
84 names.push_back(
value.Name);
86 CPPUNIT_ASSERT(
value.Value >>= bValue);
88 else if (
value.Name ==
"ContainsHeader")
90 names.push_back(
value.Name);
92 CPPUNIT_ASSERT(
value.Value >>= bValue);
96 OString sMsg =
"Unsupported PropertyValue: "
98 CPPUNIT_FAIL(sMsg.getStr());
102 CPPUNIT_ASSERT_MESSAGE(
"Property BindFormatsToContent not found",
103 std::count(std::begin(names), std::end(names),
"BindFormatsToContent"));
104 CPPUNIT_ASSERT_MESSAGE(
"Property IsUserListEnabled not found",
105 std::count(std::begin(names), std::end(names),
"IsUserListEnabled"));
106 CPPUNIT_ASSERT_MESSAGE(
"Property UserListIndex not found",
107 std::count(std::begin(names), std::end(names),
"UserListIndex"));
108 CPPUNIT_ASSERT_MESSAGE(
"Property CopyOutputData not found",
109 std::count(std::begin(names), std::end(names),
"CopyOutputData"));
110 CPPUNIT_ASSERT_MESSAGE(
"Property OutputPosition not found",
111 std::count(std::begin(names), std::end(names),
"OutputPosition"));
112 CPPUNIT_ASSERT_MESSAGE(
"Property SortFields not found",
113 std::count(std::begin(names), std::end(names),
"SortFields"));
114 CPPUNIT_ASSERT_MESSAGE(
"Property MaxFieldCount not found",
115 std::count(std::begin(names), std::end(names),
"MaxFieldCount"));
116 CPPUNIT_ASSERT_MESSAGE(
"Property IsSortColumns not found",
117 std::count(std::begin(names), std::end(names),
"IsSortColumns"));
118 CPPUNIT_ASSERT_MESSAGE(
"Property ContainsHeader not found",
119 std::count(std::begin(names), std::end(names),
"ContainsHeader"));
virtual css::uno::Reference< css::uno::XInterface > init()=0
void testSheetSortDescriptor2Properties()
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
std::vector< char * > values