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 class ControllerItemTest 22 : public ::CppUnit::TestFixture 23 { 24 public: 25 void test(); 26 27 CPPUNIT_TEST_SUITE(ControllerItemTest); 28 CPPUNIT_TEST(test); 29 CPPUNIT_TEST_SUITE_END(); 30 31 private: 32 }; 33 34 static bool bDeleted = false; 35 36 class FooController : public SfxControllerItem { 37 public: FooController()38 FooController() : SfxControllerItem() {} ~FooController()39 virtual ~FooController() override { bDeleted = true; } 40 }; 41 test()42void ControllerItemTest::test() 43 { 44 FooController *pController(new FooController()); 45 46 // TESTME: binding, un-binding, re-binding, IsBound, SetId etc. 47 48 pController->dispose(); 49 delete pController; 50 CPPUNIT_ASSERT( bDeleted ); 51 } 52 53 CPPUNIT_TEST_SUITE_REGISTRATION(ControllerItemTest); 54 55 } 56 57 CPPUNIT_PLUGIN_IMPLEMENT(); 58 59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 60