-void EvtHandlerTestCase::TestEventFunctorCompare()
-{
-//#if !wxEVENTS_COMPATIBILITY_2_8
-// MyHandler handler1;
-// wxEventFunctor *connectFunctor = wxNewEventFunctor( EVT_EVENT, &MyHandler::handleMethod, &handler1 );
-// wxEventFunctor *disconnectFunctor = wxNewEventFunctor( EVT_EVENT, &MyHandler::handleMethod, &handler1 );
-// wxEventFunctor *nullFunctor = wxNewEventFunctor( EVT_EVENT, &MyHandler::handleMethod );
-//
-// CPPUNIT_ASSERT( connectFunctor->Matches( *disconnectFunctor ));
-// CPPUNIT_ASSERT( disconnectFunctor->Matches( *connectFunctor ));
-//
-// CPPUNIT_ASSERT( connectFunctor->Matches( *nullFunctor ));
-// CPPUNIT_ASSERT( nullFunctor->Matches( *connectFunctor ));
-//
-// CPPUNIT_ASSERT( disconnectFunctor->Matches( *nullFunctor ));
-// CPPUNIT_ASSERT( nullFunctor->Matches( *disconnectFunctor ));
-//#endif
+void EvtHandlerTestCase::BindMethodUsingBaseEvent()
+{
+ // test connecting a method taking just wxEvent and not MyEvent: this
+ // should work too if we don't need any MyEvent-specific information in the
+ // handler
+ handler.Bind( MyEventType, &MyHandler::OnEvent, &handler );
+ g_called.Reset();
+ handler.ProcessEvent(e);
+ CPPUNIT_ASSERT( g_called.method );
+ handler.Unbind( MyEventType, &MyHandler::OnEvent, &handler );
+ g_called.Reset();
+ handler.ProcessEvent(e);
+ CPPUNIT_ASSERT( !g_called.method );
+
+ handler.Bind( MyEventType, &MyHandler::OnEvent, &handler, 0 );
+ handler.Unbind( MyEventType, &MyHandler::OnEvent, &handler, 0 );
+
+ handler.Bind( MyEventType, &MyHandler::OnEvent, &handler, 0, 0 );
+ handler.Unbind( MyEventType, &MyHandler::OnEvent, &handler, 0, 0 );
+}
+
+
+void EvtHandlerTestCase::BindFunctionUsingBaseEvent()
+{
+ // test connecting a function taking just wxEvent and not MyEvent: this
+ // should work too if we don't need any MyEvent-specific information in the
+ // handler
+ handler.Bind( MyEventType, GlobalOnEvent );
+ g_called.Reset();
+ handler.ProcessEvent(e);
+ CPPUNIT_ASSERT( g_called.function );
+ handler.Unbind( MyEventType, GlobalOnEvent );
+ g_called.Reset();
+ handler.ProcessEvent(e);
+ CPPUNIT_ASSERT( !g_called.function );
+
+ handler.Bind( MyEventType, GlobalOnEvent, 0 );
+ handler.Unbind( MyEventType, GlobalOnEvent, 0 );
+
+ handler.Bind( MyEventType, GlobalOnEvent, 0, 0 );
+ handler.Unbind( MyEventType, GlobalOnEvent, 0, 0 );
+}
+
+
+
+void EvtHandlerTestCase::BindNonHandler()
+{
+ // class method tests for class not derived from wxEvtHandler
+ MySink sink;
+
+ handler.Bind( MyEventType, &MySink::OnMyEvent, &sink );
+ g_called.Reset();
+ handler.ProcessEvent(e);
+ CPPUNIT_ASSERT( g_called.method );
+ handler.Unbind( MyEventType, &MySink::OnMyEvent, &sink );
+ g_called.Reset();
+ handler.ProcessEvent(e);
+ CPPUNIT_ASSERT( !g_called.method );