nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / extras / scfilterdescriptorbase.cxx
blob7811d6c83bf16d3fddc55dd20d8903ffaac7b41a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/calc_unoapi_test.hxx>
11 #include <test/beans/xpropertyset.hxx>
12 #include <test/lang/xserviceinfo.hxx>
13 #include <test/sheet/sheetfilterdescriptor.hxx>
14 #include <test/sheet/xsheetfilterdescriptor.hxx>
15 #include <test/sheet/xsheetfilterdescriptor2.hxx>
16 #include <test/sheet/xsheetfilterdescriptor3.hxx>
18 #include <com/sun/star/container/XIndexAccess.hpp>
19 #include <com/sun/star/lang/XComponent.hpp>
20 #include <com/sun/star/sheet/XSheetFilterable.hpp>
21 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
22 #include <com/sun/star/sheet/XSpreadsheet.hpp>
23 #include <com/sun/star/uno/XInterface.hpp>
25 #include <com/sun/star/uno/Reference.hxx>
27 using namespace css;
28 using namespace css::uno;
30 namespace sc_apitest
32 class ScFilterDescriptorBase : public CalcUnoApiTest,
33 public apitest::SheetFilterDescriptor,
34 public apitest::XPropertySet,
35 public apitest::XServiceInfo,
36 public apitest::XSheetFilterDescriptor,
37 public apitest::XSheetFilterDescriptor2,
38 public apitest::XSheetFilterDescriptor3
40 public:
41 ScFilterDescriptorBase();
43 virtual void setUp() override;
44 virtual void tearDown() override;
46 virtual uno::Reference<uno::XInterface> init() override;
48 CPPUNIT_TEST_SUITE(ScFilterDescriptorBase);
50 // SheetFilterDescriptor
51 CPPUNIT_TEST(testSheetFilterDescriptorProperties);
53 // XPropertySet
54 CPPUNIT_TEST(testGetPropertySetInfo);
55 CPPUNIT_TEST(testGetPropertyValue);
56 CPPUNIT_TEST(testSetPropertyValue);
57 CPPUNIT_TEST(testPropertyChangeListener);
58 CPPUNIT_TEST(testVetoableChangeListener);
60 // XServiceInfo
61 CPPUNIT_TEST(testGetImplementationName);
62 CPPUNIT_TEST(testGetSupportedServiceNames);
63 CPPUNIT_TEST(testSupportsService);
65 // XSheetFilterDescriptor
66 CPPUNIT_TEST(testGetSetFilterFields);
68 // XSheetFilterDescriptor2
69 CPPUNIT_TEST(testGetSetFilterFields2);
71 // XSheetFilterDescriptor3
72 CPPUNIT_TEST(testGetSetFilterFields3);
74 CPPUNIT_TEST_SUITE_END();
76 private:
77 uno::Reference<lang::XComponent> mxComponent;
80 ScFilterDescriptorBase::ScFilterDescriptorBase()
81 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
82 , XPropertySet({ "Orientation", "OutputPosition" })
83 , XServiceInfo("ScFilterDescriptorBase", "com.sun.star.sheet.SheetFilterDescriptor")
87 uno::Reference<uno::XInterface> ScFilterDescriptorBase::init()
89 uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
91 uno::Reference<container::XIndexAccess> xIndexAccess(xDoc->getSheets(), uno::UNO_QUERY_THROW);
92 uno::Reference<sheet::XSpreadsheet> xSheet(xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW);
94 xSheet->getCellByPosition(5, 5)->setValue(15);
95 xSheet->getCellByPosition(1, 4)->setValue(10);
96 xSheet->getCellByPosition(2, 0)->setValue(-5.15);
98 uno::Reference<sheet::XSheetFilterable> xSF(xSheet, uno::UNO_QUERY_THROW);
100 return xSF->createFilterDescriptor(true);
103 void ScFilterDescriptorBase::setUp()
105 CalcUnoApiTest::setUp();
106 // create a calc document
107 mxComponent = loadFromDesktop("private:factory/scalc");
110 void ScFilterDescriptorBase::tearDown()
112 closeDocument(mxComponent);
113 CalcUnoApiTest::tearDown();
116 CPPUNIT_TEST_SUITE_REGISTRATION(ScFilterDescriptorBase);
118 } // namespace sc_apitest
120 CPPUNIT_PLUGIN_IMPLEMENT();
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */