1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/sheet/sheetcellrange.hxx>
12 #include <test/sheet/xarrayformularange.hxx>
13 #include <test/sheet/xcellformatrangessupplier.hxx>
14 #include <test/sheet/xcellrangeaddressable.hxx>
15 #include <test/sheet/xcellrangedata.hxx>
16 #include <test/sheet/xcellrangeformula.hxx>
17 #include <test/sheet/xcellseries.hxx>
18 #include <test/sheet/xformulaquery.hxx>
19 #include <test/sheet/xmultipleoperation.hxx>
20 #include <test/sheet/xsheetcellcursor.hxx>
21 #include <test/sheet/xsheetcellrange.hxx>
22 #include <test/sheet/xsheetfilterable.hxx>
23 #include <test/sheet/xsheetfilterableex.hxx>
24 #include <test/sheet/xsheetoperation.hxx>
25 #include <test/sheet/xsubtotalcalculatable.hxx>
26 #include <test/sheet/xuniquecellformatrangessupplier.hxx>
27 #include <test/sheet/xusedareacursor.hxx>
28 #include <test/table/xcellcursor.hxx>
29 #include <test/table/xcolumnrowrange.hxx>
30 #include <test/util/xindent.hxx>
31 #include <test/util/xmergeable.hxx>
33 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
34 #include <com/sun/star/sheet/XSpreadsheet.hpp>
35 #include <com/sun/star/table/XCellCursor.hpp>
38 using namespace css::uno
;
40 namespace sc_apitest
{
42 class ScCellCursorObj
: public CalcUnoApiTest
, public apitest::SheetCellRange
,
43 public apitest::XArrayFormulaRange
,
44 public apitest::XCellCursor
,
45 public apitest::XCellFormatRangesSupplier
,
46 public apitest::XCellRangeAddressable
,
47 public apitest::XCellRangeData
,
48 public apitest::XCellRangeFormula
,
49 public apitest::XCellSeries
,
50 public apitest::XColumnRowRange
,
51 public apitest::XFormulaQuery
,
52 public apitest::XIndent
,
53 public apitest::XMergeable
,
54 public apitest::XMultipleOperation
,
55 public apitest::XSheetCellCursor
,
56 public apitest::XSheetCellRange
,
57 public apitest::XSheetFilterable
,
58 public apitest::XSheetFilterableEx
,
59 public apitest::XSheetOperation
,
60 public apitest::XSubTotalCalculatable
,
61 public apitest::XUniqueCellFormatRangesSupplier
,
62 public apitest::XUsedAreaCursor
67 virtual void setUp() override
;
68 virtual void tearDown() override
;
69 virtual uno::Reference
< uno::XInterface
> init() override
;
70 virtual uno::Reference
< uno::XInterface
> getXCellRangeData() override
;
71 virtual uno::Reference
< uno::XInterface
> getXSpreadsheet() override
;
73 CPPUNIT_TEST_SUITE(ScCellCursorObj
);
76 CPPUNIT_TEST(testSheetCellRangeProperties
);
79 CPPUNIT_TEST(testGetSetArrayFormula
);
82 CPPUNIT_TEST(testGoToNext
);
83 CPPUNIT_TEST(testGoToOffset
);
84 CPPUNIT_TEST(testGoToPrevious
);
85 CPPUNIT_TEST(testGoToStart
);
86 CPPUNIT_TEST(testGoToEnd
);
88 // XCellFormatRangesSupplier
89 CPPUNIT_TEST(testGetCellFormatRanges
);
91 // XCellRangeAddressable
92 CPPUNIT_TEST(testGetRangeAddress
);
95 CPPUNIT_TEST(testGetDataArray
);
96 CPPUNIT_TEST(testSetDataArray
);
99 CPPUNIT_TEST(testGetSetFormulaArray
);
102 CPPUNIT_TEST(testFillAuto
);
103 CPPUNIT_TEST(testFillSeries
);
106 CPPUNIT_TEST(testGetColumns
);
107 CPPUNIT_TEST(testGetRows
);
110 CPPUNIT_TEST(testQueryDependents
);
111 CPPUNIT_TEST(testQueryPrecedents
);
114 CPPUNIT_TEST(testIncrementIndent
);
115 CPPUNIT_TEST(testDecrementIndent
);
118 CPPUNIT_TEST(testGetIsMergedMerge
);
120 // XMultipleOperation
121 CPPUNIT_TEST(testSetTableOperation
);
124 CPPUNIT_TEST(testCollapseToCurrentArray
);
125 CPPUNIT_TEST(testCollapseToCurrentRegion
);
126 CPPUNIT_TEST(testCollapseToMergedArea
);
127 CPPUNIT_TEST(testCollapseToSize
);
128 CPPUNIT_TEST(testExpandToEntireColumns
);
129 CPPUNIT_TEST(testExpandToEntireRows
);
132 CPPUNIT_TEST(testGetSpreadsheet
);
135 CPPUNIT_TEST(testCreateFilterDescriptor
);
136 CPPUNIT_TEST(testFilter
);
138 // XSheetFilterableEx
139 CPPUNIT_TEST(testCreateFilterDescriptorByObject
);
142 CPPUNIT_TEST(testComputeFunction
);
143 CPPUNIT_TEST(testClearContents
);
145 // XSubTotalCalculatable
146 CPPUNIT_TEST(testCreateSubTotalDescriptor
);
147 CPPUNIT_TEST(testApplyRemoveSubTotals
);
150 CPPUNIT_TEST(testGotoStartOfUsedArea
);
151 CPPUNIT_TEST(testGotoEndOfUsedArea
);
153 // XUniqueCellFormatRangesSupplier
154 CPPUNIT_TEST(testGetUniqueCellFormatRanges
);
156 CPPUNIT_TEST_SUITE_END();
159 uno::Reference
< lang::XComponent
> mxComponent
;
162 ScCellCursorObj::ScCellCursorObj():
163 CalcUnoApiTest("/sc/qa/extras/testdocuments"),
164 apitest::XCellSeries(0, 0),
165 apitest::XFormulaQuery(table::CellRangeAddress(0, 15, 15, 15, 15), table::CellRangeAddress(0, 0, 15, 0, 15))
169 uno::Reference
< uno::XInterface
> ScCellCursorObj::init()
171 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(mxComponent
, UNO_QUERY_THROW
);
173 uno::Reference
<container::XIndexAccess
> xIndex (xDoc
->getSheets(), UNO_QUERY_THROW
);
174 uno::Reference
<sheet::XSpreadsheet
> xSheet(xIndex
->getByIndex(0), UNO_QUERY_THROW
);
176 uno::Reference
<table::XCellRange
> xCellRange
= xSheet
->getCellRangeByName("$A$1:$D$4");
177 uno::Reference
<sheet::XSheetCellRange
> xSheetCellRange(xCellRange
, UNO_QUERY_THROW
);
178 uno::Reference
<table::XCellCursor
> xCellCursor(xSheet
->createCursorByRange(xSheetCellRange
), UNO_QUERY_THROW
);
180 xSheet
->getCellByPosition(1, 1)->setValue(1);
181 xSheet
->getCellByPosition(4, 5)->setValue(1);
182 xSheet
->getCellByPosition(3, 2)->setFormula("xTextDoc");
183 xSheet
->getCellByPosition(3, 3)->setFormula("xTextDoc");
188 uno::Reference
< uno::XInterface
> ScCellCursorObj::getXCellRangeData()
193 uno::Reference
< uno::XInterface
> ScCellCursorObj::getXSpreadsheet()
195 uno::Reference
< sheet::XSpreadsheetDocument
> xDoc(mxComponent
, UNO_QUERY_THROW
);
197 uno::Reference
< container::XIndexAccess
> xIndex (xDoc
->getSheets(), UNO_QUERY_THROW
);
198 uno::Reference
< sheet::XSpreadsheet
> xSheet( xIndex
->getByIndex(0), UNO_QUERY_THROW
);
200 setXCell(xSheet
->getCellByPosition(15, 15));
205 void ScCellCursorObj::setUp()
207 CalcUnoApiTest::setUp();
210 createFileURL("ScCellCursorObj.ods", aFileURL
);
211 mxComponent
= loadFromDesktop(aFileURL
, "com.sun.star.sheet.SpreadsheetDocument");
214 void ScCellCursorObj::tearDown()
216 closeDocument(mxComponent
);
217 CalcUnoApiTest::tearDown();
220 CPPUNIT_TEST_SUITE_REGISTRATION(ScCellCursorObj
);
224 CPPUNIT_PLUGIN_IMPLEMENT();
226 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */