LCOV - code coverage report
Current view: top level - test/source/sheet - xcellrangedata.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 29 29 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 100.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/xcellrangedata.hxx>
      11             : #include <com/sun/star/sheet/XCellRangeData.hpp>
      12             : 
      13             : #include "cppunit/extensions/HelperMacros.h"
      14             : 
      15             : using namespace css;
      16             : using namespace css::uno;
      17             : 
      18             : namespace apitest {
      19             : 
      20             : namespace {
      21             : 
      22           2 : void setValues(uno::Sequence< uno::Sequence < Any > >& rColRow, double nOffset)
      23             : {
      24          10 :     for (sal_Int32 i = 0; i < 4; ++i)
      25             :     {
      26           8 :         rColRow[i].realloc(4);
      27          40 :         for (sal_Int32 j = 0; j < 4; ++j)
      28             :         {
      29          32 :             Any& aAny = rColRow[i][j];
      30          32 :             double nValue = i + j + nOffset;
      31          32 :             aAny <<= nValue;
      32             :         }
      33             :     }
      34           2 : }
      35             : 
      36             : }
      37             : 
      38           1 : void XCellRangeData::testSetDataArray()
      39             : {
      40           1 :     uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW);
      41             : 
      42           2 :     uno::Sequence< uno::Sequence < Any > > aColRow;
      43           1 :     aColRow.realloc(4);
      44           1 :     setValues(aColRow, 1);
      45           1 :     xCellRangeData->setDataArray(aColRow);
      46             :     // need to check here for correct values
      47             : 
      48             :     // set old values
      49           1 :     setValues(aColRow, 0);
      50           2 :     xCellRangeData->setDataArray(aColRow);
      51           1 : }
      52             : 
      53           1 : void XCellRangeData::testGetDataArray()
      54             : {
      55           1 :     uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW);
      56           2 :     uno::Sequence< uno::Sequence < Any > > aColRow = xCellRangeData->getDataArray();
      57           5 :     for ( sal_Int32 i = 0; i < aColRow.getLength(); ++i)
      58             :     {
      59          20 :         for ( sal_Int32 j = 0; j < aColRow[i].getLength(); ++j)
      60             :         {
      61          16 :             Any& aAny = aColRow[i][j];
      62          16 :             double nValue = 0.0;
      63          16 :             CPPUNIT_ASSERT( aAny >>= nValue);
      64          16 :             CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(i+j), nValue, 0.000001);
      65             :         }
      66           1 :     }
      67           1 : }
      68             : 
      69          90 : }
      70             : 
      71             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11