Commits

metagriffin committed 11baed8

added pygame.fastevent.wait(timeout) unit test

Comments (0)

Files changed (1)

test/fastevent_test.py

 import pygame
 from pygame import event, fastevent
 from pygame.compat import geterror
+import time
 
 ################################################################################
 
         
         event.post(pygame.event.Event(1))
         self.assertEquals(fastevent.wait().type, 1, race_condition_notification)
+
+    def test_wait_timeout(self):
+        event.post(pygame.event.Event(1))
+        self.assertEquals(fastevent.wait(100).type, 1, race_condition_notification)
+        t0 = time.time()
+        self.assertTrue(fastevent.wait(100) is None)
+        t1 = time.time()
+        self.assertTrue(t1 - t0 < 0.11)
+        self.assertTrue(t1 - t0 > 0.09)
     
 ################################################################################