calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / sc / qa / extras / sctablesheetsobj.cxx
blob59146a3e4b366f01e28d165cc6a13e873211375b
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/xenumerationaccess.hxx>
13 #include <test/container/xindexaccess.hxx>
14 #include <test/container/xnameaccess.hxx>
15 #include <test/container/xnamecontainer.hxx>
16 #include <test/container/xnamereplace.hxx>
17 #include <test/lang/xserviceinfo.hxx>
18 #include <test/sheet/xspreadsheets.hxx>
19 #include <test/sheet/xspreadsheets2.hxx>
21 #include <com/sun/star/lang/XComponent.hpp>
22 #include <com/sun/star/sheet/XSpreadsheet.hpp>
23 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
24 #include <com/sun/star/uno/XInterface.hpp>
26 #include <com/sun/star/uno/Any.hxx>
27 #include <com/sun/star/uno/Reference.hxx>
29 #include <cppu/unotype.hxx>
31 using namespace css;
32 using namespace css::uno;
34 namespace sc_apitest
36 class ScTableSheetsObj : public UnoApiTest,
37 public ::apitest::XElementAccess,
38 public ::apitest::XEnumerationAccess,
39 public ::apitest::XIndexAccess,
40 public ::apitest::XNameAccess,
41 public ::apitest::XNameContainer,
42 public ::apitest::XNameReplace,
43 public ::apitest::XServiceInfo,
44 public ::apitest::XSpreadsheets,
45 public ::apitest::XSpreadsheets2
47 public:
48 ScTableSheetsObj();
50 virtual void setUp() override;
51 virtual uno::Reference<uno::XInterface> init() override;
53 CPPUNIT_TEST_SUITE(ScTableSheetsObj);
55 // XElementAccess
56 CPPUNIT_TEST(testGetElementType);
57 CPPUNIT_TEST(testHasElements);
59 // XEnumerationAccess
60 CPPUNIT_TEST(testCreateEnumeration);
62 // XIndexAccess
63 CPPUNIT_TEST(testGetByIndex);
64 CPPUNIT_TEST(testGetCount);
66 // XNameAccess
67 CPPUNIT_TEST(testGetByName);
68 CPPUNIT_TEST(testGetElementNames);
69 CPPUNIT_TEST(testHasByName);
71 // XNameContainer
72 CPPUNIT_TEST(testInsertByName);
73 CPPUNIT_TEST(testInsertByNameEmptyName);
74 CPPUNIT_TEST(testInsertByNameDuplicate);
75 CPPUNIT_TEST(testRemoveByName);
76 CPPUNIT_TEST(testRemoveByNameNoneExistingElement);
78 // XNameReplace
79 CPPUNIT_TEST(testReplaceByName);
81 // XServiceInfo
82 CPPUNIT_TEST(testGetImplementationName);
83 CPPUNIT_TEST(testGetSupportedServiceNames);
84 CPPUNIT_TEST(testSupportsService);
86 // XSpreadsheets
87 CPPUNIT_TEST(testInsertNewByName);
88 CPPUNIT_TEST(testInsertNewByNameBadName);
89 CPPUNIT_TEST(testCopyByName);
90 CPPUNIT_TEST(testMoveByName);
92 // XSpreadsheets2
93 CPPUNIT_TEST(testImportedSheetNameAndIndex);
94 CPPUNIT_TEST(testImportString);
95 CPPUNIT_TEST(testImportValue);
96 CPPUNIT_TEST(testImportFormulaBasicMath);
97 CPPUNIT_TEST(testImportFormulaWithNamedRange);
98 CPPUNIT_TEST(testImportOverExistingNamedRange);
99 CPPUNIT_TEST(testImportNamedRangeDefinedInSource);
100 CPPUNIT_TEST(testImportNamedRangeRedefinedInSource);
101 CPPUNIT_TEST(testImportNewNamedRange);
102 CPPUNIT_TEST(testImportCellStyle);
103 CPPUNIT_TEST(testLastAfterInsertCopy);
105 CPPUNIT_TEST_SUITE_END();
107 virtual uno::Reference<lang::XComponent> loadFromDesktop(const OUString& rFileBase) override;
110 ScTableSheetsObj::ScTableSheetsObj()
111 : UnoApiTest("/sc/qa/extras/testdocuments")
112 , ::apitest::XElementAccess(cppu::UnoType<sheet::XSpreadsheet>::get())
113 , ::apitest::XIndexAccess(3)
114 , ::apitest::XNameAccess("Sheet1")
115 , ::apitest::XNameContainer("Sheet2")
116 , ::apitest::XNameReplace("Sheet2")
117 , ::apitest::XServiceInfo("ScTableSheetsObj", "com.sun.star.sheet.Spreadsheets")
121 uno::Reference<lang::XComponent> ScTableSheetsObj::loadFromDesktop(const OUString& rFileBase)
123 OUString aString = createFileURL(rFileBase);
124 return UnoApiTest::loadFromDesktop(aString);
127 uno::Reference<uno::XInterface> ScTableSheetsObj::init()
129 xDocument.set(mxComponent, UNO_QUERY_THROW);
130 uno::Reference<uno::XInterface> xReturn(xDocument->getSheets(), UNO_QUERY_THROW);
132 uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY_THROW);
133 XNameContainer::setElement(uno::Any(xMSF->createInstance("com.sun.star.sheet.Spreadsheet")));
134 // XNameReplace
135 XNameReplace::setElement(uno::Any(xMSF->createInstance("com.sun.star.sheet.Spreadsheet")));
137 return xReturn;
140 void ScTableSheetsObj::setUp()
142 UnoApiTest::setUp();
143 // create a calc document
144 loadFromURL(u"rangenamessrc.ods");
147 CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetsObj);
148 } // namespace sc_apitest
150 CPPUNIT_PLUGIN_IMPLEMENT();
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */