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