LCOV - code coverage report
Current view: top level - sfx2/qa/cppunit - test_controlleritem.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 16 16 100.0 %
Date: 2015-06-13 12:38:46 Functions: 18 19 94.7 %
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 <sal/types.h>
      11             : #include <cppunit/TestAssert.h>
      12             : #include <cppunit/TestFixture.h>
      13             : #include <cppunit/extensions/HelperMacros.h>
      14             : #include <cppunit/plugin/TestPlugIn.h>
      15             : 
      16             : #include <sfx2/ctrlitem.hxx>
      17             : #include <sfx2/bindings.hxx>
      18             : 
      19             : namespace {
      20             : 
      21           3 : class ControllerItemTest
      22             :     : public ::CppUnit::TestFixture
      23             : {
      24             : public:
      25           1 :     virtual void setUp() SAL_OVERRIDE {}
      26           1 :     virtual void tearDown() SAL_OVERRIDE {}
      27             : 
      28             :     void test();
      29             : 
      30           2 :     CPPUNIT_TEST_SUITE(ControllerItemTest);
      31           1 :     CPPUNIT_TEST(test);
      32           5 :     CPPUNIT_TEST_SUITE_END();
      33             : 
      34             : private:
      35             : };
      36             : 
      37             : static bool bDeleted = false;
      38             : 
      39             : class FooController : public SfxControllerItem {
      40             : public:
      41           1 :     FooController() : SfxControllerItem() {}
      42           2 :     virtual ~FooController() { bDeleted = true; }
      43             : };
      44             : 
      45           1 : void ControllerItemTest::test()
      46             : {
      47           1 :     FooController *pController(new FooController());
      48             : 
      49             :     // TESTME: binding, un-binding, re-binding, IsBound, SetId etc.
      50             : 
      51           1 :     pController->dispose();
      52           1 :     delete pController;
      53           1 :     CPPUNIT_ASSERT( bDeleted );
      54           1 : }
      55             : 
      56           1 : CPPUNIT_TEST_SUITE_REGISTRATION(ControllerItemTest);
      57             : 
      58             : }
      59             : 
      60           4 : CPPUNIT_PLUGIN_IMPLEMENT();
      61             : 
      62             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11