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/xelementaccess.hxx>
12 #include <test/container/xenumerationaccess.hxx>
13 #include <test/container/xindexaccess.hxx>
14 #include <test/sheet/xarealinks.hxx>
16 #include <com/sun/star/beans/XPropertySet.hpp>
17 #include <com/sun/star/lang/XComponent.hpp>
18 #include <com/sun/star/sheet/XAreaLink.hpp>
19 #include <com/sun/star/sheet/XAreaLinks.hpp>
20 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
21 #include <com/sun/star/table/CellAddress.hpp>
22 #include <com/sun/star/uno/XInterface.hpp>
24 #include <com/sun/star/uno/Reference.hxx>
26 #include <cppu/unotype.hxx>
29 using namespace css::uno
;
33 class ScAreaLinksObj
: public CalcUnoApiTest
,
34 public apitest::XAreaLinks
,
35 public apitest::XElementAccess
,
36 public apitest::XEnumerationAccess
,
37 public apitest::XIndexAccess
42 virtual uno::Reference
<uno::XInterface
> init() override
;
43 virtual void setUp() override
;
44 virtual void tearDown() override
;
46 CPPUNIT_TEST_SUITE(ScAreaLinksObj
);
49 CPPUNIT_TEST(testInsertAtPosition
);
50 CPPUNIT_TEST(testRemoveByIndex
);
53 CPPUNIT_TEST(testGetElementType
);
54 CPPUNIT_TEST(testHasElements
);
57 CPPUNIT_TEST(testCreateEnumeration
);
60 CPPUNIT_TEST(testGetByIndex
);
61 CPPUNIT_TEST(testGetCount
);
63 CPPUNIT_TEST_SUITE_END();
66 uno::Reference
<lang::XComponent
> m_xComponent
;
69 ScAreaLinksObj::ScAreaLinksObj()
70 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
71 , XElementAccess(cppu::UnoType
<sheet::XAreaLink
>::get())
76 uno::Reference
<uno::XInterface
> ScAreaLinksObj::init()
78 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(m_xComponent
, uno::UNO_QUERY_THROW
);
79 CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc
.is());
81 uno::Reference
<beans::XPropertySet
> xPropSet(xDoc
, uno::UNO_QUERY_THROW
);
82 uno::Reference
<sheet::XAreaLinks
> xLinks(xPropSet
->getPropertyValue("AreaLinks"),
83 uno::UNO_QUERY_THROW
);
85 xLinks
->insertAtPosition(table::CellAddress(1, 2, 3), "ScAreaLinksObj.ods", "A2:B5", "", "");
90 void ScAreaLinksObj::setUp()
92 CalcUnoApiTest::setUp();
93 m_xComponent
= loadFromDesktop("private:factory/scalc");
96 void ScAreaLinksObj::tearDown()
98 closeDocument(m_xComponent
);
99 CalcUnoApiTest::tearDown();
102 CPPUNIT_TEST_SUITE_REGISTRATION(ScAreaLinksObj
);
104 } // namespace sc_apitest
106 CPPUNIT_PLUGIN_IMPLEMENT();
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */