Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / qa / extras / scautoformatobj.cxx
blobba28fdf6c2170b080469ba813003c228c4b40dd9
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/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>
29 using namespace css;
31 namespace sc_apitest
33 class ScAutoFormatObj : public UnoApiTest,
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
42 public:
43 ScAutoFormatObj();
45 virtual uno::Reference<uno::XInterface> init() override;
46 virtual void setUp() override;
48 CPPUNIT_TEST_SUITE(ScAutoFormatObj);
50 // TableAutoFormat
51 CPPUNIT_TEST(testTableAutoFormatProperties);
53 // XElementAccess
54 CPPUNIT_TEST(testGetElementType);
55 CPPUNIT_TEST(testHasElements);
57 // XEnumerationAccess
58 CPPUNIT_TEST(testCreateEnumeration);
60 // XIndexAccess
61 CPPUNIT_TEST(testGetByIndex);
62 CPPUNIT_TEST(testGetCount);
64 // XNamed
65 CPPUNIT_TEST(testGetName);
66 CPPUNIT_TEST(testSetName);
68 // XPropertySet
69 CPPUNIT_TEST(testGetPropertySetInfo);
70 CPPUNIT_TEST(testGetPropertyValue);
71 CPPUNIT_TEST(testSetPropertyValue);
72 CPPUNIT_TEST(testPropertyChangeListener);
73 CPPUNIT_TEST(testVetoableChangeListener);
75 // XServiceInfo
76 CPPUNIT_TEST(testGetImplementationName);
77 CPPUNIT_TEST(testGetSupportedServiceNames);
78 CPPUNIT_TEST(testSupportsService);
80 CPPUNIT_TEST_SUITE_END();
83 ScAutoFormatObj::ScAutoFormatObj()
84 : UnoApiTest("/sc/qa/extras/testdocuments")
85 , XElementAccess(cppu::UnoType<beans::XPropertySet>::get())
86 , XIndexAccess(16)
87 , XNamed("Default")
88 , XServiceInfo("ScAutoFormatObj", "com.sun.star.sheet.TableAutoFormat")
92 uno::Reference<uno::XInterface> ScAutoFormatObj::init()
94 uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
96 uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, uno::UNO_QUERY_THROW);
97 uno::Reference<container::XIndexAccess> xIA(
98 xMSF->createInstance("com.sun.star.sheet.TableAutoFormats"), uno::UNO_QUERY_THROW);
100 uno::Reference<beans::XPropertySet> xTableAutoFormat(xIA->getByIndex(xIA->getCount() - 1),
101 uno::UNO_QUERY_THROW);
102 return xTableAutoFormat;
105 void ScAutoFormatObj::setUp()
107 UnoApiTest::setUp();
108 mxComponent = loadFromDesktop("private:factory/scalc");
111 CPPUNIT_TEST_SUITE_REGISTRATION(ScAutoFormatObj);
113 } // namespace sc_apitest
115 CPPUNIT_PLUGIN_IMPLEMENT();
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */