nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / extras / sctablecolumnobj.cxx
blob0dab1c6ab4172f5efaa7e85078f43430e0bef3b4
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/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>
28 using namespace css;
30 namespace sc_apitest
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
39 public:
40 ScTableColumnObj();
42 virtual uno::Reference<uno::XInterface> init() override;
43 virtual void setUp() override;
44 virtual void tearDown() override;
46 CPPUNIT_TEST_SUITE(ScTableColumnObj);
48 // TableColumn
49 CPPUNIT_TEST(testTableColumnProperties);
51 // XCellRange
52 CPPUNIT_TEST(testGetCellByPosition);
53 CPPUNIT_TEST(testGetCellRangeByName);
54 CPPUNIT_TEST(testGetCellRangeByPosition);
56 // XNamed
57 CPPUNIT_TEST(testGetName);
58 // because TableColumnNames are fixed, test for an exception
59 CPPUNIT_TEST(testSetNameThrowsException);
61 // XPropertySet
62 CPPUNIT_TEST(testGetPropertySetInfo);
63 CPPUNIT_TEST(testGetPropertyValue);
64 CPPUNIT_TEST(testSetPropertyValue);
65 CPPUNIT_TEST(testPropertyChangeListener);
66 CPPUNIT_TEST(testVetoableChangeListener);
68 // XServiceInfo
69 CPPUNIT_TEST(testGetImplementationName);
70 CPPUNIT_TEST(testGetSupportedServiceNames);
71 CPPUNIT_TEST(testSupportsService);
73 CPPUNIT_TEST_SUITE_END();
75 private:
76 uno::Reference<lang::XComponent> m_xComponent;
79 ScTableColumnObj::ScTableColumnObj()
80 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
81 , XCellRange("K1:K1")
82 , XNamed("K")
83 , XPropertySet({
84 "BottomBorder",
85 "BottomBorder2",
86 "CellProtection",
87 "CharLocale",
88 "CharLocaleAsian",
89 "CharLocaleComplex",
90 "CharPosture",
91 "CharPostureAsian",
92 "CharPostureComplex",
93 "ConditionalFormat",
94 "ConditionalFormatLocal",
95 "ConditionalFormatXML",
96 "DiagonalBLTR",
97 "DiagonalBLTR2",
98 "DiagonalTLBR",
99 "DiagonalTLBR2",
100 "HoriJustify",
101 "LeftBorder",
102 "LeftBorder2",
103 "NumberingRules",
104 "Orientation",
105 "RightBorder",
106 "RightBorder2",
107 "ShadowFormat",
108 "TableBorder",
109 "TableBorder2",
110 "TopBorder",
111 "TopBorder2",
112 "UserDefinedAttributes",
113 "Validation",
114 "ValidationLocal",
115 "ValidationXML",
116 "WritingMode",
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);
135 return xReturn;
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: */