Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License or as specified alternatively below. You may obtain a copy of
8 : * the License at http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * Major Contributor(s):
16 : * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
17 : *
18 : * All Rights Reserved.
19 : *
20 : * For minor contributions see the git repository.
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : * instead of those above.
27 : */
28 :
29 : #include <test/unoapi_test.hxx>
30 : #include <test/util/xreplaceable.hxx>
31 : #include <test/util/xsearchable.hxx>
32 : #include <test/sheet/xprintareas.hxx>
33 :
34 : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
35 : #include <com/sun/star/sheet/XSpreadsheet.hpp>
36 :
37 : namespace sc_apitest
38 : {
39 :
40 28 : class ScTableSheetObj : public UnoApiTest, apitest::XSearchable, apitest::XReplaceable, apitest::XPrintAreas
41 : {
42 : public:
43 : ScTableSheetObj();
44 :
45 : virtual uno::Reference< uno::XInterface > init();
46 :
47 4 : CPPUNIT_TEST_SUITE(ScTableSheetObj);
48 2 : CPPUNIT_TEST(testFindAll);
49 2 : CPPUNIT_TEST(testFindNext);
50 2 : CPPUNIT_TEST(testFindFirst);
51 2 : CPPUNIT_TEST(testReplaceAll);
52 2 : CPPUNIT_TEST(testCreateReplaceDescriptor);
53 : // XPrintAreas
54 2 : CPPUNIT_TEST(testSetAndGetPrintTitleColumns);
55 2 : CPPUNIT_TEST(testSetAndGetPrintTitleRows);
56 4 : CPPUNIT_TEST_SUITE_END();
57 :
58 : private:
59 : static sal_Int32 nTest;
60 : static uno::Reference< lang::XComponent > mxComponent;
61 : };
62 :
63 : sal_Int32 ScTableSheetObj::nTest = 0;
64 2 : uno::Reference< lang::XComponent > ScTableSheetObj::mxComponent;
65 :
66 14 : ScTableSheetObj::ScTableSheetObj():
67 : apitest::XSearchable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test")), 4),
68 14 : apitest::XReplaceable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("searchReplaceString")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("replaceReplaceString")))
69 : {
70 :
71 14 : }
72 :
73 :
74 14 : uno::Reference< uno::XInterface > ScTableSheetObj::init()
75 : {
76 14 : rtl::OUString aFileURL;
77 14 : createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScTableSheetObj.ods")), aFileURL);
78 14 : if(!mxComponent.is())
79 2 : mxComponent = loadFromDesktop(aFileURL);
80 14 : CPPUNIT_ASSERT(mxComponent.is());
81 :
82 14 : uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
83 14 : uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
84 14 : uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
85 :
86 14 : return xSheet;
87 : }
88 :
89 2 : CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetObj);
90 :
91 2 : CPPUNIT_PLUGIN_IMPLEMENT();
92 :
93 6 : }
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|