14#include <com/sun/star/lang/XComponent.hpp>
15#include <com/sun/star/lang/XEventListener.hpp>
17#include <cppunit/TestAssert.h>
20using namespace css::uno;
23struct TestEventListener final : ::cppu::WeakImplHelper<lang::XEventListener>
25 bool m_hasDisposingCalled;
27 : m_hasDisposingCalled(false)
30 virtual void SAL_CALL disposing(
const lang::EventObject&)
override
32 m_hasDisposingCalled =
true;
41 Reference<lang::XComponent> xComponent(
init(), uno::UNO_QUERY_THROW);
43 xComponent->addEventListener(pListenerAdded);
44 xComponent->dispose();
45 CPPUNIT_ASSERT_EQUAL(
true, pListenerAdded->m_hasDisposingCalled);
50 Reference<lang::XComponent> xComponent(
init(), uno::UNO_QUERY_THROW);
52 xComponent->addEventListener(pListenerAddedAndRemoved);
53 xComponent->removeEventListener(pListenerAddedAndRemoved);
54 xComponent->dispose();
55 CPPUNIT_ASSERT_EQUAL(
false, pListenerAddedAndRemoved->m_hasDisposingCalled);
60 Reference<lang::XComponent> xComponent(
init(), uno::UNO_QUERY_THROW);
62 xComponent->addEventListener(pListenerAdded);
63 xComponent->dispose();
64 CPPUNIT_ASSERT_EQUAL(
true, pListenerAdded->m_hasDisposingCalled);
69 Reference<lang::XComponent> xComponent(
init(), uno::UNO_QUERY_THROW);
71 xComponent->addEventListener(pListenerAdded);
73 CPPUNIT_ASSERT_EQUAL(
true, pListenerAdded->m_hasDisposingCalled);
void testAddEventListener()
void testRemoveEventListener()
virtual void triggerDesktopTerminate()=0
void testDisposedByDesktopTerminate()
virtual css::uno::Reference< css::uno::XInterface > init()=0