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/calc_unoapi_test.hxx>
11 #include <test/container/xenumeration.hxx>
13 #include <com/sun/star/beans/XPropertySet.hpp>
14 #include <com/sun/star/container/XEnumerationAccess.hpp>
15 #include <com/sun/star/lang/XComponent.hpp>
16 #include <com/sun/star/sheet/XAreaLinks.hpp>
17 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
18 #include <com/sun/star/table/CellAddress.hpp>
19 #include <com/sun/star/uno/XInterface.hpp>
21 #include <com/sun/star/uno/Reference.hxx>
24 using namespace css::uno
;
28 class ScIndexEnumeration_CellAreaLinksEnumeration
: public CalcUnoApiTest
,
29 public apitest::XEnumeration
32 ScIndexEnumeration_CellAreaLinksEnumeration();
34 virtual uno::Reference
<uno::XInterface
> init() override
;
35 virtual void setUp() override
;
36 virtual void tearDown() override
;
38 CPPUNIT_TEST_SUITE(ScIndexEnumeration_CellAreaLinksEnumeration
);
41 CPPUNIT_TEST(testHasMoreElements
);
42 CPPUNIT_TEST(testNextElement
);
44 CPPUNIT_TEST_SUITE_END();
47 uno::Reference
<lang::XComponent
> m_xComponent
;
50 ScIndexEnumeration_CellAreaLinksEnumeration::ScIndexEnumeration_CellAreaLinksEnumeration()
51 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
55 uno::Reference
<uno::XInterface
> ScIndexEnumeration_CellAreaLinksEnumeration::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
<beans::XPropertySet
> xPropertySet(xDoc
, uno::UNO_QUERY_THROW
);
61 uno::Reference
<sheet::XAreaLinks
> xAL
;
62 CPPUNIT_ASSERT(xPropertySet
->getPropertyValue("AreaLinks") >>= xAL
);
63 xAL
->insertAtPosition(table::CellAddress(1, 2, 3),
64 "ScIndexEnumeration_CellAreaLinksEnumeration.ods", "A2:B5", "", "");
66 uno::Reference
<container::XEnumerationAccess
> xEA(xAL
, uno::UNO_QUERY_THROW
);
68 return xEA
->createEnumeration();
71 void ScIndexEnumeration_CellAreaLinksEnumeration::setUp()
73 CalcUnoApiTest::setUp();
74 m_xComponent
= loadFromDesktop("private:factory/scalc");
75 CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent
.is());
78 void ScIndexEnumeration_CellAreaLinksEnumeration::tearDown()
80 closeDocument(m_xComponent
);
81 CalcUnoApiTest::tearDown();
84 CPPUNIT_TEST_SUITE_REGISTRATION(ScIndexEnumeration_CellAreaLinksEnumeration
);
86 } // namespace sc_apitest
88 CPPUNIT_PLUGIN_IMPLEMENT();
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */