nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / extras / scindexenumeration_tablecolumnsenumeration.cxx
blob10f1b129be6190306a2192ced40af2314c14eb36
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/XNameAccess.hpp>
15 #include <com/sun/star/lang/XComponent.hpp>
16 #include <com/sun/star/sheet/XSpreadsheet.hpp>
17 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
18 #include <com/sun/star/sheet/XSpreadsheets.hpp>
19 #include <com/sun/star/table/XColumnRowRange.hpp>
20 #include <com/sun/star/table/XTableColumns.hpp>
21 #include <com/sun/star/uno/XInterface.hpp>
23 #include <com/sun/star/uno/Reference.hxx>
25 using namespace css;
26 using namespace css::uno;
28 namespace sc_apitest
30 class ScIndexEnumeration_TableColumnsEnumeration : public CalcUnoApiTest,
31 public apitest::XEnumeration
33 public:
34 ScIndexEnumeration_TableColumnsEnumeration();
36 virtual uno::Reference<uno::XInterface> init() override;
37 virtual void setUp() override;
38 virtual void tearDown() override;
40 CPPUNIT_TEST_SUITE(ScIndexEnumeration_TableColumnsEnumeration);
42 // XEnumeration
43 CPPUNIT_TEST(testHasMoreElements);
44 CPPUNIT_TEST(testNextElement);
46 CPPUNIT_TEST_SUITE_END();
48 private:
49 uno::Reference<lang::XComponent> m_xComponent;
52 ScIndexEnumeration_TableColumnsEnumeration::ScIndexEnumeration_TableColumnsEnumeration()
53 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
57 uno::Reference<uno::XInterface> ScIndexEnumeration_TableColumnsEnumeration::init()
59 uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
60 CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
62 uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_SET_THROW);
63 uno::Reference<container::XNameAccess> xNA(xSheets, uno::UNO_QUERY_THROW);
64 uno::Reference<sheet::XSpreadsheet> xSheet0(xNA->getByName(xNA->getElementNames()[0]),
65 uno::UNO_QUERY_THROW);
67 uno::Reference<table::XColumnRowRange> xColumnRowRange(xSheet0, uno::UNO_QUERY_THROW);
68 uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns(),
69 uno::UNO_SET_THROW);
70 uno::Reference<container::XEnumerationAccess> xEA(xTableColumns, uno::UNO_QUERY_THROW);
72 return xEA->createEnumeration();
75 void ScIndexEnumeration_TableColumnsEnumeration::setUp()
77 CalcUnoApiTest::setUp();
78 m_xComponent = loadFromDesktop("private:factory/scalc");
79 CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent.is());
82 void ScIndexEnumeration_TableColumnsEnumeration::tearDown()
84 closeDocument(m_xComponent);
85 CalcUnoApiTest::tearDown();
88 CPPUNIT_TEST_SUITE_REGISTRATION(ScIndexEnumeration_TableColumnsEnumeration);
90 } // namespace sc_apitest
92 CPPUNIT_PLUGIN_IMPLEMENT();
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */