[ctypes-commit] ctypes/unittests test_functions.py,1.44,1.45
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2004-12-02 21:00:05
|
Update of /cvsroot/ctypes/ctypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv333 Modified Files: test_functions.py Log Message: Add stdcall tests for structure return types. Index: test_functions.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/unittests/test_functions.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** test_functions.py 2 Dec 2004 19:53:37 -0000 1.44 --- test_functions.py 2 Dec 2004 20:59:56 -0000 1.45 *************** *** 17,20 **** --- 17,22 ---- import _ctypes_test dll = CDLL(_ctypes_test.__file__) + if sys.platform == "win32": + windll = WinDLL(_ctypes_test.__file__) class FunctionTestCase(unittest.TestCase): *************** *** 337,340 **** --- 339,352 ---- self.failUnlessEqual((s2h.x, s2h.y), (42, 24)) + if sys.platform == "win32": + def test_struct_return_2H_stdcall(self): + class S2H(Structure): + _fields_ = [("x", c_short), + ("y", c_short)] + + windll.s_ret_2h_func.restype = S2H + s2h = windll.s_ret_2h_func() + self.failUnlessEqual((s2h.x, s2h.y), (42, 24)) + def test_struct_return_8H(self): class S8I(Structure): *************** *** 352,355 **** --- 364,383 ---- (1, 2, 3, 4, 5, 6, 7, 8)) + if sys.platform == "win32": + def test_struct_return_8H_stdcall(self): + class S8I(Structure): + _fields_ = [("a", c_int), + ("b", c_int), + ("c", c_int), + ("d", c_int), + ("e", c_int), + ("f", c_int), + ("g", c_int), + ("h", c_int)] + windll.s_ret_8i_func.restype = S8I + s8i = windll.s_ret_8i_func() + self.failUnlessEqual((s8i.a, s8i.b, s8i.c, s8i.d, s8i.e, s8i.f, s8i.g, s8i.h), + (1, 2, 3, 4, 5, 6, 7, 8)) + if __name__ == '__main__': unittest.main() |