LCOV - code coverage report
Current view: top level - test/source/sheet - xcellrangesquery.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 49 57 86.0 %
Date: 2015-06-13 12:38:46 Functions: 8 9 88.9 %
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           1 : void XCellRangesQuery::testQueryColumnDifference()
      26             : {
      27           1 :     OUString aExpected( "Sheet1.B1:C1,Sheet1.B3:C5" );
      28           2 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      29           2 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryColumnDifferences(table::CellAddress(0, 1, 1));
      30           2 :     OUString aResult = xRanges->getRangeAddressesAsString();
      31           1 :     std::cout << "testQueryColumnDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      32           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryColumnDifference", aResult, aExpected);
      33           1 : }
      34             : 
      35           1 : void XCellRangesQuery::testQueryContentDifference()
      36             : {
      37           1 :     OUString aExpected( "Sheet1.B2:B3" );
      38           2 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      39           2 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryContentCells(sheet::CellFlags::VALUE);
      40           2 :     OUString aResult = xRanges->getRangeAddressesAsString();
      41           1 :     std::cout << "testQueryContentDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      42           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryContentDifference", aResult, aExpected);
      43           1 : }
      44             : 
      45           1 : void XCellRangesQuery::testQueryEmptyCells()
      46             : {
      47           1 :     OUString aExpected( "Sheet1.A1:A5,Sheet1.B1:C1,Sheet1.B5,Sheet1.C3:C5,Sheet1.D1:D5" );
      48           2 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      49           2 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryEmptyCells();
      50           2 :     OUString aResult = xRanges->getRangeAddressesAsString();
      51           1 :     std::cout << "testQueryEmptyCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      52           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryEmptyCells", aResult, aExpected);
      53           1 : }
      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           1 : void XCellRangesQuery::testQueryIntersection()
      66             : {
      67           1 :     OUString aExpected( "Sheet1.D4:D5" );
      68           2 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      69           2 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryIntersection(table::CellRangeAddress(0,3,3,7,7));
      70           2 :     OUString aResult = xRanges->getRangeAddressesAsString();
      71           1 :     std::cout << "testQueryIntersection: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      72           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryIntersection", aResult, aExpected);
      73           1 : }
      74             : 
      75           1 : void XCellRangesQuery::testQueryRowDifference()
      76             : {
      77           1 :     OUString aExpected( "Sheet1.A2:A4,Sheet1.C2:D4" );
      78           2 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      79           2 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryRowDifferences(table::CellAddress(0,1,1));
      80           2 :     OUString aResult = xRanges->getRangeAddressesAsString();
      81           1 :     std::cout << "testQueryRowDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      82           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryRowDifference", aResult, aExpected);
      83           1 : }
      84             : 
      85           1 : void XCellRangesQuery::testQueryVisibleCells()
      86             : {
      87           1 :     OUString aExpected( "Sheet1.A1:D5" );
      88           2 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      89           2 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryVisibleCells();
      90           2 :     OUString aResult = xRanges->getRangeAddressesAsString();
      91           1 :     std::cout << "testQueryVisibleCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      92           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryVisibleCells", aResult, aExpected);
      93           1 : }
      94             : 
      95          90 : }
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11