LCOV - code coverage report
Current view: top level - sc/qa/extras - sctablesheetsobj.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 45 47 95.7 %
Date: 2015-06-13 12:38:46 Functions: 17 19 89.5 %
Legend: Lines: hit not hit

          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/sheet/xspreadsheets2.hxx>
      12             : #include <test/container/xnamecontainer.hxx>
      13             : 
      14             : #include <com/sun/star/beans/XPropertySet.hpp>
      15             : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
      16             : 
      17             : using namespace css;
      18             : using namespace css::uno;
      19             : 
      20             : namespace sc_apitest {
      21             : 
      22             : #define NUMBER_OF_TESTS 11
      23             : 
      24          22 : class ScTableSheetsObj : public CalcUnoApiTest, public ::apitest::XSpreadsheets2, apitest::XNameContainer
      25             : {
      26             : public:
      27             :     ScTableSheetsObj();
      28             : 
      29             :     virtual void setUp() SAL_OVERRIDE;
      30             :     virtual void tearDown() SAL_OVERRIDE;
      31             : 
      32           2 :     CPPUNIT_TEST_SUITE(ScTableSheetsObj);
      33           1 :     CPPUNIT_TEST(testImportedSheetNameAndIndex);
      34           1 :     CPPUNIT_TEST(testImportString);
      35           1 :     CPPUNIT_TEST(testImportValue);
      36           1 :     CPPUNIT_TEST(testImportFormulaBasicMath);
      37           1 :     CPPUNIT_TEST(testImportFormulaWithNamedRange);
      38           1 :     CPPUNIT_TEST(testImportOverExistingNamedRange);
      39           1 :     CPPUNIT_TEST(testImportNamedRangeDefinedInSource);
      40           1 :     CPPUNIT_TEST(testImportNamedRangeRedefinedInSource);
      41           1 :     CPPUNIT_TEST(testImportNewNamedRange);
      42           1 :     CPPUNIT_TEST(testImportCellStyle);
      43           1 :     CPPUNIT_TEST(testRemoveByName);
      44           5 :     CPPUNIT_TEST_SUITE_END();
      45             : 
      46             :     virtual uno::Reference< lang::XComponent > getComponent() SAL_OVERRIDE;
      47             :     virtual void createFileURL(const OUString& rFileBase, OUString& rFileURL) SAL_OVERRIDE;
      48             :     virtual uno::Reference< lang::XComponent > loadFromDesktop(const OUString& rString) SAL_OVERRIDE;
      49             :     virtual uno::Reference< uno::XInterface > init() SAL_OVERRIDE;
      50             : protected:
      51             :     static uno::Reference< lang::XComponent > mxComponent;
      52             :     static sal_Int32 nTest;
      53             : };
      54             : 
      55           1 : uno::Reference< lang::XComponent > ScTableSheetsObj::mxComponent;
      56             : sal_Int32 ScTableSheetsObj::nTest = 0;
      57             : 
      58          11 : ScTableSheetsObj::ScTableSheetsObj():
      59             :             CalcUnoApiTest("/sc/qa/extras/testdocuments"),
      60          11 :             apitest::XNameContainer(OUString("Sheet2"))
      61             : {
      62             : 
      63          11 : }
      64             : 
      65           0 : uno::Reference< lang::XComponent > ScTableSheetsObj::getComponent()
      66             : {
      67           0 :     return mxComponent;
      68             : }
      69             : 
      70          21 : void ScTableSheetsObj::createFileURL(const OUString& rFileBase, OUString& rFileURL)
      71             : {
      72          21 :     CalcUnoApiTest::createFileURL(rFileBase, rFileURL);
      73          21 : }
      74             : 
      75          11 : uno::Reference< lang::XComponent > ScTableSheetsObj::loadFromDesktop(const OUString& rString)
      76             : {
      77          11 :     return CalcUnoApiTest::loadFromDesktop(rString);
      78             : }
      79             : 
      80          11 : uno::Reference< uno::XInterface > ScTableSheetsObj::init()
      81             : {
      82          11 :     OUString aFileURL;
      83          11 :     createFileURL(OUString("rangenamessrc.ods"), aFileURL);
      84          11 :     if(!mxComponent.is())
      85           1 :         mxComponent = loadFromDesktop(aFileURL);
      86          11 :     CPPUNIT_ASSERT(mxComponent.is());
      87          11 :     xDocument = uno::Reference< sheet::XSpreadsheetDocument >(mxComponent, UNO_QUERY_THROW);
      88          11 :     uno::Reference< uno::XInterface > xReturn( xDocument->getSheets(), UNO_QUERY_THROW);
      89             : 
      90          11 :     return xReturn;
      91             : }
      92             : 
      93          11 : void ScTableSheetsObj::setUp()
      94             : {
      95          11 :     nTest++;
      96          11 :     CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
      97          11 :     CalcUnoApiTest::setUp();
      98          11 : }
      99             : 
     100          11 : void ScTableSheetsObj::tearDown()
     101             : {
     102          11 :     if (nTest == NUMBER_OF_TESTS)
     103             :     {
     104           1 :         closeDocument(mxComponent);
     105           1 :         mxComponent.clear();
     106             :     }
     107             : 
     108          11 :     CalcUnoApiTest::tearDown();
     109          11 : }
     110             : 
     111           1 : CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetsObj);
     112             : 
     113             : }
     114             : 
     115           4 : CPPUNIT_PLUGIN_IMPLEMENT();
     116             : 
     117             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11