def test_SDL_AddDelEventWatch(self): eventwatch = [] def watch(data, event): eventwatch.append(( event.contents, data, )) return 0 efilter = events.SDL_EventFilter(watch) udata = c_char_p(b"Something random") events.SDL_AddEventWatch(efilter, cast(udata, c_void_p)) ev = events.SDL_Event() ev.type = events.SDL_USEREVENT ev.user = events.SDL_UserEvent() events.SDL_PushEvent(ev) self.assertEqual(len(eventwatch), 1) # TODO: x # self.assertEqual(eventwatch[0][1], udata) events.SDL_DelEventWatch(efilter, udata) ev = events.SDL_Event() events.SDL_PushEvent(ev) self.assertEqual(len(eventwatch), 1)
def oneSecondElapsed(time, userdata): event = sdlevents.SDL_Event() user_event = sdlevents.SDL_UserEvent() user_event.type = sdlevents.SDL_USEREVENT user_event.code = 0 user_event.data1 = cast(pointer(py_object(self)), c_void_p) user_event.data2 = 0 event.type = sdlevents.SDL_USEREVENT event.user = user_event sdlevents.SDL_PushEvent(event) return time
def test_SDL_Event(self): event = events.SDL_Event() self.assertIsInstance(event, events.SDL_Event)
def test_SDL_Event(self): event = events.SDL_Event() assert isinstance(event, events.SDL_Event)