vcl: move variables closer to first use in BitmapColorQuantizationFilter
[LibreOffice.git] / sc / qa / extras / scautoformatobj.cxx
blob57f9fcb3b875168f1d0ef5c80d5d69aaf159f280
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/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>
28 using namespace css;
30 namespace sc_apitest
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
41 public:
42 ScAutoFormatObj();
44 virtual uno::Reference<uno::XInterface> init() override;
45 virtual void setUp() override;
47 CPPUNIT_TEST_SUITE(ScAutoFormatObj);
49 // TableAutoFormat
50 CPPUNIT_TEST(testTableAutoFormatProperties);
52 // XElementAccess
53 CPPUNIT_TEST(testGetElementType);
54 CPPUNIT_TEST(testHasElements);
56 // XEnumerationAccess
57 CPPUNIT_TEST(testCreateEnumeration);
59 // XIndexAccess
60 CPPUNIT_TEST(testGetByIndex);
61 CPPUNIT_TEST(testGetCount);
63 // XNamed
64 CPPUNIT_TEST(testGetName);
65 CPPUNIT_TEST(testSetName);
67 // XPropertySet
68 CPPUNIT_TEST(testGetPropertySetInfo);
69 CPPUNIT_TEST(testGetPropertyValue);
70 CPPUNIT_TEST(testSetPropertyValue);
71 CPPUNIT_TEST(testPropertyChangeListener);
72 CPPUNIT_TEST(testVetoableChangeListener);
74 // XServiceInfo
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())
85 , XIndexAccess(16)
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()
106 UnoApiTest::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: */