Ejemplo n.º 1
0
 def test_SDL_SetHint(self):
     self.assertEqual(hints.SDL_SetHint(b"TEST", b"32"), 1)
     self.assertEqual(hints.SDL_GetHint(b"TEST"), b"32")
     self.assertEqual(hints.SDL_SetHint(b"TEST", b"abcdef"), 1)
     self.assertEqual(hints.SDL_GetHint(b"TEST"), b"abcdef")
     self.assertEqual(hints.SDL_SetHint(b"", b""), 1)
     self.assertEqual(hints.SDL_GetHint(b""), b"")
Ejemplo n.º 2
0
 def test_SDL_SetHint(self):
     assert hints.SDL_SetHint(b"TEST", b"32") == 1
     assert hints.SDL_GetHint(b"TEST") == b"32"
     assert hints.SDL_SetHint(b"TEST", b"abcdef") == 1
     assert hints.SDL_GetHint(b"TEST") == b"abcdef"
     assert hints.SDL_SetHint(b"", b"") == 1
     assert hints.SDL_GetHint(b"") == b""
Ejemplo n.º 3
0
 def test_SDL_GetHint(self):
     self.assertEqual(hints.SDL_SetHint(b"TEST", b"32"), 1)
     self.assertEqual(hints.SDL_GetHint(b"TEST"), b"32")
     self.assertEqual(hints.SDL_SetHint(hints.SDL_HINT_ALLOW_TOPMOST,
                                        b"true"), 1)
     self.assertEqual(hints.SDL_GetHint(hints.SDL_HINT_ALLOW_TOPMOST),
                      b"true")
Ejemplo n.º 4
0
 def test_SDL_GetHintBoolean(self):
     self.assertEqual(hints.SDL_SetHint(b"TEST", b"32"), 1)
     self.assertEqual(hints.SDL_GetHintBoolean(b"TEST", SDL_TRUE), SDL_TRUE)
     self.assertEqual(hints.SDL_GetHintBoolean(b"TEST", SDL_FALSE),
                      SDL_TRUE)
     self.assertNotEqual(hints.SDL_GetHintBoolean(b"TEST2", SDL_FALSE),
                         SDL_TRUE)
Ejemplo n.º 5
0
 def test_SDL_AddDelHintCallback(self):
     calls = []
     def callback(userdata, name, oldval, newval):
         data = cast(userdata, c_char_p)
         calls.append((data.value, name, oldval, newval))
     hintcb = hints.SDL_HintCallback(callback)
     udata = c_char_p(b"banana")
     hints.SDL_AddHintCallback(hints.SDL_HINT_ALLOW_TOPMOST, hintcb,
                               udata)
     # SDL_AddHintCallback invokes the callback once.
     self.assertEqual(len(calls), 1)
     self.assertEqual(calls[0], (b"banana", hints.SDL_HINT_ALLOW_TOPMOST,
                                 None, None))
     hints.SDL_SetHint(hints.SDL_HINT_ALLOW_TOPMOST, b"true")
     self.assertEqual(len(calls), 2)
     self.assertEqual(calls[1], (b"banana", hints.SDL_HINT_ALLOW_TOPMOST,
                                 None, b"true"))
     hints.SDL_DelHintCallback(hints.SDL_HINT_ALLOW_TOPMOST, hintcb,
                               udata)
     hints.SDL_SetHint(hints.SDL_HINT_ALLOW_TOPMOST, b"false")
     self.assertEqual(len(calls), 2)
Ejemplo n.º 6
0
 def test_SDL_ClearHints(self):
     self.assertEqual(hints.SDL_SetHint(b"TEST", b"32"), 1)
     self.assertEqual(hints.SDL_GetHint(b"TEST"), b"32")
     hints.SDL_ClearHints()
     self.assertEqual(hints.SDL_GetHint(b"TEST"), None)
Ejemplo n.º 7
0
 def test_SDL_GetHintBoolean(self):
     assert hints.SDL_SetHint(b"TEST", b"32") == 1
     assert hints.SDL_GetHintBoolean(b"TEST", SDL_TRUE) == SDL_TRUE
     assert hints.SDL_GetHintBoolean(b"TEST", SDL_FALSE) == SDL_TRUE
     assert hints.SDL_GetHintBoolean(b"TEST2", SDL_FALSE) != SDL_TRUE
Ejemplo n.º 8
0
 def test_SDL_GetHint(self):
     assert hints.SDL_SetHint(b"TEST", b"32") == 1
     assert hints.SDL_GetHint(b"TEST") == b"32"
     assert hints.SDL_SetHint(hints.SDL_HINT_ALLOW_TOPMOST, b"true") == 1
     assert hints.SDL_GetHint(hints.SDL_HINT_ALLOW_TOPMOST) == b"true"
Ejemplo n.º 9
0
 def test_SDL_ClearHints(self):
     assert hints.SDL_SetHint(b"TEST", b"32") == 1
     assert hints.SDL_GetHint(b"TEST") == b"32"
     hints.SDL_ClearHints()
     assert hints.SDL_GetHint(b"TEST") == None