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/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/XMultiServiceFactory.hpp>
23 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
24 #include <com/sun/star/uno/XInterface.hpp>
26 #include <com/sun/star/uno/Reference.hxx>
32 class ScAutoFormatObj
: public UnoApiTest
,
33 public apitest::TableAutoFormat
,
34 public apitest::XElementAccess
,
35 public apitest::XEnumerationAccess
,
36 public apitest::XIndexAccess
,
37 public apitest::XNamed
,
38 public apitest::XPropertySet
,
39 public apitest::XServiceInfo
44 virtual uno::Reference
<uno::XInterface
> init() override
;
45 virtual void setUp() override
;
47 CPPUNIT_TEST_SUITE(ScAutoFormatObj
);
50 CPPUNIT_TEST(testTableAutoFormatProperties
);
53 CPPUNIT_TEST(testGetElementType
);
54 CPPUNIT_TEST(testHasElements
);
57 CPPUNIT_TEST(testCreateEnumeration
);
60 CPPUNIT_TEST(testGetByIndex
);
61 CPPUNIT_TEST(testGetCount
);
64 CPPUNIT_TEST(testGetName
);
65 CPPUNIT_TEST(testSetName
);
68 CPPUNIT_TEST(testGetPropertySetInfo
);
69 CPPUNIT_TEST(testGetPropertyValue
);
70 CPPUNIT_TEST(testSetPropertyValue
);
71 CPPUNIT_TEST(testPropertyChangeListener
);
72 CPPUNIT_TEST(testVetoableChangeListener
);
75 CPPUNIT_TEST(testGetImplementationName
);
76 CPPUNIT_TEST(testGetSupportedServiceNames
);
77 CPPUNIT_TEST(testSupportsService
);
79 CPPUNIT_TEST_SUITE_END();
82 ScAutoFormatObj::ScAutoFormatObj()
83 : UnoApiTest(u
"/sc/qa/extras/testdocuments"_ustr
)
84 , XElementAccess(cppu::UnoType
<beans::XPropertySet
>::get())
86 , XNamed(u
"Default"_ustr
)
87 , XServiceInfo(u
"ScAutoFormatObj"_ustr
, u
"com.sun.star.sheet.TableAutoFormat"_ustr
)
91 uno::Reference
<uno::XInterface
> ScAutoFormatObj::init()
93 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(mxComponent
, uno::UNO_QUERY_THROW
);
95 uno::Reference
<lang::XMultiServiceFactory
> xMSF(xDoc
, uno::UNO_QUERY_THROW
);
96 uno::Reference
<container::XIndexAccess
> xIA(
97 xMSF
->createInstance(u
"com.sun.star.sheet.TableAutoFormats"_ustr
), uno::UNO_QUERY_THROW
);
99 uno::Reference
<beans::XPropertySet
> xTableAutoFormat(xIA
->getByIndex(xIA
->getCount() - 1),
100 uno::UNO_QUERY_THROW
);
101 return xTableAutoFormat
;
104 void ScAutoFormatObj::setUp()
107 loadFromURL(u
"private:factory/scalc"_ustr
);
110 CPPUNIT_TEST_SUITE_REGISTRATION(ScAutoFormatObj
);
112 } // namespace sc_apitest
114 CPPUNIT_PLUGIN_IMPLEMENT();
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */