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/calc_unoapi_test.hxx>
11 : #include <test/sheet/xsheetoutline.hxx>
12 :
13 : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
14 : #include <com/sun/star/sheet/XSpreadsheet.hpp>
15 :
16 : using namespace css;
17 : using namespace css::uno;
18 :
19 : namespace sc_apitest {
20 :
21 : #define NUMBER_OF_TESTS 6
22 :
23 12 : class ScOutlineObj : public CalcUnoApiTest, apitest::XSheetOutline
24 : {
25 : public:
26 : ScOutlineObj();
27 :
28 : virtual void setUp() SAL_OVERRIDE;
29 : virtual void tearDown() SAL_OVERRIDE;
30 :
31 : virtual uno::Reference< uno::XInterface > init() SAL_OVERRIDE;
32 :
33 2 : CPPUNIT_TEST_SUITE(ScOutlineObj);
34 1 : CPPUNIT_TEST(testHideDetail);
35 1 : CPPUNIT_TEST(testShowDetail);
36 1 : CPPUNIT_TEST(testShowLevel);
37 1 : CPPUNIT_TEST(testUngroup);
38 1 : CPPUNIT_TEST(testGroup);
39 : // CPPUNIT_TEST(testAutoOutline);
40 1 : CPPUNIT_TEST(testClearOutline);
41 5 : CPPUNIT_TEST_SUITE_END();
42 : private:
43 :
44 : static sal_Int32 nTest;
45 : static uno::Reference< lang::XComponent > mxComponent;
46 : };
47 :
48 : sal_Int32 ScOutlineObj::nTest = 0;
49 1 : uno::Reference< lang::XComponent > ScOutlineObj::mxComponent;
50 :
51 6 : ScOutlineObj::ScOutlineObj()
52 6 : : CalcUnoApiTest("/sc/qa/extras/testdocuments")
53 : {
54 6 : }
55 :
56 6 : uno::Reference< uno::XInterface > ScOutlineObj::init()
57 : {
58 : // get the test file
59 6 : OUString aFileURL;
60 6 : createFileURL(OUString("ScOutlineObj.ods"), aFileURL);
61 6 : if(!mxComponent.is())
62 1 : mxComponent = loadFromDesktop(aFileURL);
63 6 : CPPUNIT_ASSERT_MESSAGE("Component not loaded",mxComponent.is());
64 :
65 : // get the first sheet
66 12 : uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
67 12 : uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
68 12 : uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
69 :
70 12 : return xSheet;
71 : }
72 :
73 6 : void ScOutlineObj::setUp()
74 : {
75 6 : nTest++;
76 6 : CalcUnoApiTest::setUp();
77 6 : }
78 :
79 6 : void ScOutlineObj::tearDown()
80 : {
81 6 : if (nTest == NUMBER_OF_TESTS)
82 : {
83 1 : closeDocument(mxComponent);
84 1 : mxComponent.clear();
85 : }
86 :
87 6 : CalcUnoApiTest::tearDown();
88 6 : }
89 :
90 1 : CPPUNIT_TEST_SUITE_REGISTRATION(ScOutlineObj);
91 :
92 : }
93 :
94 4 : CPPUNIT_PLUGIN_IMPLEMENT();
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|