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/xnamed.hxx>
13 #include <test/lang/xserviceinfo.hxx>
14 #include <test/table/tablecolumn.hxx>
15 #include <test/table/xcellrange.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/table/XColumnRowRange.hpp>
23 #include <com/sun/star/table/XTableColumns.hpp>
24 #include <com/sun/star/uno/XInterface.hpp>
26 #include <com/sun/star/uno/Reference.hxx>
32 class ScTableColumnObj
: public CalcUnoApiTest
,
33 public apitest::TableColumn
,
34 public apitest::XCellRange
,
35 public apitest::XNamed
,
36 public apitest::XPropertySet
,
37 public apitest::XServiceInfo
42 virtual uno::Reference
<uno::XInterface
> init() override
;
43 virtual void setUp() override
;
44 virtual void tearDown() override
;
46 CPPUNIT_TEST_SUITE(ScTableColumnObj
);
49 CPPUNIT_TEST(testTableColumnProperties
);
52 CPPUNIT_TEST(testGetCellByPosition
);
53 CPPUNIT_TEST(testGetCellRangeByName
);
54 CPPUNIT_TEST(testGetCellRangeByPosition
);
57 CPPUNIT_TEST(testGetName
);
58 // because TableColumnNames are fixed, test for an exception
59 CPPUNIT_TEST(testSetNameThrowsException
);
62 CPPUNIT_TEST(testGetPropertySetInfo
);
63 CPPUNIT_TEST(testGetPropertyValue
);
64 CPPUNIT_TEST(testSetPropertyValue
);
65 CPPUNIT_TEST(testPropertyChangeListener
);
66 CPPUNIT_TEST(testVetoableChangeListener
);
69 CPPUNIT_TEST(testGetImplementationName
);
70 CPPUNIT_TEST(testGetSupportedServiceNames
);
71 CPPUNIT_TEST(testSupportsService
);
73 CPPUNIT_TEST_SUITE_END();
76 uno::Reference
<lang::XComponent
> m_xComponent
;
79 ScTableColumnObj::ScTableColumnObj()
80 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
94 "ConditionalFormatLocal",
95 "ConditionalFormatXML",
112 "UserDefinedAttributes",
118 , XServiceInfo("ScTableColumnObj", "com.sun.star.table.TableColumn")
122 uno::Reference
<uno::XInterface
> ScTableColumnObj::init()
124 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(m_xComponent
, uno::UNO_QUERY_THROW
);
125 uno::Reference
<sheet::XSpreadsheets
> xSheets(xDoc
->getSheets(), uno::UNO_SET_THROW
);
126 uno::Reference
<container::XIndexAccess
> xIA(xSheets
, uno::UNO_QUERY_THROW
);
128 uno::Reference
<sheet::XSpreadsheet
> xSheet0(xIA
->getByIndex(0), uno::UNO_QUERY_THROW
);
129 setSpreadsheet(xSheet0
);
130 uno::Reference
<table::XColumnRowRange
> xCRR(xSheet0
, uno::UNO_QUERY_THROW
);
131 uno::Reference
<table::XTableColumns
> xTC(xCRR
->getColumns(), uno::UNO_SET_THROW
);
133 uno::Reference
<container::XIndexAccess
> xIA_TC(xTC
, uno::UNO_QUERY_THROW
);
134 uno::Reference
<uno::XInterface
> xReturn(xIA_TC
->getByIndex(10), uno::UNO_QUERY_THROW
);
138 void ScTableColumnObj::setUp()
140 CalcUnoApiTest::setUp();
141 // create calc document
142 m_xComponent
= loadFromDesktop("private:factory/scalc");
145 void ScTableColumnObj::tearDown()
147 closeDocument(m_xComponent
);
148 CalcUnoApiTest::tearDown();
151 CPPUNIT_TEST_SUITE_REGISTRATION(ScTableColumnObj
);
153 } // namespace sc_apitest
155 CPPUNIT_PLUGIN_IMPLEMENT();
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */