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 24 : 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 4 : CPPUNIT_TEST_SUITE(ScOutlineObj);
34 2 : CPPUNIT_TEST(testHideDetail);
35 2 : CPPUNIT_TEST(testShowDetail);
36 2 : CPPUNIT_TEST(testShowLevel);
37 2 : CPPUNIT_TEST(testUngroup);
38 2 : CPPUNIT_TEST(testGroup);
39 : // CPPUNIT_TEST(testAutoOutline);
40 2 : CPPUNIT_TEST(testClearOutline);
41 4 : 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 2 : uno::Reference< lang::XComponent > ScOutlineObj::mxComponent;
50 :
51 12 : ScOutlineObj::ScOutlineObj()
52 12 : : CalcUnoApiTest("/sc/qa/extras/testdocuments")
53 : {
54 12 : }
55 :
56 12 : uno::Reference< uno::XInterface > ScOutlineObj::init()
57 : {
58 : // get the test file
59 12 : OUString aFileURL;
60 12 : createFileURL(OUString("ScOutlineObj.ods"), aFileURL);
61 12 : if(!mxComponent.is())
62 2 : mxComponent = loadFromDesktop(aFileURL);
63 12 : CPPUNIT_ASSERT_MESSAGE("Component not loaded",mxComponent.is());
64 :
65 : // get the first sheet
66 24 : uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
67 24 : uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
68 24 : uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
69 :
70 24 : return xSheet;
71 : }
72 :
73 12 : void ScOutlineObj::setUp()
74 : {
75 12 : nTest++;
76 12 : CalcUnoApiTest::setUp();
77 12 : }
78 :
79 12 : void ScOutlineObj::tearDown()
80 : {
81 12 : if (nTest == NUMBER_OF_TESTS)
82 : {
83 2 : closeDocument(mxComponent);
84 2 : mxComponent.clear();
85 : }
86 :
87 12 : CalcUnoApiTest::tearDown();
88 12 : }
89 :
90 2 : CPPUNIT_TEST_SUITE_REGISTRATION(ScOutlineObj);
91 :
92 : }
93 :
94 8 : CPPUNIT_PLUGIN_IMPLEMENT();
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|