Revert "tdf#158280 Replace usage of InputDialog with SvxNameDialog"
[LibreOffice.git] / sc / qa / extras / sctablerowobj.cxx
blob2a57224c9eec7f0f930e9826f01262a6995bf3ee
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/lang/xserviceinfo.hxx>
13 #include <test/table/tablerow.hxx>
14 #include <test/table/xcellrange.hxx>
16 #include <com/sun/star/container/XIndexAccess.hpp>
17 #include <com/sun/star/sheet/XSpreadsheet.hpp>
18 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
19 #include <com/sun/star/sheet/XSpreadsheets.hpp>
20 #include <com/sun/star/table/XColumnRowRange.hpp>
21 #include <com/sun/star/table/XTableRows.hpp>
22 #include <com/sun/star/uno/XInterface.hpp>
24 #include <com/sun/star/uno/Reference.hxx>
26 using namespace css;
28 namespace sc_apitest
30 class ScTableRowObj : public UnoApiTest,
31 public apitest::TableRow,
32 public apitest::XCellRange,
33 public apitest::XPropertySet,
34 public apitest::XServiceInfo
36 public:
37 ScTableRowObj();
39 virtual uno::Reference<uno::XInterface> init() override;
40 virtual void setUp() override;
42 CPPUNIT_TEST_SUITE(ScTableRowObj);
44 // TableRow
45 CPPUNIT_TEST(testTableRowProperties);
47 // XCellRange
48 CPPUNIT_TEST(testGetCellByPosition);
49 CPPUNIT_TEST(testGetCellRangeByName);
50 CPPUNIT_TEST(testGetCellRangeByPosition);
52 // XPropertySet
53 CPPUNIT_TEST(testGetPropertySetInfo);
54 CPPUNIT_TEST(testGetPropertyValue);
55 CPPUNIT_TEST(testSetPropertyValue);
56 CPPUNIT_TEST(testPropertyChangeListener);
57 CPPUNIT_TEST(testVetoableChangeListener);
59 // XServiceInfo
60 CPPUNIT_TEST(testGetImplementationName);
61 CPPUNIT_TEST(testGetSupportedServiceNames);
62 CPPUNIT_TEST(testSupportsService);
64 CPPUNIT_TEST_SUITE_END();
67 ScTableRowObj::ScTableRowObj()
68 : UnoApiTest(u"/sc/qa/extras/testdocuments"_ustr)
69 , XCellRange(u"A7:A7"_ustr)
70 , XPropertySet({ u"BottomBorder"_ustr,
71 u"BottomBorder2"_ustr,
72 u"BottomBorderComplexColor"_ustr,
73 u"CellProtection"_ustr,
74 u"CharLocale"_ustr,
75 u"CharLocaleAsian"_ustr,
76 u"CharLocaleComplex"_ustr,
77 u"CharPosture"_ustr,
78 u"CharPostureAsian"_ustr,
79 u"CharPostureComplex"_ustr,
80 u"ConditionalFormat"_ustr,
81 u"ConditionalFormatLocal"_ustr,
82 u"ConditionalFormatXML"_ustr,
83 u"DiagonalBLTR"_ustr,
84 u"DiagonalBLTR2"_ustr,
85 u"DiagonalTLBR"_ustr,
86 u"DiagonalTLBR2"_ustr,
87 u"HoriJustify"_ustr,
88 u"LeftBorder"_ustr,
89 u"LeftBorder2"_ustr,
90 u"LeftBorderComplexColor"_ustr,
91 u"NumberingRules"_ustr,
92 u"Orientation"_ustr,
93 u"RightBorder"_ustr,
94 u"RightBorder2"_ustr,
95 u"RightBorderComplexColor"_ustr,
96 u"ShadowFormat"_ustr,
97 u"TableBorder"_ustr,
98 u"TableBorder2"_ustr,
99 u"TopBorder"_ustr,
100 u"TopBorder2"_ustr,
101 u"TopBorderComplexColor"_ustr,
102 u"UserDefinedAttributes"_ustr,
103 u"Validation"_ustr,
104 u"ValidationLocal"_ustr,
105 u"ValidationXML"_ustr,
106 u"WritingMode"_ustr })
107 , XServiceInfo(u"ScTableRowObj"_ustr, u"com.sun.star.table.TableRow"_ustr)
111 uno::Reference<uno::XInterface> ScTableRowObj::init()
113 uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
114 uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_SET_THROW);
115 uno::Reference<container::XIndexAccess> xIA(xSheets, uno::UNO_QUERY_THROW);
117 uno::Reference<sheet::XSpreadsheet> xSheet0(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
118 uno::Reference<table::XColumnRowRange> xCRR(xSheet0, uno::UNO_QUERY_THROW);
119 uno::Reference<table::XTableRows> xTR(xCRR->getRows(), uno::UNO_SET_THROW);
121 uno::Reference<container::XIndexAccess> xIA_TR(xTR, uno::UNO_QUERY_THROW);
122 uno::Reference<uno::XInterface> xReturn(xIA_TR->getByIndex(6), uno::UNO_QUERY_THROW);
123 return xReturn;
126 void ScTableRowObj::setUp()
128 UnoApiTest::setUp();
129 // create calc document
130 loadFromURL(u"private:factory/scalc"_ustr);
133 CPPUNIT_TEST_SUITE_REGISTRATION(ScTableRowObj);
135 } // namespace sc_apitest
137 CPPUNIT_PLUGIN_IMPLEMENT();
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */