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/container/xelementaccess.hxx>
13 #include <test/container/xenumerationaccess.hxx>
14 #include <test/container/xindexaccess.hxx>
15 #include <test/container/xnamed.hxx>
16 #include <test/lang/xserviceinfo.hxx>
17 #include <test/sheet/tableautoformat.hxx>
18 #include <cppu/unotype.hxx>
20 #include <com/sun/star/beans/XPropertySet.hpp>
21 #include <com/sun/star/container/XIndexAccess.hpp>
22 #include <com/sun/star/lang/XComponent.hpp>
23 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
25 #include <com/sun/star/uno/XInterface.hpp>
27 #include <com/sun/star/uno/Reference.hxx>
33 class ScAutoFormatObj
: public CalcUnoApiTest
,
34 public apitest::TableAutoFormat
,
35 public apitest::XElementAccess
,
36 public apitest::XEnumerationAccess
,
37 public apitest::XIndexAccess
,
38 public apitest::XNamed
,
39 public apitest::XPropertySet
,
40 public apitest::XServiceInfo
45 virtual uno::Reference
<uno::XInterface
> init() override
;
46 virtual void setUp() override
;
47 virtual void tearDown() override
;
49 CPPUNIT_TEST_SUITE(ScAutoFormatObj
);
52 CPPUNIT_TEST(testTableAutoFormatProperties
);
55 CPPUNIT_TEST(testGetElementType
);
56 CPPUNIT_TEST(testHasElements
);
59 CPPUNIT_TEST(testCreateEnumeration
);
62 CPPUNIT_TEST(testGetByIndex
);
63 CPPUNIT_TEST(testGetCount
);
66 CPPUNIT_TEST(testGetName
);
67 CPPUNIT_TEST(testSetName
);
70 CPPUNIT_TEST(testGetPropertySetInfo
);
71 CPPUNIT_TEST(testGetPropertyValue
);
72 CPPUNIT_TEST(testSetPropertyValue
);
73 CPPUNIT_TEST(testPropertyChangeListener
);
74 CPPUNIT_TEST(testVetoableChangeListener
);
77 CPPUNIT_TEST(testGetImplementationName
);
78 CPPUNIT_TEST(testGetSupportedServiceNames
);
79 CPPUNIT_TEST(testSupportsService
);
81 CPPUNIT_TEST_SUITE_END();
84 uno::Reference
<lang::XComponent
> mxComponent
;
87 ScAutoFormatObj::ScAutoFormatObj()
88 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
89 , XElementAccess(cppu::UnoType
<beans::XPropertySet
>::get())
92 , XServiceInfo("ScAutoFormatObj", "com.sun.star.sheet.TableAutoFormat")
96 uno::Reference
<uno::XInterface
> ScAutoFormatObj::init()
98 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(mxComponent
, uno::UNO_QUERY_THROW
);
100 uno::Reference
<lang::XMultiServiceFactory
> xMSF(xDoc
, uno::UNO_QUERY_THROW
);
101 uno::Reference
<container::XIndexAccess
> xIA(
102 xMSF
->createInstance("com.sun.star.sheet.TableAutoFormats"), uno::UNO_QUERY_THROW
);
104 uno::Reference
<beans::XPropertySet
> xTableAutoFormat(xIA
->getByIndex(xIA
->getCount() - 1),
105 uno::UNO_QUERY_THROW
);
106 return xTableAutoFormat
;
109 void ScAutoFormatObj::setUp()
111 CalcUnoApiTest::setUp();
112 mxComponent
= loadFromDesktop("private:factory/scalc");
115 void ScAutoFormatObj::tearDown()
117 closeDocument(mxComponent
);
118 CalcUnoApiTest::tearDown();
121 CPPUNIT_TEST_SUITE_REGISTRATION(ScAutoFormatObj
);
123 } // namespace sc_apitest
125 CPPUNIT_PLUGIN_IMPLEMENT();
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */