Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
10 : #include <test/unoapi_test.hxx>
11 : #include <test/sheet/xgoalseek.hxx>
12 :
13 : namespace sc_apitest {
14 :
15 : #define NUMBER_OF_TESTS 1
16 :
17 6 : class ScModelObj : public UnoApiTest, apitest::XGoalSeek
18 : {
19 : public:
20 : virtual void setUp();
21 : virtual void tearDown();
22 :
23 : virtual uno::Reference< uno::XInterface > init();
24 :
25 4 : CPPUNIT_TEST_SUITE(ScModelObj);
26 2 : CPPUNIT_TEST(testSeekGoal);
27 4 : CPPUNIT_TEST_SUITE_END();
28 :
29 : private:
30 : static sal_Int32 nTest;
31 : static uno::Reference< lang::XComponent > mxComponent;
32 : };
33 :
34 :
35 : sal_Int32 ScModelObj::nTest = 0;
36 2 : uno::Reference< lang::XComponent > ScModelObj::mxComponent;
37 :
38 2 : uno::Reference< uno::XInterface > ScModelObj::init()
39 : {
40 2 : rtl::OUString aFileURL;
41 2 : createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScModelObj.ods")), aFileURL);
42 2 : if(!mxComponent.is())
43 2 : mxComponent = loadFromDesktop(aFileURL);
44 2 : CPPUNIT_ASSERT(mxComponent.is());
45 :
46 2 : return mxComponent;
47 : }
48 :
49 2 : void ScModelObj::setUp()
50 : {
51 2 : nTest++;
52 2 : UnoApiTest::setUp();
53 2 : }
54 :
55 2 : void ScModelObj::tearDown()
56 : {
57 2 : if (nTest == NUMBER_OF_TESTS)
58 2 : closeDocument(mxComponent);
59 :
60 2 : UnoApiTest::tearDown();
61 2 : }
62 :
63 2 : CPPUNIT_TEST_SUITE_REGISTRATION(ScModelObj);
64 :
65 2 : CPPUNIT_PLUGIN_IMPLEMENT();
66 :
67 6 : }
68 :
69 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|