LCOV - code coverage report
Current view: top level - test/source/container - xindexaccess.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 25 4.0 %
Date: 2014-11-03 Functions: 2 6 33.3 %
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/container/xindexaccess.hxx>
      11             : #include <com/sun/star/container/XIndexAccess.hpp>
      12             : #include "cppunit/extensions/HelperMacros.h"
      13             : 
      14             : using namespace css;
      15             : using namespace css::uno;
      16             : 
      17             : namespace apitest {
      18             : 
      19           0 : XIndexAccess::XIndexAccess(sal_Int32 nItems):
      20           0 :     mnItems(nItems)
      21             : {
      22           0 : }
      23             : 
      24           0 : void XIndexAccess::testGetCount()
      25             : {
      26           0 :     uno::Reference< container::XIndexAccess > xIndexAccess(init(), UNO_QUERY_THROW);
      27           0 :     CPPUNIT_ASSERT(mnItems == xIndexAccess->getCount());
      28           0 : }
      29             : 
      30           0 : void XIndexAccess::testGetByIndex()
      31             : {
      32           0 :     uno::Reference< container::XIndexAccess > xIndexAccess(init(), UNO_QUERY_THROW);
      33           0 :     CPPUNIT_ASSERT(mnItems == xIndexAccess->getCount());
      34             : 
      35           0 :     if (mnItems > 0)
      36             :     {
      37           0 :         Any aAny = xIndexAccess->getByIndex(0);
      38           0 :         CPPUNIT_ASSERT(aAny.hasValue());
      39             : 
      40           0 :         aAny = xIndexAccess->getByIndex(mnItems/2);
      41           0 :         CPPUNIT_ASSERT(aAny.hasValue());
      42             : 
      43           0 :         aAny = xIndexAccess->getByIndex(mnItems-1);
      44           0 :         CPPUNIT_ASSERT(aAny.hasValue());
      45           0 :     }
      46           0 : }
      47             : 
      48           0 : void XIndexAccess::testGetByIndexException()
      49             : {
      50           0 :     uno::Reference< container::XIndexAccess > xIndexAccess(init(), UNO_QUERY_THROW);
      51           0 :     CPPUNIT_ASSERT(xIndexAccess.is());
      52             : 
      53           0 :     xIndexAccess->getByIndex(mnItems);
      54           0 : }
      55             : 
      56         144 : }
      57             : 
      58             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10