Revert "Revert "Revert "stronger typing for SwClient::GetRegisteredIn"" and fix SwIte...
[LibreOffice.git] / sc / qa / extras / scindexenumeration_spreadsheetviewpanesenumeration.cxx
blobb89f477d575b579845ef1c7ed5fc77567bb64c4e
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/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/frame/XController.hpp>
16 #include <com/sun/star/frame/XModel.hpp>
17 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
18 #include <com/sun/star/uno/XInterface.hpp>
20 #include <com/sun/star/uno/Reference.hxx>
22 using namespace css;
23 using namespace css::uno;
25 namespace sc_apitest
27 class ScIndexEnumeration_SpreadsheetViewPanesEnumeration : public UnoApiTest,
28 public apitest::XEnumeration
30 public:
31 ScIndexEnumeration_SpreadsheetViewPanesEnumeration();
33 virtual uno::Reference<uno::XInterface> init() override;
34 virtual void setUp() override;
36 CPPUNIT_TEST_SUITE(ScIndexEnumeration_SpreadsheetViewPanesEnumeration);
38 // XEnumeration
39 CPPUNIT_TEST(testHasMoreElements);
40 CPPUNIT_TEST(testNextElement);
42 CPPUNIT_TEST_SUITE_END();
45 ScIndexEnumeration_SpreadsheetViewPanesEnumeration::
46 ScIndexEnumeration_SpreadsheetViewPanesEnumeration()
47 : UnoApiTest(u"/sc/qa/extras/testdocuments"_ustr)
51 uno::Reference<uno::XInterface> ScIndexEnumeration_SpreadsheetViewPanesEnumeration::init()
53 uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
54 CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
56 uno::Reference<frame::XModel> xModel(xDoc, uno::UNO_QUERY_THROW);
57 uno::Reference<frame::XController> xController(xModel->getCurrentController(),
58 uno::UNO_SET_THROW);
59 uno::Reference<container::XIndexAccess> xIA(xController, uno::UNO_QUERY_THROW);
60 xIA->getByIndex(0);
62 uno::Reference<container::XEnumerationAccess> xEA(xIA, uno::UNO_QUERY_THROW);
64 return xEA->createEnumeration();
67 void ScIndexEnumeration_SpreadsheetViewPanesEnumeration::setUp()
69 UnoApiTest::setUp();
70 loadFromURL(u"private:factory/scalc"_ustr);
73 CPPUNIT_TEST_SUITE_REGISTRATION(ScIndexEnumeration_SpreadsheetViewPanesEnumeration);
75 } // namespace sc_apitest
77 CPPUNIT_PLUGIN_IMPLEMENT();
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */