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 28 : 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 4 : CPPUNIT_TEST_SUITE(ScTableSheetObj);
35 2 : CPPUNIT_TEST(testFindAll);
36 2 : CPPUNIT_TEST(testFindNext);
37 2 : CPPUNIT_TEST(testFindFirst);
38 2 : CPPUNIT_TEST(testReplaceAll);
39 2 : CPPUNIT_TEST(testCreateReplaceDescriptor);
40 : // XPrintAreas
41 2 : CPPUNIT_TEST(testSetAndGetPrintTitleColumns);
42 2 : CPPUNIT_TEST(testSetAndGetPrintTitleRows);
43 4 : CPPUNIT_TEST_SUITE_END();
44 :
45 : private:
46 : uno::Reference< lang::XComponent > mxComponent;
47 : };
48 :
49 14 : ScTableSheetObj::ScTableSheetObj():
50 : CalcUnoApiTest("/sc/qa/extras/testdocuments"),
51 : apitest::XSearchable(OUString("test"), 4),
52 14 : apitest::XReplaceable(OUString("searchReplaceString"), OUString("replaceReplaceString"))
53 : {
54 14 : }
55 :
56 14 : uno::Reference< uno::XInterface > ScTableSheetObj::init()
57 : {
58 14 : OUString aFileURL;
59 14 : createFileURL(OUString("ScTableSheetObj.ods"), aFileURL);
60 14 : if(!mxComponent.is())
61 14 : mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
62 14 : CPPUNIT_ASSERT(mxComponent.is());
63 :
64 28 : uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
65 28 : uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
66 28 : uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
67 :
68 28 : return xSheet;
69 : }
70 :
71 14 : void ScTableSheetObj::setUp()
72 : {
73 14 : CalcUnoApiTest::setUp();
74 14 : }
75 :
76 14 : void ScTableSheetObj::tearDown()
77 : {
78 14 : closeDocument(mxComponent);
79 14 : mxComponent.clear();
80 :
81 14 : CalcUnoApiTest::tearDown();
82 14 : }
83 :
84 2 : CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetObj);
85 :
86 : }
87 :
88 8 : CPPUNIT_PLUGIN_IMPLEMENT();
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|