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 : using namespace css;
14 : using namespace css::uno;
15 :
16 : namespace sc_apitest {
17 :
18 : #define NUMBER_OF_TESTS 1
19 :
20 4 : class ScModelObj : public UnoApiTest, apitest::XGoalSeek
21 : {
22 : public:
23 : virtual void setUp() SAL_OVERRIDE;
24 : virtual void tearDown() SAL_OVERRIDE;
25 :
26 : virtual uno::Reference< uno::XInterface > init() SAL_OVERRIDE;
27 :
28 : ScModelObj();
29 :
30 4 : CPPUNIT_TEST_SUITE(ScModelObj);
31 2 : CPPUNIT_TEST(testSeekGoal);
32 4 : CPPUNIT_TEST_SUITE_END();
33 :
34 : private:
35 : static sal_Int32 nTest;
36 : static uno::Reference< lang::XComponent > mxComponent;
37 : };
38 :
39 2 : ScModelObj::ScModelObj()
40 2 : : UnoApiTest("/sc/qa/extras/testdocuments")
41 : {
42 2 : }
43 :
44 : sal_Int32 ScModelObj::nTest = 0;
45 2 : uno::Reference< lang::XComponent > ScModelObj::mxComponent;
46 :
47 2 : uno::Reference< uno::XInterface > ScModelObj::init()
48 : {
49 2 : OUString aFileURL;
50 2 : createFileURL(OUString("ScModelObj.ods"), aFileURL);
51 2 : if(!mxComponent.is())
52 2 : mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
53 2 : CPPUNIT_ASSERT(mxComponent.is());
54 :
55 2 : return mxComponent;
56 : }
57 :
58 2 : void ScModelObj::setUp()
59 : {
60 2 : nTest++;
61 2 : UnoApiTest::setUp();
62 2 : }
63 :
64 2 : void ScModelObj::tearDown()
65 : {
66 2 : if (nTest == NUMBER_OF_TESTS)
67 : {
68 2 : closeDocument(mxComponent);
69 2 : mxComponent.clear();
70 : }
71 :
72 2 : UnoApiTest::tearDown();
73 2 : }
74 :
75 2 : CPPUNIT_TEST_SUITE_REGISTRATION(ScModelObj);
76 :
77 : }
78 :
79 8 : CPPUNIT_PLUGIN_IMPLEMENT();
80 :
81 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|