1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * Version: MPL 1.1 / GPLv3+ / LGPLv3+
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License or as specified alternatively below. You may obtain a copy of
8 * the License at http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * Major Contributor(s):
16 * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
18 * All Rights Reserved.
20 * For minor contributions see the git repository.
22 * Alternatively, the contents of this file may be used under the terms of
23 * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 * instead of those above.
29 #include <test/unoapi_test.hxx>
30 #include <test/sheet/xspreadsheets2.hxx>
31 #include <test/container/xnamecontainer.hxx>
33 #include <com/sun/star/beans/XPropertySet.hpp>
34 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
36 namespace sc_apitest
{
38 #define NUMBER_OF_TESTS 13
40 class ScTableSheetsObj
: public UnoApiTest
, public ::apitest::XSpreadsheets2
, apitest::XNameContainer
46 virtual void tearDown();
48 CPPUNIT_TEST_SUITE(ScTableSheetsObj
);
49 CPPUNIT_TEST(testImportValue
);
50 CPPUNIT_TEST(testImportString
);
51 CPPUNIT_TEST(testImportedSheetNameAndIndex
);
52 CPPUNIT_TEST(testImportString
);
53 CPPUNIT_TEST(testImportValue
);
54 CPPUNIT_TEST(testImportFormulaBasicMath
);
55 CPPUNIT_TEST(testImportFormulaWithNamedRange
);
56 CPPUNIT_TEST(testImportOverExistingNamedRange
);
57 CPPUNIT_TEST(testImportNamedRangeDefinedInSource
);
58 CPPUNIT_TEST(testImportNamedRangeRedefinedInSource
);
59 CPPUNIT_TEST(testImportNewNamedRange
);
60 CPPUNIT_TEST(testImportCellStyle
);
61 CPPUNIT_TEST(testRemoveByName
);
62 CPPUNIT_TEST_SUITE_END();
64 virtual uno::Reference
< lang::XComponent
> getComponent();
65 virtual void createFileURL(const rtl::OUString
& rFileBase
, rtl::OUString
& rFileURL
);
66 virtual uno::Reference
< lang::XComponent
> loadFromDesktop(const rtl::OUString
& rString
);
67 virtual uno::Reference
< uno::XInterface
> init();
69 static uno::Reference
< lang::XComponent
> mxComponent
;
70 static sal_Int32 nTest
;
73 uno::Reference
< lang::XComponent
> ScTableSheetsObj::mxComponent
;
74 sal_Int32
ScTableSheetsObj::nTest
= 0;
76 ScTableSheetsObj::ScTableSheetsObj():
77 apitest::XNameContainer(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sheet2")))
82 uno::Reference
< lang::XComponent
> ScTableSheetsObj::getComponent()
87 void ScTableSheetsObj::createFileURL(const rtl::OUString
& rFileBase
, rtl::OUString
& rFileURL
)
89 UnoApiTest::createFileURL(rFileBase
, rFileURL
);
92 uno::Reference
< lang::XComponent
> ScTableSheetsObj::loadFromDesktop(const rtl::OUString
& rString
)
94 return UnoApiTest::loadFromDesktop(rString
);
97 uno::Reference
< uno::XInterface
> ScTableSheetsObj::init()
99 rtl::OUString aFileURL
;
100 createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rangenamessrc.ods")), aFileURL
);
101 if(!mxComponent
.is())
102 mxComponent
= loadFromDesktop(aFileURL
);
103 CPPUNIT_ASSERT(mxComponent
.is());
104 xDocument
= uno::Reference
< sheet::XSpreadsheetDocument
>(mxComponent
, UNO_QUERY_THROW
);
105 uno::Reference
< uno::XInterface
> xReturn( xDocument
->getSheets(), UNO_QUERY_THROW
);
110 void ScTableSheetsObj::setUp()
113 CPPUNIT_ASSERT(nTest
<= NUMBER_OF_TESTS
);
117 void ScTableSheetsObj::tearDown()
119 if (nTest
== NUMBER_OF_TESTS
)
120 closeDocument(mxComponent
);
122 UnoApiTest::tearDown();
125 CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetsObj
);
127 CPPUNIT_PLUGIN_IMPLEMENT();
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */