LCOV - code coverage report
Current view: top level - libreoffice/test/source/sheet - xcellrangesquery.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 57 0.0 %
Date: 2012-12-27 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             :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       4             :  *
       5             :  * The contents of this file are subject to the Mozilla Public License Version
       6             :  * 1.1 (the "License"); you may not use this file except in compliance with
       7             :  * the License or as specified alternatively below. You may obtain a copy of
       8             :  * the License at http://www.mozilla.org/MPL/
       9             :  *
      10             :  * Software distributed under the License is distributed on an "AS IS" basis,
      11             :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12             :  * for the specific language governing rights and limitations under the
      13             :  * License.
      14             :  *
      15             :  * Major Contributor(s):
      16             :  * [ Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer) ]
      17             :  *
      18             :  * All Rights Reserved.
      19             :  *
      20             :  * For minor contributions see the git repository.
      21             :  *
      22             :  * Alternatively, the contents of this file may be used under the terms of
      23             :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      24             :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      25             :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      26             :  * instead of those above.
      27             :  */
      28             : 
      29             : #include <test/sheet/xcellrangesquery.hxx>
      30             : 
      31             : #include <com/sun/star/sheet/XCellRangesQuery.hpp>
      32             : #include <com/sun/star/sheet/XSheetCellRanges.hpp>
      33             : #include <com/sun/star/table/CellAddress.hpp>
      34             : #include <com/sun/star/sheet/CellFlags.hpp>
      35             : 
      36             : #include "cppunit/extensions/HelperMacros.h"
      37             : 
      38             : using namespace com::sun::star;
      39             : using namespace com::sun::star::uno;
      40             : 
      41             : 
      42             : namespace apitest {
      43             : 
      44           0 : void XCellRangesQuery::testQueryColumnDifference()
      45             : {
      46           0 :     OUString aExpected( "Sheet1.B1:C1,Sheet1.B3:C5" );
      47           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      48           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryColumnDifferences(table::CellAddress(0, 1, 1));
      49           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      50           0 :     std::cout << "testQueryColumnDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      51           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryColumnDifference", aResult, aExpected);
      52           0 : }
      53             : 
      54           0 : void XCellRangesQuery::testQueryContentDifference()
      55             : {
      56           0 :     OUString aExpected( "Sheet1.B2:B3" );
      57           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      58           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryContentCells(sheet::CellFlags::VALUE);
      59           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      60           0 :     std::cout << "testQueryContentDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      61           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryContentDifference", aResult, aExpected);
      62           0 : }
      63             : 
      64           0 : void XCellRangesQuery::testQueryEmptyCells()
      65             : {
      66           0 :     OUString aExpected( "Sheet1.A1:A5,Sheet1.B1:C1,Sheet1.B5,Sheet1.C3:C5,Sheet1.D1:D5" );
      67           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      68           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryEmptyCells();
      69           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      70           0 :     std::cout << "testQueryEmptyCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      71           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryEmptyCells", aResult, aExpected);
      72           0 : }
      73             : 
      74           0 : void XCellRangesQuery::testQueryFormulaCells()
      75             : {
      76           0 :     OUString aExpected( "Sheet1.C2" );
      77           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      78           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryFormulaCells(sheet::CellFlags::FORMULA);
      79           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      80           0 :     std::cout << "testQueryFormulaCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      81           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryFormulaCells", aResult, aExpected);
      82           0 : }
      83             : 
      84           0 : void XCellRangesQuery::testQueryIntersection()
      85             : {
      86           0 :     OUString aExpected( "Sheet1.D4:D5" );
      87           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      88           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryIntersection(table::CellRangeAddress(0,3,3,7,7));
      89           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
      90           0 :     std::cout << "testQueryIntersection: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
      91           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryIntersection", aResult, aExpected);
      92           0 : }
      93             : 
      94           0 : void XCellRangesQuery::testQueryRowDifference()
      95             : {
      96           0 :     OUString aExpected( "Sheet1.A2:A4,Sheet1.C2:D4" );
      97           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
      98           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryRowDifferences(table::CellAddress(0,1,1));
      99           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
     100           0 :     std::cout << "testQueryRowDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
     101           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryRowDifference", aResult, aExpected);
     102           0 : }
     103             : 
     104           0 : void XCellRangesQuery::testQueryVisibleCells()
     105             : {
     106           0 :     OUString aExpected( "Sheet1.A1:D5" );
     107           0 :     uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
     108           0 :     uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryVisibleCells();
     109           0 :     OUString aResult = xRanges->getRangeAddressesAsString();
     110           0 :     std::cout << "testQueryVisibleCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
     111           0 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryVisibleCells", aResult, aExpected);
     112           0 : }
     113             : 
     114           0 : }
     115             : 
     116             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10