Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
        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
Ejemplo n.º 3
0
 def test_SDL_UserEvent(self):
     event = events.SDL_UserEvent()
     self.assertIsInstance(event, events.SDL_UserEvent)
Ejemplo n.º 4
0
 def test_SDL_UserEvent(self):
     event = events.SDL_UserEvent()
     assert isinstance(event, events.SDL_UserEvent)