/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include #include #include #include #include #include #include using namespace css; using namespace css::uno; namespace sc_apitest { #define NUMBER_OF_TESTS 10 class ScTableSheetObj : public CalcUnoApiTest, public apitest::XSearchable, public apitest::XReplaceable, public apitest::XPrintAreas, public apitest::XCellSeries, public apitest::XUniqueCellFormatRangesSupplier { public: ScTableSheetObj(); virtual void setUp() override; virtual void tearDown() override; virtual uno::Reference< uno::XInterface > init() override; CPPUNIT_TEST_SUITE(ScTableSheetObj); // XSearchable CPPUNIT_TEST(testFindAll); CPPUNIT_TEST(testFindNext); CPPUNIT_TEST(testFindFirst); // XReplaceable CPPUNIT_TEST(testReplaceAll); CPPUNIT_TEST(testCreateReplaceDescriptor); // XPrintAreas CPPUNIT_TEST(testSetAndGetPrintTitleColumns); CPPUNIT_TEST(testSetAndGetPrintTitleRows); // XCellSeries CPPUNIT_TEST(testFillAuto); CPPUNIT_TEST(testFillSeries); // XUniqueCellFormatRangesSupplier CPPUNIT_TEST(testGetUniqueCellFormatRanges); CPPUNIT_TEST_SUITE_END(); private: static sal_Int32 nTest; static uno::Reference< lang::XComponent > mxComponent; }; sal_Int32 ScTableSheetObj::nTest = 0; uno::Reference< lang::XComponent > ScTableSheetObj::mxComponent; ScTableSheetObj::ScTableSheetObj(): CalcUnoApiTest("/sc/qa/extras/testdocuments"), apitest::XSearchable("test", 4), apitest::XReplaceable("searchReplaceString", "replaceReplaceString"), apitest::XCellSeries(1, 0) { } uno::Reference< uno::XInterface > ScTableSheetObj::init() { OUString aFileURL; createFileURL("ScTableSheetObj.ods", aFileURL); if(!mxComponent.is()) mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument"); CPPUNIT_ASSERT(mxComponent.is()); uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW); uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW); uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW); return xSheet; } void ScTableSheetObj::setUp() { nTest++; CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS); CalcUnoApiTest::setUp(); } void ScTableSheetObj::tearDown() { if (nTest == NUMBER_OF_TESTS) { closeDocument(mxComponent); mxComponent.clear(); } CalcUnoApiTest::tearDown(); } CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetObj); } CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */