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/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/sheet/XSpreadsheet.hpp>
19 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
20 #include <com/sun/star/sheet/XSpreadsheets.hpp>
21 #include <com/sun/star/table/XColumnRowRange.hpp>
22 #include <com/sun/star/table/XTableColumns.hpp>
23 #include <com/sun/star/uno/XInterface.hpp>
25 #include <com/sun/star/uno/Reference.hxx>
31 class ScTableColumnObj
: public UnoApiTest
,
32 public apitest::TableColumn
,
33 public apitest::XCellRange
,
34 public apitest::XNamed
,
35 public apitest::XPropertySet
,
36 public apitest::XServiceInfo
41 virtual uno::Reference
<uno::XInterface
> init() override
;
42 virtual void setUp() override
;
44 CPPUNIT_TEST_SUITE(ScTableColumnObj
);
47 CPPUNIT_TEST(testTableColumnProperties
);
50 CPPUNIT_TEST(testGetCellByPosition
);
51 CPPUNIT_TEST(testGetCellRangeByName
);
52 CPPUNIT_TEST(testGetCellRangeByPosition
);
55 CPPUNIT_TEST(testGetName
);
56 // because TableColumnNames are fixed, test for an exception
57 CPPUNIT_TEST(testSetNameThrowsException
);
60 CPPUNIT_TEST(testGetPropertySetInfo
);
61 CPPUNIT_TEST(testGetPropertyValue
);
62 CPPUNIT_TEST(testSetPropertyValue
);
63 CPPUNIT_TEST(testPropertyChangeListener
);
64 CPPUNIT_TEST(testVetoableChangeListener
);
67 CPPUNIT_TEST(testGetImplementationName
);
68 CPPUNIT_TEST(testGetSupportedServiceNames
);
69 CPPUNIT_TEST(testSupportsService
);
71 CPPUNIT_TEST_SUITE_END();
74 ScTableColumnObj::ScTableColumnObj()
75 : UnoApiTest(u
"/sc/qa/extras/testdocuments"_ustr
)
76 , XCellRange(u
"K1:K1"_ustr
)
80 u
"BottomBorder2"_ustr
,
81 u
"BottomBorderComplexColor"_ustr
,
82 u
"CellProtection"_ustr
,
84 u
"CharLocaleAsian"_ustr
,
85 u
"CharLocaleComplex"_ustr
,
87 u
"CharPostureAsian"_ustr
,
88 u
"CharPostureComplex"_ustr
,
89 u
"ConditionalFormat"_ustr
,
90 u
"ConditionalFormatLocal"_ustr
,
91 u
"ConditionalFormatXML"_ustr
,
93 u
"DiagonalBLTR2"_ustr
,
95 u
"DiagonalTLBR2"_ustr
,
99 u
"LeftBorderComplexColor"_ustr
,
100 u
"NumberingRules"_ustr
,
103 u
"RightBorder2"_ustr
,
104 u
"RightBorderComplexColor"_ustr
,
105 u
"ShadowFormat"_ustr
,
107 u
"TableBorder2"_ustr
,
110 u
"TopBorderComplexColor"_ustr
,
111 u
"UserDefinedAttributes"_ustr
,
113 u
"ValidationLocal"_ustr
,
114 u
"ValidationXML"_ustr
,
117 , XServiceInfo(u
"ScTableColumnObj"_ustr
, u
"com.sun.star.table.TableColumn"_ustr
)
121 uno::Reference
<uno::XInterface
> ScTableColumnObj::init()
123 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(mxComponent
, uno::UNO_QUERY_THROW
);
124 uno::Reference
<sheet::XSpreadsheets
> xSheets(xDoc
->getSheets(), uno::UNO_SET_THROW
);
125 uno::Reference
<container::XIndexAccess
> xIA(xSheets
, uno::UNO_QUERY_THROW
);
127 uno::Reference
<sheet::XSpreadsheet
> xSheet0(xIA
->getByIndex(0), uno::UNO_QUERY_THROW
);
128 setSpreadsheet(xSheet0
);
129 uno::Reference
<table::XColumnRowRange
> xCRR(xSheet0
, uno::UNO_QUERY_THROW
);
130 uno::Reference
<table::XTableColumns
> xTC(xCRR
->getColumns(), uno::UNO_SET_THROW
);
132 uno::Reference
<container::XIndexAccess
> xIA_TC(xTC
, uno::UNO_QUERY_THROW
);
133 uno::Reference
<uno::XInterface
> xReturn(xIA_TC
->getByIndex(10), uno::UNO_QUERY_THROW
);
137 void ScTableColumnObj::setUp()
140 // create calc document
141 loadFromURL(u
"private:factory/scalc"_ustr
);
144 CPPUNIT_TEST_SUITE_REGISTRATION(ScTableColumnObj
);
146 } // namespace sc_apitest
148 CPPUNIT_PLUGIN_IMPLEMENT();
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */