[pypy-svn] r55014 - in pypy/dist/pypy/rlib/rsdl: . test

cami at codespeak.net cami at codespeak.net
Tue May 20 17:07:45 CEST 2008


Author: cami
Date: Tue May 20 17:07:43 2008
New Revision: 55014

Modified:
   pypy/dist/pypy/rlib/rsdl/RSDL.py
   pypy/dist/pypy/rlib/rsdl/test/test_basic.py
   pypy/dist/pypy/rlib/rsdl/test/test_video.py
Log:
remove misleading comment in test_video
added GetKeyName to resolve a KeySym


Modified: pypy/dist/pypy/rlib/rsdl/RSDL.py
==============================================================================
--- pypy/dist/pypy/rlib/rsdl/RSDL.py	(original)
+++ pypy/dist/pypy/rlib/rsdl/RSDL.py	Tue May 20 17:07:43 2008
@@ -43,6 +43,7 @@
 KeyboardEventPtr    = lltype.Ptr(lltype.ForwardReference())
 MouseButtonEventPtr = lltype.Ptr(lltype.ForwardReference())
 MouseMotionEventPtr = lltype.Ptr(lltype.ForwardReference())
+KeyPtr              = lltype.Ptr(lltype.ForwardReference())
 
 # ------------------------------------------------------------------------------
 
@@ -225,6 +226,10 @@
                             [SurfacePtr, rffi.INT, rffi.INT, rffi.INT],
                             lltype.Void)
 
+GetKeyName       = external('SDL_GetKeyName',
+                            [rffi.INT], 
+                            rffi.CCHARP)
+
 # ------------------------------------------------------------------------------
 
 

Modified: pypy/dist/pypy/rlib/rsdl/test/test_basic.py
==============================================================================
--- pypy/dist/pypy/rlib/rsdl/test/test_basic.py	(original)
+++ pypy/dist/pypy/rlib/rsdl/test/test_basic.py	Tue May 20 17:07:43 2008
@@ -20,3 +20,11 @@
     assert rffi.getintfield(surface, 'c_h') == 50
     RSDL.FreeSurface(surface)
     RSDL.Quit()
+    
+    
+def test_get_keyname():
+    assert RSDL.Init(RSDL.INIT_VIDEO) >= 0
+    assert RSDL.GetKeyName(RSDL.K_PLUS)[0] == '+'
+    assert RSDL.GetKeyName(RSDL.K_RIGHTPAREN)[0] == ')'
+    assert RSDL.GetKeyName(RSDL.K_z)[0] == 'z'
+    

Modified: pypy/dist/pypy/rlib/rsdl/test/test_video.py
==============================================================================
--- pypy/dist/pypy/rlib/rsdl/test/test_video.py	(original)
+++ pypy/dist/pypy/rlib/rsdl/test/test_video.py	Tue May 20 17:07:43 2008
@@ -84,7 +84,7 @@
         RSDL.EnableUNICODE(1)
         print
         print "Keys pressed in the Pygame window give a dot."
-        print "    Use Escape or wait 3 seconds to quit."
+        print "    Wait 3 seconds to quit."
         timeout = time.time() + 3
         event = lltype.malloc(RSDL.Event, flavor='raw')
         try:
@@ -148,7 +148,7 @@
             py.test.skip("interactive test only")
         print
         print "Press the given MouseButtons:"
-        print "        Use Escape to quit."
+        print "        Use Escape to pass tests."
         
         event_tests = [("left button",   RSDL.BUTTON_LEFT),
                        ("middle button", RSDL.BUTTON_MIDDLE),



More information about the Pypy-commit mailing list