1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
10 #include <test/calc_unoapi_test.hxx>
11 #include <test/beans/xpropertyset.hxx>
12 #include <test/lang/xserviceinfo.hxx>
13 #include <test/util/searchdescriptor.hxx>
14 #include <test/util/xreplacedescriptor.hxx>
15 #include <test/util/xsearchdescriptor.hxx>
17 #include <com/sun/star/container/XIndexAccess.hpp>
18 #include <com/sun/star/lang/XComponent.hpp>
19 #include <com/sun/star/sheet/XSpreadsheet.hpp>
20 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
21 #include <com/sun/star/sheet/XSpreadsheets.hpp>
22 #include <com/sun/star/uno/XInterface.hpp>
23 #include <com/sun/star/util/XSearchable.hpp>
25 #include <com/sun/star/uno/Reference.hxx>
31 class ScCellSearchObj
: public CalcUnoApiTest
,
32 public apitest::SearchDescriptor
,
33 public apitest::XPropertySet
,
34 public apitest::XReplaceDescriptor
,
35 public apitest::XSearchDescriptor
,
36 public apitest::XServiceInfo
41 virtual uno::Reference
<uno::XInterface
> init() override
;
42 virtual void setUp() override
;
43 virtual void tearDown() override
;
45 CPPUNIT_TEST_SUITE(ScCellSearchObj
);
48 CPPUNIT_TEST(testSearchDescriptorProperties
);
51 CPPUNIT_TEST(testGetPropertySetInfo
);
52 CPPUNIT_TEST(testGetPropertyValue
);
53 CPPUNIT_TEST(testGetPropertyValue
);
54 CPPUNIT_TEST(testPropertyChangeListener
);
55 CPPUNIT_TEST(testVetoableChangeListener
);
58 CPPUNIT_TEST(testGetSetReplaceString
);
61 CPPUNIT_TEST(testGetSetSearchString
);
64 CPPUNIT_TEST(testGetImplementationName
);
65 CPPUNIT_TEST(testGetSupportedServiceNames
);
66 CPPUNIT_TEST(testSupportsService
);
68 CPPUNIT_TEST_SUITE_END();
71 uno::Reference
<lang::XComponent
> m_xComponent
;
74 ScCellSearchObj::ScCellSearchObj()
75 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
76 , XServiceInfo("ScCellSearchObj",
77 { "com.sun.star.util.ReplaceDescriptor", "com.sun.star.util.SearchDescriptor" })
81 uno::Reference
<uno::XInterface
> ScCellSearchObj::init()
83 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(m_xComponent
, uno::UNO_QUERY_THROW
);
84 uno::Reference
<sheet::XSpreadsheets
> xSheets(xDoc
->getSheets(), uno::UNO_SET_THROW
);
85 uno::Reference
<container::XIndexAccess
> xIA(xSheets
, uno::UNO_QUERY_THROW
);
86 uno::Reference
<sheet::XSpreadsheet
> xSheet0(xIA
->getByIndex(0), uno::UNO_QUERY_THROW
);
88 uno::Reference
<util::XSearchable
> xSearchable(xSheet0
, uno::UNO_QUERY_THROW
);
89 return xSearchable
->createSearchDescriptor();
92 void ScCellSearchObj::setUp()
94 CalcUnoApiTest::setUp();
95 // create calc document
96 m_xComponent
= loadFromDesktop("private:factory/scalc");
99 void ScCellSearchObj::tearDown()
101 closeDocument(m_xComponent
);
102 CalcUnoApiTest::tearDown();
105 CPPUNIT_TEST_SUITE_REGISTRATION(ScCellSearchObj
);
107 } // namespace sc_apitest
109 CPPUNIT_PLUGIN_IMPLEMENT();
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */