nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / extras / scuniquecellformatsobj.cxx
blob6921ec55c1316cac23fe816b7467e5ec7a69baa1
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/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/lang/XComponent.hpp>
17 #include <com/sun/star/sheet/XSheetCellRangeContainer.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/sheet/XUniqueCellFormatRangesSupplier.hpp>
22 #include <com/sun/star/uno/XInterface.hpp>
24 #include <com/sun/star/uno/Reference.hxx>
26 #include <cppu/unotype.hxx>
28 using namespace css;
29 using namespace css::uno;
31 namespace sc_apitest
33 class ScUniqueCellFormatsObj : public CalcUnoApiTest,
34 public apitest::XElementAccess,
35 public apitest::XEnumerationAccess,
36 public apitest::XIndexAccess
38 public:
39 ScUniqueCellFormatsObj();
41 virtual uno::Reference<uno::XInterface> init() override;
42 virtual void setUp() override;
43 virtual void tearDown() override;
45 CPPUNIT_TEST_SUITE(ScUniqueCellFormatsObj);
47 // XElementAccess
48 CPPUNIT_TEST(testGetElementType);
49 CPPUNIT_TEST(testHasElements);
51 // XEnumerationAccess
52 CPPUNIT_TEST(testCreateEnumeration);
54 // XIndexAccess
55 CPPUNIT_TEST(testGetByIndex);
56 CPPUNIT_TEST(testGetCount);
58 CPPUNIT_TEST_SUITE_END();
60 private:
61 uno::Reference<lang::XComponent> m_xComponent;
64 ScUniqueCellFormatsObj::ScUniqueCellFormatsObj()
65 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
66 , XElementAccess(cppu::UnoType<sheet::XSheetCellRangeContainer>::get())
67 , XIndexAccess(1)
71 uno::Reference<uno::XInterface> ScUniqueCellFormatsObj::init()
73 uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
74 CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
76 uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_SET_THROW);
77 uno::Reference<container::XIndexAccess> xIA(xSheets, uno::UNO_QUERY_THROW);
78 uno::Reference<sheet::XSpreadsheet> xSheet0(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
80 uno::Reference<sheet::XUniqueCellFormatRangesSupplier> xUCFRS(xSheet0, uno::UNO_QUERY_THROW);
81 return xUCFRS->getUniqueCellFormatRanges();
84 void ScUniqueCellFormatsObj::setUp()
86 CalcUnoApiTest::setUp();
87 m_xComponent = loadFromDesktop("private:factory/scalc");
88 CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent.is());
91 void ScUniqueCellFormatsObj::tearDown()
93 closeDocument(m_xComponent);
94 CalcUnoApiTest::tearDown();
97 CPPUNIT_TEST_SUITE_REGISTRATION(ScUniqueCellFormatsObj);
98 } // namespace sc_apitest
100 CPPUNIT_PLUGIN_IMPLEMENT();
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */