nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / extras / sccellformatsenumeration.cxx
blob93e07be162b210424f6a772dbc1216b0a638ee34
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/xenumeration.hxx>
13 #include <com/sun/star/container/XEnumerationAccess.hpp>
14 #include <com/sun/star/container/XIndexAccess.hpp>
15 #include <com/sun/star/lang/XComponent.hpp>
16 #include <com/sun/star/sheet/XCellFormatRangesSupplier.hpp>
17 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
18 #include <com/sun/star/sheet/XSpreadsheet.hpp>
19 #include <com/sun/star/sheet/XSpreadsheets.hpp>
20 #include <com/sun/star/uno/XInterface.hpp>
22 #include <com/sun/star/uno/Reference.hxx>
24 using namespace css;
25 using namespace css::uno;
27 namespace sc_apitest
29 class ScCellFormatsEnumeration : public CalcUnoApiTest, public apitest::XEnumeration
31 public:
32 ScCellFormatsEnumeration();
34 virtual uno::Reference<uno::XInterface> init() override;
35 virtual void setUp() override;
36 virtual void tearDown() override;
38 CPPUNIT_TEST_SUITE(ScCellFormatsEnumeration);
40 // XEnumeration
41 CPPUNIT_TEST(testHasMoreElements);
42 CPPUNIT_TEST(testNextElement);
44 CPPUNIT_TEST_SUITE_END();
46 private:
47 uno::Reference<lang::XComponent> m_xComponent;
50 ScCellFormatsEnumeration::ScCellFormatsEnumeration()
51 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
55 uno::Reference<uno::XInterface> ScCellFormatsEnumeration::init()
57 uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
58 CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
60 uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_SET_THROW);
61 uno::Reference<container::XIndexAccess> xIA(xSheets, uno::UNO_QUERY_THROW);
62 uno::Reference<sheet::XSpreadsheet> xSheet0(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
64 uno::Reference<sheet::XCellFormatRangesSupplier> xCFRS(xSheet0, uno::UNO_QUERY_THROW);
65 uno::Reference<container::XIndexAccess> xIA_CFR(xCFRS->getCellFormatRanges(),
66 uno::UNO_SET_THROW);
67 uno::Reference<container::XEnumerationAccess> xEA(xIA_CFR, uno::UNO_QUERY_THROW);
69 return xEA->createEnumeration();
72 void ScCellFormatsEnumeration::setUp()
74 CalcUnoApiTest::setUp();
75 m_xComponent = loadFromDesktop("private:factory/scalc");
76 CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent.is());
79 void ScCellFormatsEnumeration::tearDown()
81 closeDocument(m_xComponent);
82 CalcUnoApiTest::tearDown();
85 CPPUNIT_TEST_SUITE_REGISTRATION(ScCellFormatsEnumeration);
87 } // namespace sc_apitest
89 CPPUNIT_PLUGIN_IMPLEMENT();
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */