Exemple #1
0
 def TestMethod(self, method):
     print 'Starting method', method
     module = pixel_format
     hdc = WGL.wglGetCurrentDC()
     items = [(name, getattr(module, name)) for name in names]
     failures = []
     if method == pixel_format.wglGetPixelFormatAttribivARB:
         result = WGL.INT32()
     else:
         result = WGL.FLOAT()
     for item in items:
         try:
             pf = WGL.GetPixelFormat(hdc)
             method(
                 hdc,
                 pf,
                 0,
                 1,
                 WGL.INT32(item[1]),
                 result,
             )
         except WindowsError, err:
             failures.append((item, err))
         else:
             print '%20s\t%r' % (item[0], result.value)
 def TestMethod( self, method ):
     print 'Starting method', method
     module = pixel_format
     hdc = WGL.wglGetCurrentDC()
     items = [(name,getattr( module, name)) for name in names ]
     failures = []
     if method == pixel_format.wglGetPixelFormatAttribivARB:
         result = WGL.INT32( )
     else:
         result = WGL.FLOAT( )
     for item in items:
         try:
             pf = WGL.GetPixelFormat(hdc)
             method(
                 hdc,
                 pf,
                 0,
                 1,
                 WGL.INT32(item[1]),
                 result,
             )
         except WindowsError as err:
             failures.append((item,err))
         else:
             print '%20s\t%r'%( item[0], result.value)
     if failures:
         print 'FAILURES'
         for ((name,value),err) in failures:
             print name, value, '->' as err
     items = [ getattr(module,name) for name in names ]
     try:
         method(
             hdc,
             WGL.GetPixelFormat(hdc),
             0,
             1,
             WGL.INT32(item[1]),
             result
         )
     except WindowsError as err:
         print method, 'failed on getting full set'
     else:
         print method, result