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/util/xreplaceable.hxx>
12 : #include <test/util/xsearchable.hxx>
13 : #include <test/sheet/xprintareas.hxx>
14 :
15 : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
16 : #include <com/sun/star/sheet/XSpreadsheet.hpp>
17 :
18 : using namespace css;
19 : using namespace css::uno;
20 :
21 : namespace sc_apitest
22 : {
23 :
24 14 : class ScTableSheetObj : public CalcUnoApiTest, apitest::XSearchable, apitest::XReplaceable, apitest::XPrintAreas
25 : {
26 : public:
27 : ScTableSheetObj();
28 :
29 : virtual void setUp() SAL_OVERRIDE;
30 : virtual void tearDown() SAL_OVERRIDE;
31 :
32 : virtual uno::Reference< uno::XInterface > init() SAL_OVERRIDE;
33 :
34 2 : CPPUNIT_TEST_SUITE(ScTableSheetObj);
35 1 : CPPUNIT_TEST(testFindAll);
36 1 : CPPUNIT_TEST(testFindNext);
37 1 : CPPUNIT_TEST(testFindFirst);
38 1 : CPPUNIT_TEST(testReplaceAll);
39 1 : CPPUNIT_TEST(testCreateReplaceDescriptor);
40 : // XPrintAreas
41 1 : CPPUNIT_TEST(testSetAndGetPrintTitleColumns);
42 1 : CPPUNIT_TEST(testSetAndGetPrintTitleRows);
43 5 : CPPUNIT_TEST_SUITE_END();
44 :
45 : private:
46 : uno::Reference< lang::XComponent > mxComponent;
47 : };
48 :
49 7 : ScTableSheetObj::ScTableSheetObj():
50 : CalcUnoApiTest("/sc/qa/extras/testdocuments"),
51 : apitest::XSearchable(OUString("test"), 4),
52 7 : apitest::XReplaceable(OUString("searchReplaceString"), OUString("replaceReplaceString"))
53 : {
54 7 : }
55 :
56 7 : uno::Reference< uno::XInterface > ScTableSheetObj::init()
57 : {
58 7 : OUString aFileURL;
59 7 : createFileURL(OUString("ScTableSheetObj.ods"), aFileURL);
60 7 : if(!mxComponent.is())
61 7 : mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
62 7 : CPPUNIT_ASSERT(mxComponent.is());
63 :
64 14 : uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
65 14 : uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
66 14 : uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
67 :
68 14 : return xSheet;
69 : }
70 :
71 7 : void ScTableSheetObj::setUp()
72 : {
73 7 : CalcUnoApiTest::setUp();
74 7 : }
75 :
76 7 : void ScTableSheetObj::tearDown()
77 : {
78 7 : closeDocument(mxComponent);
79 7 : mxComponent.clear();
80 :
81 7 : CalcUnoApiTest::tearDown();
82 7 : }
83 :
84 1 : CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetObj);
85 :
86 : }
87 :
88 4 : CPPUNIT_PLUGIN_IMPLEMENT();
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|