LCOV - code coverage report
Current view: top level - test/source/container - xnamecontainer.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 16 18 88.9 %
Date: 2014-11-03 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          22 : XNameContainer::XNameContainer(const OUString& rNameToRemove):
      27          22 :         maNameToRemove(rNameToRemove)
      28             : {
      29          22 : }
      30             : 
      31           2 : void XNameContainer::testRemoveByName()
      32             : {
      33           2 :     uno::Reference< container::XNameContainer > xNameContainer(init(),UNO_QUERY_THROW);
      34           2 :     CPPUNIT_ASSERT(xNameContainer->hasByName(maNameToRemove));
      35           2 :     xNameContainer->removeByName(maNameToRemove);
      36           2 :     CPPUNIT_ASSERT(!xNameContainer->hasByName(maNameToRemove));
      37             : 
      38           2 :     bool bExceptionThrown = false;
      39             :     try
      40             :     {
      41           2 :         xNameContainer->removeByName(maNameToRemove);
      42             :     }
      43           2 :     catch( const container::NoSuchElementException& )
      44             :     {
      45           2 :         std::cout << "Exception Caught" << std::endl;
      46           2 :         bExceptionThrown = true;
      47             :     }
      48             : 
      49           2 :     CPPUNIT_ASSERT_MESSAGE("no exception thrown", bExceptionThrown);
      50           2 : }
      51             : 
      52         144 : }
      53             : 
      54             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10