Revert "tdf#158280 Replace usage of InputDialog with SvxNameDialog"
[LibreOffice.git] / sc / qa / extras / scdrawpagesobj.cxx
blob6119bf2b08c8004a7ff3a19a33a7429e4df13a17
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/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/sheet/XSpreadsheetDocument.hpp>
20 #include <com/sun/star/uno/XInterface.hpp>
22 #include <com/sun/star/uno/Reference.hxx>
24 #include <cppu/unotype.hxx>
26 using namespace css;
27 using namespace css::uno;
29 namespace sc_apitest
31 class ScDrawPagesObj : public UnoApiTest,
32 public apitest::XDrawPages,
33 public apitest::XElementAccess,
34 public apitest::XIndexAccess,
35 public apitest::XServiceInfo
37 public:
38 ScDrawPagesObj();
40 virtual uno::Reference<uno::XInterface> init() override;
41 virtual void setUp() override;
43 CPPUNIT_TEST_SUITE(ScDrawPagesObj);
45 // XDrawPages
46 CPPUNIT_TEST(testInsertNewByIndex);
47 CPPUNIT_TEST(testRemove);
49 // XElementAccess
50 CPPUNIT_TEST(testGetElementType);
51 CPPUNIT_TEST(testHasElements);
53 // XIndexAccess
54 CPPUNIT_TEST(testGetByIndex);
55 CPPUNIT_TEST(testGetCount);
57 // XServiceInfo
58 CPPUNIT_TEST(testGetImplementationName);
59 CPPUNIT_TEST(testGetSupportedServiceNames);
60 CPPUNIT_TEST(testSupportsService);
62 CPPUNIT_TEST_SUITE_END();
65 ScDrawPagesObj::ScDrawPagesObj()
66 : UnoApiTest(u"/sc/qa/extras/testdocuments"_ustr)
67 , XElementAccess(cppu::UnoType<drawing::XDrawPage>::get())
68 , XIndexAccess(3)
69 , XServiceInfo(u"ScDrawPagesObj"_ustr, u"com.sun.star.drawing.DrawPages"_ustr)
73 uno::Reference<uno::XInterface> ScDrawPagesObj::init()
75 uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
77 uno::Reference<drawing::XDrawPagesSupplier> xDPS(xDoc, uno::UNO_QUERY_THROW);
78 uno::Reference<drawing::XDrawPages> xDP(xDPS->getDrawPages(), uno::UNO_SET_THROW);
80 xDP->insertNewByIndex(1);
81 xDP->insertNewByIndex(2);
83 return xDP;
86 void ScDrawPagesObj::setUp()
88 UnoApiTest::setUp();
89 // create a calc document
90 loadFromURL(u"private:factory/scalc"_ustr);
93 CPPUNIT_TEST_SUITE_REGISTRATION(ScDrawPagesObj);
95 } // namespace sc_apitest
97 CPPUNIT_PLUGIN_IMPLEMENT();
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */