12#include <com/sun/star/sheet/FilterConnection.hpp>
13#include <com/sun/star/sheet/FilterOperator.hpp>
14#include <com/sun/star/sheet/TableFilterField.hpp>
15#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp>
16#include <com/sun/star/sheet/XSheetFilterable.hpp>
17#include <com/sun/star/sheet/XSheetFilterableEx.hpp>
18#include <com/sun/star/uno/Reference.hxx>
19#include <com/sun/star/uno/Sequence.hxx>
21#include <cppunit/TestAssert.h>
24using namespace css::uno;
30 uno::Reference<sheet::XSheetFilterableEx> xSFEx(
init(), UNO_QUERY_THROW);
31 uno::Reference<sheet::XSheetFilterable> xSF(
getXSpreadsheet(), UNO_QUERY_THROW);
33 uno::Reference<sheet::XSheetFilterDescriptor> xSFD = xSFEx->createFilterDescriptorByObject(xSF);
34 CPPUNIT_ASSERT_MESSAGE(
"no XSheetFilterDescriptor", xSFD.is());
36 const uno::Sequence<sheet::TableFilterField> xTFF = xSFD->getFilterFields();
37 CPPUNIT_ASSERT_MESSAGE(
"The gained XSheetFilterDescriptor is empty", xTFF.hasElements());
39 for (
const auto& field : xTFF)
42 CPPUNIT_ASSERT_MESSAGE(
"Unable to retrieve field: StringValue",
43 !field.StringValue.isEmpty() || field.StringValue.isEmpty());
44 CPPUNIT_ASSERT_MESSAGE(
"Unable to retrieve field: IsNumeric",
45 !field.IsNumeric || field.IsNumeric);
46 CPPUNIT_ASSERT_MESSAGE(
"Unable to retrieve field: NumericValue",
47 field.NumericValue != 0.0 || field.NumericValue == 0.0);
48 CPPUNIT_ASSERT_MESSAGE(
"Unable to retrieve field: Field",
49 field.Field != 0 || field.Field == 0);
50 CPPUNIT_ASSERT_MESSAGE(
"Unable to retrieve field: Connection",
51 field.Connection == sheet::FilterConnection_AND
52 || field.Connection == sheet::FilterConnection_OR);
53 CPPUNIT_ASSERT_MESSAGE(
"Unable to retrieve field: Operator",
54 field.Operator != sheet::FilterOperator_EMPTY);
void testCreateFilterDescriptorByObject()
virtual css::uno::Reference< css::uno::XInterface > getXSpreadsheet()=0
virtual css::uno::Reference< css::uno::XInterface > init()=0