LCOV - code coverage report
Current view: top level - test/source/sheet - xcellrangesquery.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 57 0.0 %
Date: 2014-04-14 Functions: 0 9 0.0 %
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/sheet/xcellrangesquery.hxx>
      11             : 
      12             : #include <com/sun/star/sheet/XCellRangesQuery.hpp>
      13             : #include <com/sun/star/sheet/XSheetCellRanges.hpp>
      14             : #include <com/sun/star/table/CellAddress.hpp>
      15             : #include <com/sun/star/sheet/CellFlags.hpp>
      16             : 
      17             : #include "cppunit/extensions/HelperMacros.h"
      18             : 
      19             : using namespace com::sun::star;
      20             : using namespace com::sun::star::uno;
      21             : 
      22             : 
      23             : namespace apitest {
      24             : 
      25           0 : void XCellRangesQuery::testQueryColumnDifference()
      26             : {
      27           0 :     OUString aExpected( "Sheet1.B1:C1,Sheet1.B3:C5" );
      28           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      29           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryColumnDifferences(table::CellAddress(0, 1, 1));
      30           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      31           0 :     std::cout << "testQueryColumnDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      32           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryColumnDifference", aResult, aExpected);
      33           0 : }
      34             : 
      35           0 : void XCellRangesQuery::testQueryContentDifference()
      36             : {
      37           0 :     OUString aExpected( "Sheet1.B2:B3" );
      38           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      39           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryContentCells(sheet::CellFlags::VALUE);
      40           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      41           0 :     std::cout << "testQueryContentDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      42           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryContentDifference", aResult, aExpected);
      43           0 : }
      44             : 
      45           0 : void XCellRangesQuery::testQueryEmptyCells()
      46             : {
      47           0 :     OUString aExpected( "Sheet1.A1:A5,Sheet1.B1:C1,Sheet1.B5,Sheet1.C3:C5,Sheet1.D1:D5" );
      48           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      49           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryEmptyCells();
      50           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      51           0 :     std::cout << "testQueryEmptyCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      52           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryEmptyCells", aResult, aExpected);
      53           0 : }
      54             : 
      55           0 : void XCellRangesQuery::testQueryFormulaCells()
      56             : {
      57           0 :     OUString aExpected( "Sheet1.C2" );
      58           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      59           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryFormulaCells(sheet::CellFlags::FORMULA);
      60           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      61           0 :     std::cout << "testQueryFormulaCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      62           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryFormulaCells", aResult, aExpected);
      63           0 : }
      64             : 
      65           0 : void XCellRangesQuery::testQueryIntersection()
      66             : {
      67           0 :     OUString aExpected( "Sheet1.D4:D5" );
      68           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      69           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryIntersection(table::CellRangeAddress(0,3,3,7,7));
      70           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      71           0 :     std::cout << "testQueryIntersection: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      72           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryIntersection", aResult, aExpected);
      73           0 : }
      74             : 
      75           0 : void XCellRangesQuery::testQueryRowDifference()
      76             : {
      77           0 :     OUString aExpected( "Sheet1.A2:A4,Sheet1.C2:D4" );
      78           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      79           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryRowDifferences(table::CellAddress(0,1,1));
      80           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      81           0 :     std::cout << "testQueryRowDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      82           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryRowDifference", aResult, aExpected);
      83           0 : }
      84             : 
      85           0 : void XCellRangesQuery::testQueryVisibleCells()
      86             : {
      87           0 :     OUString aExpected( "Sheet1.A1:D5" );
      88           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      89           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryVisibleCells();
      90           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      91           0 :     std::cout << "testQueryVisibleCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      92           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryVisibleCells", aResult, aExpected);
      93           0 : }
      94             : 
      95           0 : }
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10