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/xindexaccess.hxx>
13 #include <test/drawing/xdrawpages.hxx>
14 #include <test/lang/xserviceinfo.hxx>
16 #include <com/sun/star/drawing/XDrawPage.hpp>
17 #include <com/sun/star/drawing/XDrawPages.hpp>
18 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
19 #include <com/sun/star/lang/XComponent.hpp>
20 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
21 #include <com/sun/star/uno/XInterface.hpp>
23 #include <com/sun/star/uno/Reference.hxx>
25 #include <cppu/unotype.hxx>
28 using namespace css::uno
;
32 class ScDrawPagesObj
: public CalcUnoApiTest
,
33 public apitest::XDrawPages
,
34 public apitest::XElementAccess
,
35 public apitest::XIndexAccess
,
36 public apitest::XServiceInfo
41 virtual uno::Reference
<uno::XInterface
> init() override
;
42 virtual void setUp() override
;
43 virtual void tearDown() override
;
45 CPPUNIT_TEST_SUITE(ScDrawPagesObj
);
48 CPPUNIT_TEST(testInsertNewByIndex
);
49 CPPUNIT_TEST(testRemove
);
52 CPPUNIT_TEST(testGetElementType
);
53 CPPUNIT_TEST(testHasElements
);
56 CPPUNIT_TEST(testGetByIndex
);
57 CPPUNIT_TEST(testGetCount
);
60 CPPUNIT_TEST(testGetImplementationName
);
61 CPPUNIT_TEST(testGetSupportedServiceNames
);
62 CPPUNIT_TEST(testSupportsService
);
64 CPPUNIT_TEST_SUITE_END();
67 uno::Reference
<lang::XComponent
> m_xComponent
;
70 ScDrawPagesObj::ScDrawPagesObj()
71 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
72 , XElementAccess(cppu::UnoType
<drawing::XDrawPage
>::get())
74 , XServiceInfo("ScDrawPagesObj", "com.sun.star.drawing.DrawPages")
78 uno::Reference
<uno::XInterface
> ScDrawPagesObj::init()
80 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(m_xComponent
, uno::UNO_QUERY_THROW
);
82 uno::Reference
<drawing::XDrawPagesSupplier
> xDPS(xDoc
, uno::UNO_QUERY_THROW
);
83 uno::Reference
<drawing::XDrawPages
> xDP(xDPS
->getDrawPages(), uno::UNO_SET_THROW
);
85 xDP
->insertNewByIndex(1);
86 xDP
->insertNewByIndex(2);
91 void ScDrawPagesObj::setUp()
93 CalcUnoApiTest::setUp();
94 // create a calc document
95 m_xComponent
= loadFromDesktop("private:factory/scalc");
98 void ScDrawPagesObj::tearDown()
100 closeDocument(m_xComponent
);
101 CalcUnoApiTest::tearDown();
104 CPPUNIT_TEST_SUITE_REGISTRATION(ScDrawPagesObj
);
106 } // namespace sc_apitest
108 CPPUNIT_PLUGIN_IMPLEMENT();
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */