LCOV - code coverage report
Current view: top level - test/source/container - xnamecontainer.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 16 18 88.9 %
Date: 2015-06-13 12:38:46 Functions: 4 5 80.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/container/xnamecontainer.hxx>
      11             : #include <com/sun/star/container/XNameContainer.hpp>
      12             : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
      13             : 
      14             : #include "cppunit/extensions/HelperMacros.h"
      15             : #include <iostream>
      16             : 
      17             : using namespace css;
      18             : using namespace css::uno;
      19             : 
      20             : namespace apitest {
      21             : 
      22           0 : XNameContainer::XNameContainer(): maNameToRemove("XNameContainer")
      23             : {
      24           0 : }
      25             : 
      26          11 : XNameContainer::XNameContainer(const OUString& rNameToRemove):
      27          11 :         maNameToRemove(rNameToRemove)
      28             : {
      29          11 : }
      30             : 
      31           1 : void XNameContainer::testRemoveByName()
      32             : {
      33           1 :     uno::Reference< container::XNameContainer > xNameContainer(init(),UNO_QUERY_THROW);
      34           1 :     CPPUNIT_ASSERT(xNameContainer->hasByName(maNameToRemove));
      35           1 :     xNameContainer->removeByName(maNameToRemove);
      36           1 :     CPPUNIT_ASSERT(!xNameContainer->hasByName(maNameToRemove));
      37             : 
      38           1 :     bool bExceptionThrown = false;
      39             :     try
      40             :     {
      41           1 :         xNameContainer->removeByName(maNameToRemove);
      42             :     }
      43           1 :     catch( const container::NoSuchElementException& )
      44             :     {
      45           1 :         std::cout << "Exception Caught" << std::endl;
      46           1 :         bExceptionThrown = true;
      47             :     }
      48             : 
      49           1 :     CPPUNIT_ASSERT_MESSAGE("no exception thrown", bExceptionThrown);
      50           1 : }
      51             : 
      52          90 : }
      53             : 
      54             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11