Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(96689)

Side by Side Diff: Lib/ctypes/test/test_win32.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/ctypes/test/test_values.py ('k') | Lib/ctypes/util.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Windows specific tests 1 # Windows specific tests
2 2
3 from ctypes import * 3 from ctypes import *
4 import os
4 import unittest, sys 5 import unittest, sys
5 from test import support 6 from test import support
6 7
7 import _ctypes_test 8 import _ctypes_test
8 9
9 # Only windows 32-bit has different calling conventions. 10 # Only windows 32-bit has different calling conventions.
10 @unittest.skipUnless(sys.platform == "win32", 'Windows-specific test') 11 @unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
11 @unittest.skipUnless(sizeof(c_void_p) == sizeof(c_int), 12 @unittest.skipUnless(sizeof(c_void_p) == sizeof(c_int),
12 "sizeof c_void_p and c_int differ") 13 "sizeof c_void_p and c_int differ")
13 class WindowsTestCase(unittest.TestCase): 14 class WindowsTestCase(unittest.TestCase):
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 class POINT(Structure): 103 class POINT(Structure):
103 _fields_ = [("x", c_long), 104 _fields_ = [("x", c_long),
104 ("y", c_long)] 105 ("y", c_long)]
105 106
106 class RECT(Structure): 107 class RECT(Structure):
107 _fields_ = [("left", c_long), 108 _fields_ = [("left", c_long),
108 ("top", c_long), 109 ("top", c_long),
109 ("right", c_long), 110 ("right", c_long),
110 ("bottom", c_long)] 111 ("bottom", c_long)]
111 112
112 dll = CDLL(_ctypes_test.__file__) 113 dll = CDLL(getattr(_ctypes_test, '__file__', os.environ['TEST_EXECUTABLE ']))
113 114
114 pt = POINT(15, 25) 115 pt = POINT(15, 25)
115 left = c_long.in_dll(dll, 'left') 116 left = c_long.in_dll(dll, 'left')
116 top = c_long.in_dll(dll, 'top') 117 top = c_long.in_dll(dll, 'top')
117 right = c_long.in_dll(dll, 'right') 118 right = c_long.in_dll(dll, 'right')
118 bottom = c_long.in_dll(dll, 'bottom') 119 bottom = c_long.in_dll(dll, 'bottom')
119 rect = RECT(left, top, right, bottom) 120 rect = RECT(left, top, right, bottom)
120 PointInRect = dll.PointInRect 121 PointInRect = dll.PointInRect
121 PointInRect.argtypes = [POINTER(RECT), POINT] 122 PointInRect.argtypes = [POINTER(RECT), POINT]
122 self.assertEqual(1, PointInRect(byref(rect), pt)) 123 self.assertEqual(1, PointInRect(byref(rect), pt))
(...skipping 11 matching lines...) Expand all
134 self.assertEqual(ret.right, right.value) 135 self.assertEqual(ret.right, right.value)
135 self.assertEqual(ret.top, top.value) 136 self.assertEqual(ret.top, top.value)
136 self.assertEqual(ret.bottom, bottom.value) 137 self.assertEqual(ret.bottom, bottom.value)
137 138
138 # to not leak references, we must clean _pointer_type_cache 139 # to not leak references, we must clean _pointer_type_cache
139 from ctypes import _pointer_type_cache 140 from ctypes import _pointer_type_cache
140 del _pointer_type_cache[RECT] 141 del _pointer_type_cache[RECT]
141 142
142 if __name__ == '__main__': 143 if __name__ == '__main__':
143 unittest.main() 144 unittest.main()
OLDNEW
« no previous file with comments | « Lib/ctypes/test/test_values.py ('k') | Lib/ctypes/util.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+