calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / sc / qa / extras / scdrawpageobj.cxx
blob1899650d3eb20a1863fd925104c59c1d01548d18
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/helper/shape.hxx>
12 #include <test/container/xelementaccess.hxx>
13 #include <test/container/xindexaccess.hxx>
14 #include <test/drawing/xshapegrouper.hxx>
15 #include <test/drawing/xshapes.hxx>
16 #include <test/lang/xserviceinfo.hxx>
17 #include <cppu/unotype.hxx>
19 #include <com/sun/star/drawing/XDrawPage.hpp>
20 #include <com/sun/star/drawing/XDrawPages.hpp>
21 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
22 #include <com/sun/star/drawing/XShape.hpp>
23 #include <com/sun/star/drawing/XShapes.hpp>
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
26 #include <com/sun/star/uno/XInterface.hpp>
28 #include <com/sun/star/uno/Reference.hxx>
30 using namespace css;
32 namespace sc_apitest
34 class ScDrawPageObj : public UnoApiTest,
35 public apitest::XElementAccess,
36 public apitest::XIndexAccess,
37 public apitest::XServiceInfo,
38 public apitest::XShapeGrouper,
39 public apitest::XShapes
41 public:
42 ScDrawPageObj();
44 virtual uno::Reference<uno::XInterface> init() override;
45 virtual void setUp() override;
47 CPPUNIT_TEST_SUITE(ScDrawPageObj);
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 // XShapeGrouper
63 CPPUNIT_TEST(testGroup);
64 CPPUNIT_TEST(testUngroup);
66 // XShapes
67 CPPUNIT_TEST(testAddRemove);
69 CPPUNIT_TEST_SUITE_END();
72 ScDrawPageObj::ScDrawPageObj()
73 : UnoApiTest("/sc/qa/extras/testdocuments")
74 , XElementAccess(cppu::UnoType<drawing::XShape>::get())
75 , XIndexAccess(2)
76 , XServiceInfo("ScPageObj", "com.sun.star.sheet.SpreadsheetDrawPage")
80 uno::Reference<uno::XInterface> ScDrawPageObj::init()
82 uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
83 uno::Reference<drawing::XDrawPagesSupplier> xDPS(xDoc, uno::UNO_QUERY_THROW);
84 uno::Reference<drawing::XDrawPages> xDP(xDPS->getDrawPages(), uno::UNO_SET_THROW);
85 xDP->insertNewByIndex(0);
86 xDP->insertNewByIndex(1);
88 uno::Reference<drawing::XDrawPage> xDrawPage(xDP->getByIndex(0), uno::UNO_QUERY_THROW);
89 uno::Reference<drawing::XShapes> xShapes(xDrawPage, uno::UNO_QUERY_THROW);
91 uno::Reference<drawing::XShape> xRectangle0(
92 apitest::helper::shape::createRectangle(mxComponent, 7500, 5000, 5000, 3500),
93 uno::UNO_SET_THROW);
94 xShapes->add(xRectangle0);
95 uno::Reference<drawing::XShape> xRectangle1(
96 apitest::helper::shape::createRectangle(mxComponent, 5000, 5000, 5000, 5500),
97 uno::UNO_SET_THROW);
98 xShapes->add(xRectangle1);
100 // needed for XShapeGrouper tests
101 setDrawPage(xDrawPage);
102 // needed for XShapes tests
103 setShape(apitest::helper::shape::createLine(mxComponent, 7500, 10000, 5000, 3500));
104 return xDrawPage;
107 void ScDrawPageObj::setUp()
109 UnoApiTest::setUp();
110 // create calc document
111 mxComponent = loadFromDesktop("private:factory/scalc");
114 CPPUNIT_TEST_SUITE_REGISTRATION(ScDrawPageObj);
116 } // namespace sc_apitest
118 CPPUNIT_PLUGIN_IMPLEMENT();
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */