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/container/xelementaccess.hxx>
12 #include <test/container/xenumerationaccess.hxx>
13 #include <test/container/xindexaccess.hxx>
15 #include <com/sun/star/container/XIndexAccess.hpp>
16 #include <com/sun/star/sheet/XSheetCellRangeContainer.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/sheet/XUniqueCellFormatRangesSupplier.hpp>
21 #include <com/sun/star/uno/XInterface.hpp>
23 #include <com/sun/star/uno/Reference.hxx>
25 #include <cppu/unotype.hxx>
28 using namespace css::uno
;
32 class ScUniqueCellFormatsObj
: public UnoApiTest
,
33 public apitest::XElementAccess
,
34 public apitest::XEnumerationAccess
,
35 public apitest::XIndexAccess
38 ScUniqueCellFormatsObj();
40 virtual uno::Reference
<uno::XInterface
> init() override
;
41 virtual void setUp() override
;
43 CPPUNIT_TEST_SUITE(ScUniqueCellFormatsObj
);
46 CPPUNIT_TEST(testGetElementType
);
47 CPPUNIT_TEST(testHasElements
);
50 CPPUNIT_TEST(testCreateEnumeration
);
53 CPPUNIT_TEST(testGetByIndex
);
54 CPPUNIT_TEST(testGetCount
);
56 CPPUNIT_TEST_SUITE_END();
59 ScUniqueCellFormatsObj::ScUniqueCellFormatsObj()
60 : UnoApiTest(u
"/sc/qa/extras/testdocuments"_ustr
)
61 , XElementAccess(cppu::UnoType
<sheet::XSheetCellRangeContainer
>::get())
66 uno::Reference
<uno::XInterface
> ScUniqueCellFormatsObj::init()
68 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(mxComponent
, uno::UNO_QUERY_THROW
);
69 CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc
.is());
71 uno::Reference
<sheet::XSpreadsheets
> xSheets(xDoc
->getSheets(), uno::UNO_SET_THROW
);
72 uno::Reference
<container::XIndexAccess
> xIA(xSheets
, uno::UNO_QUERY_THROW
);
73 uno::Reference
<sheet::XSpreadsheet
> xSheet0(xIA
->getByIndex(0), uno::UNO_QUERY_THROW
);
75 uno::Reference
<sheet::XUniqueCellFormatRangesSupplier
> xUCFRS(xSheet0
, uno::UNO_QUERY_THROW
);
76 return xUCFRS
->getUniqueCellFormatRanges();
79 void ScUniqueCellFormatsObj::setUp()
82 loadFromURL(u
"private:factory/scalc"_ustr
);
85 CPPUNIT_TEST_SUITE_REGISTRATION(ScUniqueCellFormatsObj
);
86 } // namespace sc_apitest
88 CPPUNIT_PLUGIN_IMPLEMENT();
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */