update emoji autocorrect entries from po-files
[LibreOffice.git] / sc / qa / extras / scdatabaserangeobj.cxx
bloba25b1ffe4eac4483a3bdcd2269f3ea8cca60b2b7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #include <test/calc_unoapi_test.hxx>
11 #include <test/sheet/xdatabaserange.hxx>
13 #include <com/sun/star/beans/XPropertySet.hpp>
14 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
15 #include <com/sun/star/container/XNameAccess.hpp>
16 #include <com/sun/star/sheet/XDatabaseRange.hpp>
18 using namespace css;
19 using namespace css::uno;
21 namespace sc_apitest {
23 #define NUMBER_OF_TESTS 6
25 class ScDatabaseRangeObj : public CalcUnoApiTest, apitest::XDatabaseRange
27 public:
28 virtual void setUp() SAL_OVERRIDE;
29 virtual void tearDown() SAL_OVERRIDE;
31 virtual uno::Reference< uno::XInterface > init( const OUString& rDBName ) SAL_OVERRIDE;
33 ScDatabaseRangeObj();
35 CPPUNIT_TEST_SUITE(ScDatabaseRangeObj);
36 CPPUNIT_TEST(testDataArea);
37 CPPUNIT_TEST(testGetSortDescriptor);
38 CPPUNIT_TEST(testGetSubtotalDescriptor);
39 CPPUNIT_TEST(testGetImportDescriptor);
40 CPPUNIT_TEST(testGetFilterDescriptor);
41 CPPUNIT_TEST(testRefresh);
42 CPPUNIT_TEST_SUITE_END();
43 private:
44 static sal_Int32 nTest;
45 static uno::Reference< lang::XComponent > mxComponent;
48 sal_Int32 ScDatabaseRangeObj::nTest = 0;
49 uno::Reference< lang::XComponent > ScDatabaseRangeObj::mxComponent;
51 ScDatabaseRangeObj::ScDatabaseRangeObj()
52 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
56 uno::Reference< uno::XInterface > ScDatabaseRangeObj::init( const OUString& rDBName )
58 OUString aFileURL;
59 createFileURL("ScDatabaseRangeObj.ods", aFileURL);
60 if(!mxComponent.is())
61 mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
62 CPPUNIT_ASSERT(mxComponent.is());
64 uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
65 uno::Reference< beans::XPropertySet > xPropSet(xDoc, UNO_QUERY_THROW);
66 uno::Reference< container::XNameAccess > xNameAccess( xPropSet->getPropertyValue("DatabaseRanges"), UNO_QUERY_THROW);
67 uno::Reference< sheet::XDatabaseRange > xDBRange( xNameAccess->getByName(rDBName), UNO_QUERY_THROW);
68 CPPUNIT_ASSERT(xDBRange.is());
69 return xDBRange;
72 void ScDatabaseRangeObj::setUp()
74 nTest++;
75 CalcUnoApiTest::setUp();
78 void ScDatabaseRangeObj::tearDown()
80 if (nTest == NUMBER_OF_TESTS)
82 closeDocument(mxComponent);
83 mxComponent.clear();
86 CalcUnoApiTest::tearDown();
89 CPPUNIT_TEST_SUITE_REGISTRATION(ScDatabaseRangeObj);
93 CPPUNIT_PLUGIN_IMPLEMENT();
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */