bump product version to 6.3.0.0.beta1
[LibreOffice.git] / test / source / sheet / xsheetfilterableex.cxx
blob46759b224ae3b96602d1f0f2582d063b04aa37b8
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 <test/sheet/xsheetfilterableex.hxx>
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/sheet/XSpreadsheet.hpp>
19 #include <com/sun/star/table/XCellCursor.hpp>
20 #include <com/sun/star/uno/Reference.hxx>
21 #include <com/sun/star/uno/Sequence.hxx>
23 #include <cppunit/extensions/HelperMacros.h>
25 using namespace css;
26 using namespace css::uno;
28 namespace apitest
30 void XSheetFilterableEx::testCreateFilterDescriptorByObject()
32 uno::Reference<sheet::XSheetFilterableEx> xSFEx(init(), UNO_QUERY_THROW);
33 uno::Reference<sheet::XSheetFilterable> xSF(getXSpreadsheet(), UNO_QUERY_THROW);
35 uno::Reference<sheet::XSheetFilterDescriptor> xSFD = xSFEx->createFilterDescriptorByObject(xSF);
36 CPPUNIT_ASSERT_MESSAGE("no XSheetFilterDescriptor", xSFD.is());
38 uno::Sequence<sheet::TableFilterField> xTFF = xSFD->getFilterFields();
39 CPPUNIT_ASSERT_MESSAGE("The gained XSheetFilterDescriptor is empty", xTFF.hasElements());
41 for (const auto& field : xTFF)
43 // we don't care about the actual value, just that we can access the fields
44 CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: StringValue",
45 !field.StringValue.isEmpty() || field.StringValue.isEmpty());
46 CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: IsNumeric",
47 !field.IsNumeric || field.IsNumeric);
48 CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: NumericValue",
49 field.NumericValue != 0.0 || field.NumericValue == 0.0);
50 CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: Field",
51 field.Field != 0 || field.Field == 0);
52 CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: Connection",
53 field.Connection == sheet::FilterConnection_AND
54 || field.Connection == sheet::FilterConnection_OR);
55 CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: Operator",
56 field.Operator != sheet::FilterOperator_EMPTY);
61 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */