aschiffler@6757
|
1 |
/**
|
aschiffler@6757
|
2 |
* Original code: automated SDL rect test written by Edgar Simo "bobbens"
|
aschiffler@6757
|
3 |
* New/updated tests: aschiffler at ferzkopp dot net
|
aschiffler@6757
|
4 |
*/
|
aschiffler@6757
|
5 |
|
aschiffler@6757
|
6 |
#include <stdio.h>
|
aschiffler@6757
|
7 |
|
aschiffler@6757
|
8 |
#include "SDL.h"
|
aschiffler@6757
|
9 |
#include "SDL_test.h"
|
aschiffler@6757
|
10 |
|
aschiffler@6757
|
11 |
/* ================= Test Case Implementation ================== */
|
aschiffler@6757
|
12 |
|
aschiffler@6757
|
13 |
/* Helper functions */
|
aschiffler@6757
|
14 |
|
aschiffler@6757
|
15 |
/*!
|
aschiffler@6757
|
16 |
* \brief Private helper to check SDL_IntersectRectAndLine results
|
aschiffler@6757
|
17 |
*/
|
aschiffler@6757
|
18 |
void _validateIntersectRectAndLineResults(
|
aschiffler@6757
|
19 |
SDL_bool intersection, SDL_bool expectedIntersection,
|
aschiffler@6757
|
20 |
SDL_Rect *rect, SDL_Rect * refRect,
|
aschiffler@6757
|
21 |
int x1, int y1, int x2, int y2,
|
aschiffler@6757
|
22 |
int x1Ref, int y1Ref, int x2Ref, int y2Ref)
|
aschiffler@6757
|
23 |
{
|
aschiffler@6757
|
24 |
SDLTest_AssertCheck(intersection == expectedIntersection,
|
aschiffler@6757
|
25 |
"Check for correct intersection result: expected %s, got %s intersecting rect (%d,%d,%d,%d) with line (%d,%d - %d,%d)",
|
aschiffler@6757
|
26 |
(expectedIntersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
27 |
(intersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
28 |
refRect->x, refRect->y, refRect->w, refRect->h,
|
aschiffler@6757
|
29 |
x1Ref, y1Ref, x2Ref, y2Ref);
|
aschiffler@6757
|
30 |
SDLTest_AssertCheck(rect->x == refRect->x && rect->y == refRect->y && rect->w == refRect->w && rect->h == refRect->h,
|
aschiffler@6757
|
31 |
"Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
|
aschiffler@6757
|
32 |
rect->x, rect->y, rect->w, rect->h,
|
aschiffler@6757
|
33 |
refRect->x, refRect->y, refRect->w, refRect->h);
|
aschiffler@6757
|
34 |
SDLTest_AssertCheck(x1 == x1Ref && y1 == y1Ref && x2 == x2Ref && y2 == y2Ref,
|
aschiffler@6757
|
35 |
"Check if line was incorrectly clipped or modified: got (%d,%d - %d,%d) expected (%d,%d - %d,%d)",
|
aschiffler@6757
|
36 |
x1, y1, x2, y2,
|
aschiffler@6757
|
37 |
x1Ref, y1Ref, x2Ref, y2Ref);
|
aschiffler@6757
|
38 |
}
|
aschiffler@6757
|
39 |
|
aschiffler@6757
|
40 |
/* Test case functions */
|
aschiffler@6757
|
41 |
|
aschiffler@6757
|
42 |
/*!
|
aschiffler@6757
|
43 |
* \brief Tests SDL_IntersectRectAndLine() clipping cases
|
aschiffler@6757
|
44 |
*
|
aschiffler@6757
|
45 |
* \sa
|
aschiffler@6757
|
46 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
|
aschiffler@6757
|
47 |
*/
|
aschiffler@6757
|
48 |
int
|
aschiffler@6757
|
49 |
rect_testIntersectRectAndLine (void *arg)
|
aschiffler@6757
|
50 |
{
|
aschiffler@6757
|
51 |
SDL_Rect refRect = { 0, 0, 32, 32 };
|
aschiffler@6757
|
52 |
SDL_Rect rect;
|
aschiffler@6757
|
53 |
int x1, y1;
|
aschiffler@6757
|
54 |
int x2, y2;
|
aschiffler@6757
|
55 |
SDL_bool intersected;
|
aschiffler@6757
|
56 |
|
aschiffler@6757
|
57 |
int xLeft = -SDLTest_RandomIntegerInRange(1, refRect.w);
|
aschiffler@6757
|
58 |
int xRight = refRect.w + SDLTest_RandomIntegerInRange(1, refRect.w);
|
aschiffler@6757
|
59 |
int yTop = -SDLTest_RandomIntegerInRange(1, refRect.h);
|
aschiffler@6757
|
60 |
int yBottom = refRect.h + SDLTest_RandomIntegerInRange(1, refRect.h);
|
aschiffler@6757
|
61 |
|
aschiffler@6757
|
62 |
x1 = xLeft;
|
aschiffler@6757
|
63 |
y1 = 15;
|
aschiffler@6757
|
64 |
x2 = xRight;
|
aschiffler@6757
|
65 |
y2 = 15;
|
aschiffler@6757
|
66 |
rect = refRect;
|
aschiffler@6757
|
67 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
68 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 15, 31, 15);
|
aschiffler@6757
|
69 |
|
aschiffler@6757
|
70 |
x1 = 15;
|
aschiffler@6757
|
71 |
y1 = yTop;
|
aschiffler@6757
|
72 |
x2 = 15;
|
aschiffler@6757
|
73 |
y2 = yBottom;
|
aschiffler@6757
|
74 |
rect = refRect;
|
aschiffler@6757
|
75 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
76 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 15, 0, 15, 31);
|
aschiffler@6757
|
77 |
|
aschiffler@6757
|
78 |
x1 = -refRect.w;
|
aschiffler@6757
|
79 |
y1 = -refRect.h;
|
aschiffler@6757
|
80 |
x2 = 2*refRect.w;
|
aschiffler@6757
|
81 |
y2 = 2*refRect.h;
|
aschiffler@6757
|
82 |
rect = refRect;
|
aschiffler@6757
|
83 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
84 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 0, 31, 31);
|
aschiffler@6757
|
85 |
|
aschiffler@6757
|
86 |
x1 = 2*refRect.w;
|
aschiffler@6757
|
87 |
y1 = 2*refRect.h;
|
aschiffler@6757
|
88 |
x2 = -refRect.w;
|
aschiffler@6757
|
89 |
y2 = -refRect.h;
|
aschiffler@6757
|
90 |
rect = refRect;
|
aschiffler@6757
|
91 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
92 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 31, 0, 0);
|
aschiffler@6757
|
93 |
|
aschiffler@6757
|
94 |
x1 = -1;
|
aschiffler@6757
|
95 |
y1 = 32;
|
aschiffler@6757
|
96 |
x2 = 32;
|
aschiffler@6757
|
97 |
y2 = -1;
|
aschiffler@6757
|
98 |
rect = refRect;
|
aschiffler@6757
|
99 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
100 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 31, 31, 0);
|
aschiffler@6757
|
101 |
|
aschiffler@6757
|
102 |
x1 = 32;
|
aschiffler@6757
|
103 |
y1 = -1;
|
aschiffler@6757
|
104 |
x2 = -1;
|
aschiffler@6757
|
105 |
y2 = 32;
|
aschiffler@6757
|
106 |
rect = refRect;
|
aschiffler@6757
|
107 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
108 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 0, 0, 31);
|
aschiffler@6757
|
109 |
|
aschiffler@6757
|
110 |
return TEST_COMPLETED;
|
aschiffler@6757
|
111 |
}
|
aschiffler@6757
|
112 |
|
aschiffler@6757
|
113 |
/*!
|
aschiffler@6757
|
114 |
* \brief Tests SDL_IntersectRectAndLine() non-clipping case line inside
|
aschiffler@6757
|
115 |
*
|
aschiffler@6757
|
116 |
* \sa
|
aschiffler@6757
|
117 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
|
aschiffler@6757
|
118 |
*/
|
aschiffler@6757
|
119 |
int
|
aschiffler@6757
|
120 |
rect_testIntersectRectAndLineInside (void *arg)
|
aschiffler@6757
|
121 |
{
|
aschiffler@6757
|
122 |
SDL_Rect refRect = { 0, 0, 32, 32 };
|
aschiffler@6757
|
123 |
SDL_Rect rect;
|
aschiffler@6757
|
124 |
int x1, y1;
|
aschiffler@6757
|
125 |
int x2, y2;
|
aschiffler@6757
|
126 |
SDL_bool intersected;
|
aschiffler@6757
|
127 |
|
aschiffler@6757
|
128 |
int xmin = refRect.x;
|
aschiffler@6757
|
129 |
int xmax = refRect.x + refRect.w - 1;
|
aschiffler@6757
|
130 |
int ymin = refRect.y;
|
aschiffler@6757
|
131 |
int ymax = refRect.y + refRect.h - 1;
|
aschiffler@6757
|
132 |
int x1Ref = SDLTest_RandomIntegerInRange(xmin + 1, xmax - 1);
|
aschiffler@6757
|
133 |
int y1Ref = SDLTest_RandomIntegerInRange(ymin + 1, ymax - 1);
|
aschiffler@6757
|
134 |
int x2Ref = SDLTest_RandomIntegerInRange(xmin + 1, xmax - 1);
|
aschiffler@6757
|
135 |
int y2Ref = SDLTest_RandomIntegerInRange(ymin + 1, ymax - 1);
|
aschiffler@6757
|
136 |
|
aschiffler@6757
|
137 |
x1 = x1Ref;
|
aschiffler@6757
|
138 |
y1 = y1Ref;
|
aschiffler@6757
|
139 |
x2 = x2Ref;
|
aschiffler@6757
|
140 |
y2 = y2Ref;
|
aschiffler@6757
|
141 |
rect = refRect;
|
aschiffler@6757
|
142 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
143 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref);
|
aschiffler@6757
|
144 |
|
aschiffler@6757
|
145 |
x1 = x1Ref;
|
aschiffler@6757
|
146 |
y1 = y1Ref;
|
aschiffler@6757
|
147 |
x2 = xmax;
|
aschiffler@6757
|
148 |
y2 = ymax;
|
aschiffler@6757
|
149 |
rect = refRect;
|
aschiffler@6757
|
150 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
151 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, xmax, ymax);
|
aschiffler@6757
|
152 |
|
aschiffler@6757
|
153 |
x1 = xmin;
|
aschiffler@6757
|
154 |
y1 = ymin;
|
aschiffler@6757
|
155 |
x2 = x2Ref;
|
aschiffler@6757
|
156 |
y2 = y2Ref;
|
aschiffler@6757
|
157 |
rect = refRect;
|
aschiffler@6757
|
158 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
159 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, x2Ref, y2Ref);
|
aschiffler@6757
|
160 |
|
aschiffler@6757
|
161 |
x1 = xmin;
|
aschiffler@6757
|
162 |
y1 = ymin;
|
aschiffler@6757
|
163 |
x2 = xmax;
|
aschiffler@6757
|
164 |
y2 = ymax;
|
aschiffler@6757
|
165 |
rect = refRect;
|
aschiffler@6757
|
166 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
167 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, xmax, ymax);
|
aschiffler@6757
|
168 |
|
aschiffler@6757
|
169 |
x1 = xmin;
|
aschiffler@6757
|
170 |
y1 = ymax;
|
aschiffler@6757
|
171 |
x2 = xmax;
|
aschiffler@6757
|
172 |
y2 = ymin;
|
aschiffler@6757
|
173 |
rect = refRect;
|
aschiffler@6757
|
174 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
175 |
_validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymax, xmax, ymin);
|
aschiffler@6757
|
176 |
|
aschiffler@6757
|
177 |
return TEST_COMPLETED;
|
aschiffler@6757
|
178 |
}
|
aschiffler@6757
|
179 |
|
aschiffler@6757
|
180 |
/*!
|
aschiffler@6757
|
181 |
* \brief Tests SDL_IntersectRectAndLine() non-clipping cases outside
|
aschiffler@6757
|
182 |
*
|
aschiffler@6757
|
183 |
* \sa
|
aschiffler@6757
|
184 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
|
aschiffler@6757
|
185 |
*/
|
aschiffler@6757
|
186 |
int
|
aschiffler@6757
|
187 |
rect_testIntersectRectAndLineOutside (void *arg)
|
aschiffler@6757
|
188 |
{
|
aschiffler@6757
|
189 |
SDL_Rect refRect = { 0, 0, 32, 32 };
|
aschiffler@6757
|
190 |
SDL_Rect rect;
|
aschiffler@6757
|
191 |
int x1, y1;
|
aschiffler@6757
|
192 |
int x2, y2;
|
aschiffler@6757
|
193 |
SDL_bool intersected;
|
aschiffler@6757
|
194 |
|
aschiffler@6757
|
195 |
int xLeft = -SDLTest_RandomIntegerInRange(1, refRect.w);
|
aschiffler@6757
|
196 |
int xRight = refRect.w + SDLTest_RandomIntegerInRange(1, refRect.w);
|
aschiffler@6757
|
197 |
int yTop = -SDLTest_RandomIntegerInRange(1, refRect.h);
|
aschiffler@6757
|
198 |
int yBottom = refRect.h + SDLTest_RandomIntegerInRange(1, refRect.h);
|
aschiffler@6757
|
199 |
|
aschiffler@6757
|
200 |
x1 = xLeft;
|
aschiffler@6757
|
201 |
y1 = 0;
|
aschiffler@6757
|
202 |
x2 = xLeft;
|
aschiffler@6757
|
203 |
y2 = 31;
|
aschiffler@6757
|
204 |
rect = refRect;
|
aschiffler@6757
|
205 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
206 |
_validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xLeft, 0, xLeft, 31);
|
aschiffler@6757
|
207 |
|
aschiffler@6757
|
208 |
x1 = xRight;
|
aschiffler@6757
|
209 |
y1 = 0;
|
aschiffler@6757
|
210 |
x2 = xRight;
|
aschiffler@6757
|
211 |
y2 = 31;
|
aschiffler@6757
|
212 |
rect = refRect;
|
aschiffler@6757
|
213 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
214 |
_validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xRight, 0, xRight, 31);
|
aschiffler@6757
|
215 |
|
aschiffler@6757
|
216 |
x1 = 0;
|
aschiffler@6757
|
217 |
y1 = yTop;
|
aschiffler@6757
|
218 |
x2 = 31;
|
aschiffler@6757
|
219 |
y2 = yTop;
|
aschiffler@6757
|
220 |
rect = refRect;
|
aschiffler@6757
|
221 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
222 |
_validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yTop, 31, yTop);
|
aschiffler@6757
|
223 |
|
aschiffler@6757
|
224 |
x1 = 0;
|
aschiffler@6757
|
225 |
y1 = yBottom;
|
aschiffler@6757
|
226 |
x2 = 31;
|
aschiffler@6757
|
227 |
y2 = yBottom;
|
aschiffler@6757
|
228 |
rect = refRect;
|
aschiffler@6757
|
229 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
230 |
_validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yBottom, 31, yBottom);
|
aschiffler@6757
|
231 |
|
aschiffler@6757
|
232 |
return TEST_COMPLETED;
|
aschiffler@6757
|
233 |
}
|
aschiffler@6757
|
234 |
|
aschiffler@6757
|
235 |
/*!
|
aschiffler@6757
|
236 |
* \brief Tests SDL_IntersectRectAndLine() with empty rectangle
|
aschiffler@6757
|
237 |
*
|
aschiffler@6757
|
238 |
* \sa
|
aschiffler@6757
|
239 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
|
aschiffler@6757
|
240 |
*/
|
aschiffler@6757
|
241 |
int
|
aschiffler@6757
|
242 |
rect_testIntersectRectAndLineEmpty (void *arg)
|
aschiffler@6757
|
243 |
{
|
aschiffler@6757
|
244 |
SDL_Rect refRect;
|
aschiffler@6757
|
245 |
SDL_Rect rect;
|
aschiffler@6757
|
246 |
int x1, y1, x1Ref, y1Ref;
|
aschiffler@6757
|
247 |
int x2, y2, x2Ref, y2Ref;
|
aschiffler@6757
|
248 |
SDL_bool intersected;
|
aschiffler@6757
|
249 |
|
aschiffler@6757
|
250 |
refRect.x = SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
251 |
refRect.y = SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
252 |
refRect.w = 0;
|
aschiffler@6757
|
253 |
refRect.h = 0;
|
aschiffler@6757
|
254 |
x1Ref = refRect.x;
|
aschiffler@6757
|
255 |
y1Ref = refRect.y;
|
aschiffler@6757
|
256 |
x2Ref = SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
257 |
y2Ref = SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
258 |
|
aschiffler@6757
|
259 |
x1 = x1Ref;
|
aschiffler@6757
|
260 |
y1 = y1Ref;
|
aschiffler@6757
|
261 |
x2 = x2Ref;
|
aschiffler@6757
|
262 |
y2 = y2Ref;
|
aschiffler@6757
|
263 |
rect = refRect;
|
aschiffler@6757
|
264 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
265 |
_validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref);
|
aschiffler@6757
|
266 |
|
aschiffler@6757
|
267 |
return TEST_COMPLETED;
|
aschiffler@6757
|
268 |
}
|
aschiffler@6757
|
269 |
|
aschiffler@6757
|
270 |
/*!
|
aschiffler@6757
|
271 |
* \brief Negative tests against SDL_IntersectRectAndLine() with invalid parameters
|
aschiffler@6757
|
272 |
*
|
aschiffler@6757
|
273 |
* \sa
|
aschiffler@6757
|
274 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
|
aschiffler@6757
|
275 |
*/
|
aschiffler@6757
|
276 |
int
|
aschiffler@6757
|
277 |
rect_testIntersectRectAndLineParam (void *arg)
|
aschiffler@6757
|
278 |
{
|
aschiffler@6757
|
279 |
SDL_Rect rect = { 0, 0, 32, 32 };
|
aschiffler@6757
|
280 |
int x1 = rect.w / 2;
|
aschiffler@6757
|
281 |
int y1 = rect.h / 2;
|
aschiffler@6757
|
282 |
int x2 = x1;
|
aschiffler@6757
|
283 |
int y2 = 2 * rect.h;
|
aschiffler@6757
|
284 |
SDL_bool intersected;
|
aschiffler@6757
|
285 |
|
aschiffler@6757
|
286 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
287 |
SDLTest_AssertCheck(intersected == SDL_TRUE, "Check that intersection result was SDL_TRUE");
|
aschiffler@6757
|
288 |
|
aschiffler@6757
|
289 |
intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, &x1, &y1, &x2, &y2);
|
aschiffler@6757
|
290 |
SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
|
aschiffler@6757
|
291 |
intersected = SDL_IntersectRectAndLine(&rect, (int *)NULL, &y1, &x2, &y2);
|
aschiffler@6757
|
292 |
SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL");
|
aschiffler@6757
|
293 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, (int *)NULL, &x2, &y2);
|
aschiffler@6757
|
294 |
SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 3rd parameter is NULL");
|
aschiffler@6757
|
295 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, (int *)NULL, &y2);
|
aschiffler@6757
|
296 |
SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 4th parameter is NULL");
|
aschiffler@6757
|
297 |
intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, (int *)NULL);
|
aschiffler@6757
|
298 |
SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 5th parameter is NULL");
|
aschiffler@6757
|
299 |
intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, (int *)NULL, (int *)NULL, (int *)NULL, (int *)NULL);
|
aschiffler@6757
|
300 |
SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
|
aschiffler@6757
|
301 |
|
aschiffler@6757
|
302 |
return TEST_COMPLETED;
|
aschiffler@6757
|
303 |
}
|
aschiffler@6757
|
304 |
|
aschiffler@6757
|
305 |
/*!
|
aschiffler@6757
|
306 |
* \brief Private helper to check SDL_HasIntersection results
|
aschiffler@6757
|
307 |
*/
|
aschiffler@6757
|
308 |
void _validateHasIntersectionResults(
|
aschiffler@6757
|
309 |
SDL_bool intersection, SDL_bool expectedIntersection,
|
aschiffler@6757
|
310 |
SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)
|
aschiffler@6757
|
311 |
{
|
aschiffler@6757
|
312 |
SDLTest_AssertCheck(intersection == expectedIntersection,
|
aschiffler@6757
|
313 |
"Check intersection result: expected %s, got %s intersecting A (%d,%d,%d,%d) with B (%d,%d,%d,%d)",
|
aschiffler@6757
|
314 |
(expectedIntersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
315 |
(intersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
316 |
rectA->x, rectA->y, rectA->w, rectA->h,
|
aschiffler@6757
|
317 |
rectB->x, rectB->y, rectB->w, rectB->h);
|
aschiffler@6757
|
318 |
SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
|
aschiffler@6757
|
319 |
"Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
|
aschiffler@6757
|
320 |
rectA->x, rectA->y, rectA->w, rectA->h,
|
aschiffler@6757
|
321 |
refRectA->x, refRectA->y, refRectA->w, refRectA->h);
|
aschiffler@6757
|
322 |
SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
|
aschiffler@6757
|
323 |
"Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
|
aschiffler@6757
|
324 |
rectB->x, rectB->y, rectB->w, rectB->h,
|
aschiffler@6757
|
325 |
refRectB->x, refRectB->y, refRectB->w, refRectB->h);
|
aschiffler@6757
|
326 |
}
|
aschiffler@6757
|
327 |
|
aschiffler@6757
|
328 |
/*!
|
aschiffler@6757
|
329 |
* \brief Private helper to check SDL_IntersectRect results
|
aschiffler@6757
|
330 |
*/
|
aschiffler@6757
|
331 |
void _validateIntersectRectResults(
|
aschiffler@6757
|
332 |
SDL_bool intersection, SDL_bool expectedIntersection,
|
aschiffler@6757
|
333 |
SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB,
|
aschiffler@6757
|
334 |
SDL_Rect *result, SDL_Rect *expectedResult)
|
aschiffler@6757
|
335 |
{
|
aschiffler@6757
|
336 |
_validateHasIntersectionResults(intersection, expectedIntersection, rectA, rectB, refRectA, refRectB);
|
aschiffler@6757
|
337 |
if (result && expectedResult) {
|
aschiffler@6757
|
338 |
SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->h,
|
aschiffler@6757
|
339 |
"Check that intersection of rectangles A (%d,%d,%d,%d) and B (%d,%d,%d,%d) was correctly calculated, got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
|
aschiffler@6757
|
340 |
rectA->x, rectA->y, rectA->w, rectA->h,
|
aschiffler@6757
|
341 |
rectB->x, rectB->y, rectB->w, rectB->h,
|
aschiffler@6757
|
342 |
result->x, result->y, result->w, result->h,
|
aschiffler@6757
|
343 |
expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
|
aschiffler@6757
|
344 |
}
|
aschiffler@6757
|
345 |
}
|
aschiffler@6757
|
346 |
|
aschiffler@6757
|
347 |
/*!
|
aschiffler@6757
|
348 |
* \brief Private helper to check SDL_UnionRect results
|
aschiffler@6757
|
349 |
*/
|
aschiffler@6757
|
350 |
void _validateUnionRectResults(
|
aschiffler@6757
|
351 |
SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB,
|
aschiffler@6757
|
352 |
SDL_Rect *result, SDL_Rect *expectedResult)
|
aschiffler@6757
|
353 |
{
|
aschiffler@6757
|
354 |
SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
|
aschiffler@6757
|
355 |
"Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
|
aschiffler@6757
|
356 |
rectA->x, rectA->y, rectA->w, rectA->h,
|
aschiffler@6757
|
357 |
refRectA->x, refRectA->y, refRectA->w, refRectA->h);
|
aschiffler@6757
|
358 |
SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
|
aschiffler@6757
|
359 |
"Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
|
aschiffler@6757
|
360 |
rectB->x, rectB->y, rectB->w, rectB->h,
|
aschiffler@6757
|
361 |
refRectB->x, refRectB->y, refRectB->w, refRectB->h);
|
aschiffler@6757
|
362 |
SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->h,
|
aschiffler@6757
|
363 |
"Check that union of rectangles A (%d,%d,%d,%d) and B (%d,%d,%d,%d) was correctly calculated, got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
|
aschiffler@6757
|
364 |
rectA->x, rectA->y, rectA->w, rectA->h,
|
aschiffler@6757
|
365 |
rectB->x, rectB->y, rectB->w, rectB->h,
|
aschiffler@6757
|
366 |
result->x, result->y, result->w, result->h,
|
aschiffler@6757
|
367 |
expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
|
aschiffler@6757
|
368 |
}
|
aschiffler@6757
|
369 |
|
aschiffler@6757
|
370 |
/*!
|
aschiffler@6757
|
371 |
* \brief Private helper to check SDL_RectEmpty results
|
aschiffler@6757
|
372 |
*/
|
aschiffler@6757
|
373 |
void _validateRectEmptyResults(
|
aschiffler@6757
|
374 |
SDL_bool empty, SDL_bool expectedEmpty,
|
aschiffler@6757
|
375 |
SDL_Rect *rect, SDL_Rect *refRect)
|
aschiffler@6757
|
376 |
{
|
aschiffler@6757
|
377 |
SDLTest_AssertCheck(empty == expectedEmpty,
|
aschiffler@6757
|
378 |
"Check for correct empty result: expected %s, got %s testing (%d,%d,%d,%d)",
|
aschiffler@6757
|
379 |
(expectedEmpty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
380 |
(empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
381 |
rect->x, rect->y, rect->w, rect->h);
|
aschiffler@6757
|
382 |
SDLTest_AssertCheck(rect->x == refRect->x && rect->y == refRect->y && rect->w == refRect->w && rect->h == refRect->h,
|
aschiffler@6757
|
383 |
"Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
|
aschiffler@6757
|
384 |
rect->x, rect->y, rect->w, rect->h,
|
aschiffler@6757
|
385 |
refRect->x, refRect->y, refRect->w, refRect->h);
|
aschiffler@6757
|
386 |
}
|
aschiffler@6757
|
387 |
|
aschiffler@6757
|
388 |
/*!
|
aschiffler@6757
|
389 |
* \brief Private helper to check SDL_RectEquals results
|
aschiffler@6757
|
390 |
*/
|
aschiffler@6757
|
391 |
void _validateRectEqualsResults(
|
aschiffler@6757
|
392 |
SDL_bool equals, SDL_bool expectedEquals,
|
aschiffler@6757
|
393 |
SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)
|
aschiffler@6757
|
394 |
{
|
aschiffler@6757
|
395 |
SDLTest_AssertCheck(equals == expectedEquals,
|
aschiffler@6757
|
396 |
"Check for correct equals result: expected %s, got %s testing (%d,%d,%d,%d) and (%d,%d,%d,%d)",
|
aschiffler@6757
|
397 |
(expectedEquals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
398 |
(equals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
399 |
rectA->x, rectA->y, rectA->w, rectA->h,
|
aschiffler@6757
|
400 |
rectB->x, rectB->y, rectB->w, rectB->h);
|
aschiffler@6757
|
401 |
SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
|
aschiffler@6757
|
402 |
"Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
|
aschiffler@6757
|
403 |
rectA->x, rectA->y, rectA->w, rectA->h,
|
aschiffler@6757
|
404 |
refRectA->x, refRectA->y, refRectA->w, refRectA->h);
|
aschiffler@6757
|
405 |
SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
|
aschiffler@6757
|
406 |
"Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
|
aschiffler@6757
|
407 |
rectB->x, rectB->y, rectB->w, rectB->h,
|
aschiffler@6757
|
408 |
refRectB->x, refRectB->y, refRectB->w, refRectB->h);
|
aschiffler@6757
|
409 |
}
|
aschiffler@6757
|
410 |
|
aschiffler@6757
|
411 |
/*!
|
aschiffler@6757
|
412 |
* \brief Tests SDL_IntersectRect() with B fully inside A
|
aschiffler@6757
|
413 |
*
|
aschiffler@6757
|
414 |
* \sa
|
aschiffler@6757
|
415 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
aschiffler@6757
|
416 |
*/
|
aschiffler@6757
|
417 |
int rect_testIntersectRectInside (void *arg)
|
aschiffler@6757
|
418 |
{
|
aschiffler@6757
|
419 |
SDL_Rect refRectA = { 0, 0, 32, 32 };
|
aschiffler@6757
|
420 |
SDL_Rect refRectB;
|
aschiffler@6757
|
421 |
SDL_Rect rectA;
|
aschiffler@6757
|
422 |
SDL_Rect rectB;
|
aschiffler@6757
|
423 |
SDL_Rect result;
|
aschiffler@6757
|
424 |
SDL_bool intersection;
|
aschiffler@6757
|
425 |
|
aschiffler@6757
|
426 |
// rectB fully contained in rectA
|
aschiffler@6757
|
427 |
refRectB.x = 0;
|
aschiffler@6757
|
428 |
refRectB.y = 0;
|
aschiffler@6757
|
429 |
refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
|
aschiffler@6757
|
430 |
refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
|
aschiffler@6757
|
431 |
rectA = refRectA;
|
aschiffler@6757
|
432 |
rectB = refRectB;
|
aschiffler@6757
|
433 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
434 |
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectB);
|
aschiffler@6757
|
435 |
|
aschiffler@6757
|
436 |
return TEST_COMPLETED;
|
aschiffler@6757
|
437 |
}
|
aschiffler@6757
|
438 |
|
aschiffler@6757
|
439 |
/*!
|
aschiffler@6757
|
440 |
* \brief Tests SDL_IntersectRect() with B fully outside A
|
aschiffler@6757
|
441 |
*
|
aschiffler@6757
|
442 |
* \sa
|
aschiffler@6757
|
443 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
aschiffler@6757
|
444 |
*/
|
aschiffler@6757
|
445 |
int rect_testIntersectRectOutside (void *arg)
|
aschiffler@6757
|
446 |
{
|
aschiffler@6757
|
447 |
SDL_Rect refRectA = { 0, 0, 32, 32 };
|
aschiffler@6757
|
448 |
SDL_Rect refRectB;
|
aschiffler@6757
|
449 |
SDL_Rect rectA;
|
aschiffler@6757
|
450 |
SDL_Rect rectB;
|
aschiffler@6757
|
451 |
SDL_Rect result;
|
aschiffler@6757
|
452 |
SDL_bool intersection;
|
aschiffler@6757
|
453 |
|
aschiffler@6757
|
454 |
// rectB fully outside of rectA
|
aschiffler@6757
|
455 |
refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
|
aschiffler@6757
|
456 |
refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
|
aschiffler@6757
|
457 |
refRectB.w = refRectA.w;
|
aschiffler@6757
|
458 |
refRectB.h = refRectA.h;
|
aschiffler@6757
|
459 |
rectA = refRectA;
|
aschiffler@6757
|
460 |
rectB = refRectB;
|
aschiffler@6757
|
461 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
462 |
_validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
463 |
|
aschiffler@6757
|
464 |
return TEST_COMPLETED;
|
aschiffler@6757
|
465 |
}
|
aschiffler@6757
|
466 |
|
aschiffler@6757
|
467 |
/*!
|
aschiffler@6757
|
468 |
* \brief Tests SDL_IntersectRect() with B partially intersecting A
|
aschiffler@6757
|
469 |
*
|
aschiffler@6757
|
470 |
* \sa
|
aschiffler@6757
|
471 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
aschiffler@6757
|
472 |
*/
|
aschiffler@6757
|
473 |
int rect_testIntersectRectPartial (void *arg)
|
aschiffler@6757
|
474 |
{
|
aschiffler@6757
|
475 |
SDL_Rect refRectA = { 0, 0, 32, 32 };
|
aschiffler@6757
|
476 |
SDL_Rect refRectB;
|
aschiffler@6757
|
477 |
SDL_Rect rectA;
|
aschiffler@6757
|
478 |
SDL_Rect rectB;
|
aschiffler@6757
|
479 |
SDL_Rect result;
|
aschiffler@6757
|
480 |
SDL_Rect expectedResult;
|
aschiffler@6757
|
481 |
SDL_bool intersection;
|
aschiffler@6757
|
482 |
|
aschiffler@6757
|
483 |
// rectB partially contained in rectA
|
aschiffler@6757
|
484 |
refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
|
aschiffler@6757
|
485 |
refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
|
aschiffler@6757
|
486 |
refRectB.w = refRectA.w;
|
aschiffler@6757
|
487 |
refRectB.h = refRectA.h;
|
aschiffler@6757
|
488 |
rectA = refRectA;
|
aschiffler@6757
|
489 |
rectB = refRectB;
|
aschiffler@6757
|
490 |
expectedResult.x = refRectB.x;
|
aschiffler@6757
|
491 |
expectedResult.y = refRectB.y;
|
aschiffler@6757
|
492 |
expectedResult.w = refRectA.w - refRectB.x;
|
aschiffler@6757
|
493 |
expectedResult.h = refRectA.h - refRectB.y;
|
aschiffler@6757
|
494 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
495 |
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
496 |
|
aschiffler@6757
|
497 |
// rectB right edge
|
aschiffler@6757
|
498 |
refRectB.x = rectA.w - 1;
|
aschiffler@6757
|
499 |
refRectB.y = rectA.y;
|
aschiffler@6757
|
500 |
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
aschiffler@6757
|
501 |
refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
|
aschiffler@6757
|
502 |
rectA = refRectA;
|
aschiffler@6757
|
503 |
rectB = refRectB;
|
aschiffler@6757
|
504 |
expectedResult.x = refRectB.x;
|
aschiffler@6757
|
505 |
expectedResult.y = refRectB.y;
|
aschiffler@6757
|
506 |
expectedResult.w = 1;
|
aschiffler@6757
|
507 |
expectedResult.h = refRectB.h;
|
aschiffler@6757
|
508 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
509 |
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
510 |
|
aschiffler@6757
|
511 |
// rectB left edge
|
aschiffler@6757
|
512 |
refRectB.x = 1 - rectA.w;
|
aschiffler@6757
|
513 |
refRectB.y = rectA.y;
|
aschiffler@6757
|
514 |
refRectB.w = refRectA.w;
|
aschiffler@6757
|
515 |
refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
|
aschiffler@6757
|
516 |
rectA = refRectA;
|
aschiffler@6757
|
517 |
rectB = refRectB;
|
aschiffler@6757
|
518 |
expectedResult.x = 0;
|
aschiffler@6757
|
519 |
expectedResult.y = refRectB.y;
|
aschiffler@6757
|
520 |
expectedResult.w = 1;
|
aschiffler@6757
|
521 |
expectedResult.h = refRectB.h;
|
aschiffler@6757
|
522 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
523 |
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
524 |
|
aschiffler@6757
|
525 |
// rectB bottom edge
|
aschiffler@6757
|
526 |
refRectB.x = rectA.x;
|
aschiffler@6757
|
527 |
refRectB.y = rectA.h - 1;
|
aschiffler@6757
|
528 |
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
aschiffler@6757
|
529 |
refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
|
aschiffler@6757
|
530 |
rectA = refRectA;
|
aschiffler@6757
|
531 |
rectB = refRectB;
|
aschiffler@6757
|
532 |
expectedResult.x = refRectB.x;
|
aschiffler@6757
|
533 |
expectedResult.y = refRectB.y;
|
aschiffler@6757
|
534 |
expectedResult.w = refRectB.w;
|
aschiffler@6757
|
535 |
expectedResult.h = 1;
|
aschiffler@6757
|
536 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
537 |
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
538 |
|
aschiffler@6757
|
539 |
// rectB top edge
|
aschiffler@6757
|
540 |
refRectB.x = rectA.x;
|
aschiffler@6757
|
541 |
refRectB.y = 1 - rectA.h;
|
aschiffler@6757
|
542 |
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
aschiffler@6757
|
543 |
refRectB.h = rectA.h;
|
aschiffler@6757
|
544 |
rectA = refRectA;
|
aschiffler@6757
|
545 |
rectB = refRectB;
|
aschiffler@6757
|
546 |
expectedResult.x = refRectB.x;
|
aschiffler@6757
|
547 |
expectedResult.y = 0;
|
aschiffler@6757
|
548 |
expectedResult.w = refRectB.w;
|
aschiffler@6757
|
549 |
expectedResult.h = 1;
|
aschiffler@6757
|
550 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
551 |
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
552 |
|
aschiffler@6757
|
553 |
return TEST_COMPLETED;
|
aschiffler@6757
|
554 |
}
|
aschiffler@6757
|
555 |
|
aschiffler@6757
|
556 |
/*!
|
aschiffler@6757
|
557 |
* \brief Tests SDL_IntersectRect() with 1x1 pixel sized rectangles
|
aschiffler@6757
|
558 |
*
|
aschiffler@6757
|
559 |
* \sa
|
aschiffler@6757
|
560 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
aschiffler@6757
|
561 |
*/
|
aschiffler@6757
|
562 |
int rect_testIntersectRectPoint (void *arg)
|
aschiffler@6757
|
563 |
{
|
aschiffler@6757
|
564 |
SDL_Rect refRectA = { 0, 0, 1, 1 };
|
aschiffler@6757
|
565 |
SDL_Rect refRectB = { 0, 0, 1, 1 };
|
aschiffler@6757
|
566 |
SDL_Rect rectA;
|
aschiffler@6757
|
567 |
SDL_Rect rectB;
|
aschiffler@6757
|
568 |
SDL_Rect result;
|
aschiffler@6757
|
569 |
SDL_bool intersection;
|
aschiffler@6757
|
570 |
int offsetX, offsetY;
|
aschiffler@6757
|
571 |
|
aschiffler@6757
|
572 |
// intersecting pixels
|
aschiffler@6757
|
573 |
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
574 |
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
575 |
refRectB.x = refRectA.x;
|
aschiffler@6757
|
576 |
refRectB.y = refRectA.y;
|
aschiffler@6757
|
577 |
rectA = refRectA;
|
aschiffler@6757
|
578 |
rectB = refRectB;
|
aschiffler@6757
|
579 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
580 |
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectA);
|
aschiffler@6757
|
581 |
|
aschiffler@6757
|
582 |
// non-intersecting pixels cases
|
aschiffler@6757
|
583 |
for (offsetX = -1; offsetX <= 1; offsetX++) {
|
aschiffler@6757
|
584 |
for (offsetY = -1; offsetY <= 1; offsetY++) {
|
aschiffler@6757
|
585 |
if (offsetX != 0 || offsetY != 0) {
|
aschiffler@6757
|
586 |
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
587 |
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
588 |
refRectB.x = refRectA.x;
|
aschiffler@6757
|
589 |
refRectB.y = refRectA.y;
|
aschiffler@6757
|
590 |
refRectB.x += offsetX;
|
aschiffler@6757
|
591 |
refRectB.y += offsetY;
|
aschiffler@6757
|
592 |
rectA = refRectA;
|
aschiffler@6757
|
593 |
rectB = refRectB;
|
aschiffler@6757
|
594 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
595 |
_validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
596 |
}
|
aschiffler@6757
|
597 |
}
|
aschiffler@6757
|
598 |
}
|
aschiffler@6757
|
599 |
|
aschiffler@6757
|
600 |
return TEST_COMPLETED;
|
aschiffler@6757
|
601 |
}
|
aschiffler@6757
|
602 |
|
aschiffler@6757
|
603 |
/*!
|
aschiffler@6757
|
604 |
* \brief Tests SDL_IntersectRect() with empty rectangles
|
aschiffler@6757
|
605 |
*
|
aschiffler@6757
|
606 |
* \sa
|
aschiffler@6757
|
607 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
aschiffler@6757
|
608 |
*/
|
aschiffler@6757
|
609 |
int rect_testIntersectRectEmpty (void *arg)
|
aschiffler@6757
|
610 |
{
|
aschiffler@6757
|
611 |
SDL_Rect refRectA;
|
aschiffler@6757
|
612 |
SDL_Rect refRectB;
|
aschiffler@6757
|
613 |
SDL_Rect rectA;
|
aschiffler@6757
|
614 |
SDL_Rect rectB;
|
aschiffler@6757
|
615 |
SDL_Rect result;
|
aschiffler@6757
|
616 |
SDL_bool intersection;
|
aschiffler@6757
|
617 |
|
aschiffler@6757
|
618 |
// Rect A empty
|
aschiffler@6757
|
619 |
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
620 |
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
621 |
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
622 |
refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
623 |
refRectB = refRectA;
|
aschiffler@6757
|
624 |
refRectA.w = 0;
|
aschiffler@6757
|
625 |
refRectA.h = 0;
|
aschiffler@6757
|
626 |
rectA = refRectA;
|
aschiffler@6757
|
627 |
rectB = refRectB;
|
aschiffler@6757
|
628 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
629 |
_validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
630 |
|
aschiffler@6757
|
631 |
// Rect B empty
|
aschiffler@6757
|
632 |
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
633 |
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
634 |
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
635 |
refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
636 |
refRectB = refRectA;
|
aschiffler@6757
|
637 |
refRectB.w = 0;
|
aschiffler@6757
|
638 |
refRectB.h = 0;
|
aschiffler@6757
|
639 |
rectA = refRectA;
|
aschiffler@6757
|
640 |
rectB = refRectB;
|
aschiffler@6757
|
641 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
642 |
_validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
643 |
|
aschiffler@6757
|
644 |
// Rect A and B empty
|
aschiffler@6757
|
645 |
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
646 |
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
647 |
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
648 |
refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
649 |
refRectB = refRectA;
|
aschiffler@6757
|
650 |
refRectA.w = 0;
|
aschiffler@6757
|
651 |
refRectA.h = 0;
|
aschiffler@6757
|
652 |
refRectB.w = 0;
|
aschiffler@6757
|
653 |
refRectB.h = 0;
|
aschiffler@6757
|
654 |
rectA = refRectA;
|
aschiffler@6757
|
655 |
rectB = refRectB;
|
aschiffler@6757
|
656 |
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
657 |
_validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
658 |
|
aschiffler@6757
|
659 |
return TEST_COMPLETED;
|
aschiffler@6757
|
660 |
}
|
aschiffler@6757
|
661 |
|
aschiffler@6757
|
662 |
/*!
|
aschiffler@6757
|
663 |
* \brief Negative tests against SDL_IntersectRect() with invalid parameters
|
aschiffler@6757
|
664 |
*
|
aschiffler@6757
|
665 |
* \sa
|
aschiffler@6757
|
666 |
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
aschiffler@6757
|
667 |
*/
|
aschiffler@6757
|
668 |
int rect_testIntersectRectParam(void *arg)
|
aschiffler@6757
|
669 |
{
|
aschiffler@6757
|
670 |
SDL_Rect rectA;
|
aschiffler@6757
|
671 |
SDL_Rect rectB;
|
aschiffler@6757
|
672 |
SDL_Rect result;
|
aschiffler@6757
|
673 |
SDL_bool intersection;
|
aschiffler@6757
|
674 |
|
aschiffler@6757
|
675 |
// invalid parameter combinations
|
aschiffler@6757
|
676 |
intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, &result);
|
aschiffler@6757
|
677 |
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
|
aschiffler@6757
|
678 |
intersection = SDL_IntersectRect(&rectA, (SDL_Rect *)NULL, &result);
|
aschiffler@6757
|
679 |
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL");
|
aschiffler@6757
|
680 |
intersection = SDL_IntersectRect(&rectA, &rectB, (SDL_Rect *)NULL);
|
aschiffler@6757
|
681 |
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 3st parameter is NULL");
|
aschiffler@6757
|
682 |
intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, &result);
|
aschiffler@6757
|
683 |
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameters are NULL");
|
aschiffler@6757
|
684 |
intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL);
|
aschiffler@6757
|
685 |
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 3rd parameters are NULL ");
|
aschiffler@6757
|
686 |
intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
687 |
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
|
aschiffler@6757
|
688 |
|
aschiffler@6757
|
689 |
return TEST_COMPLETED;
|
aschiffler@6757
|
690 |
}
|
aschiffler@6757
|
691 |
|
aschiffler@6757
|
692 |
/*!
|
aschiffler@6757
|
693 |
* \brief Tests SDL_HasIntersection() with B fully inside A
|
aschiffler@6757
|
694 |
*
|
aschiffler@6757
|
695 |
* \sa
|
aschiffler@6757
|
696 |
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
aschiffler@6757
|
697 |
*/
|
aschiffler@6757
|
698 |
int rect_testHasIntersectionInside (void *arg)
|
aschiffler@6757
|
699 |
{
|
aschiffler@6757
|
700 |
SDL_Rect refRectA = { 0, 0, 32, 32 };
|
aschiffler@6757
|
701 |
SDL_Rect refRectB;
|
aschiffler@6757
|
702 |
SDL_Rect rectA;
|
aschiffler@6757
|
703 |
SDL_Rect rectB;
|
aschiffler@6757
|
704 |
SDL_bool intersection;
|
aschiffler@6757
|
705 |
|
aschiffler@6757
|
706 |
// rectB fully contained in rectA
|
aschiffler@6757
|
707 |
refRectB.x = 0;
|
aschiffler@6757
|
708 |
refRectB.y = 0;
|
aschiffler@6757
|
709 |
refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
|
aschiffler@6757
|
710 |
refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
|
aschiffler@6757
|
711 |
rectA = refRectA;
|
aschiffler@6757
|
712 |
rectB = refRectB;
|
aschiffler@6757
|
713 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
714 |
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
715 |
|
aschiffler@6757
|
716 |
return TEST_COMPLETED;
|
aschiffler@6757
|
717 |
}
|
aschiffler@6757
|
718 |
|
aschiffler@6757
|
719 |
/*!
|
aschiffler@6757
|
720 |
* \brief Tests SDL_HasIntersection() with B fully outside A
|
aschiffler@6757
|
721 |
*
|
aschiffler@6757
|
722 |
* \sa
|
aschiffler@6757
|
723 |
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
aschiffler@6757
|
724 |
*/
|
aschiffler@6757
|
725 |
int rect_testHasIntersectionOutside (void *arg)
|
aschiffler@6757
|
726 |
{
|
aschiffler@6757
|
727 |
SDL_Rect refRectA = { 0, 0, 32, 32 };
|
aschiffler@6757
|
728 |
SDL_Rect refRectB;
|
aschiffler@6757
|
729 |
SDL_Rect rectA;
|
aschiffler@6757
|
730 |
SDL_Rect rectB;
|
aschiffler@6757
|
731 |
SDL_bool intersection;
|
aschiffler@6757
|
732 |
|
aschiffler@6757
|
733 |
// rectB fully outside of rectA
|
aschiffler@6757
|
734 |
refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
|
aschiffler@6757
|
735 |
refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
|
aschiffler@6757
|
736 |
refRectB.w = refRectA.w;
|
aschiffler@6757
|
737 |
refRectB.h = refRectA.h;
|
aschiffler@6757
|
738 |
rectA = refRectA;
|
aschiffler@6757
|
739 |
rectB = refRectB;
|
aschiffler@6757
|
740 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
741 |
_validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
742 |
|
aschiffler@6757
|
743 |
return TEST_COMPLETED;
|
aschiffler@6757
|
744 |
}
|
aschiffler@6757
|
745 |
|
aschiffler@6757
|
746 |
/*!
|
aschiffler@6757
|
747 |
* \brief Tests SDL_HasIntersection() with B partially intersecting A
|
aschiffler@6757
|
748 |
*
|
aschiffler@6757
|
749 |
* \sa
|
aschiffler@6757
|
750 |
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
aschiffler@6757
|
751 |
*/
|
aschiffler@6757
|
752 |
int rect_testHasIntersectionPartial (void *arg)
|
aschiffler@6757
|
753 |
{
|
aschiffler@6757
|
754 |
SDL_Rect refRectA = { 0, 0, 32, 32 };
|
aschiffler@6757
|
755 |
SDL_Rect refRectB;
|
aschiffler@6757
|
756 |
SDL_Rect rectA;
|
aschiffler@6757
|
757 |
SDL_Rect rectB;
|
aschiffler@6757
|
758 |
SDL_bool intersection;
|
aschiffler@6757
|
759 |
|
aschiffler@6757
|
760 |
// rectB partially contained in rectA
|
aschiffler@6757
|
761 |
refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
|
aschiffler@6757
|
762 |
refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
|
aschiffler@6757
|
763 |
refRectB.w = refRectA.w;
|
aschiffler@6757
|
764 |
refRectB.h = refRectA.h;
|
aschiffler@6757
|
765 |
rectA = refRectA;
|
aschiffler@6757
|
766 |
rectB = refRectB;
|
aschiffler@6757
|
767 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
768 |
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
769 |
|
aschiffler@6757
|
770 |
// rectB right edge
|
aschiffler@6757
|
771 |
refRectB.x = rectA.w - 1;
|
aschiffler@6757
|
772 |
refRectB.y = rectA.y;
|
aschiffler@6757
|
773 |
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
aschiffler@6757
|
774 |
refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
|
aschiffler@6757
|
775 |
rectA = refRectA;
|
aschiffler@6757
|
776 |
rectB = refRectB;
|
aschiffler@6757
|
777 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
778 |
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
779 |
|
aschiffler@6757
|
780 |
// rectB left edge
|
aschiffler@6757
|
781 |
refRectB.x = 1 - rectA.w;
|
aschiffler@6757
|
782 |
refRectB.y = rectA.y;
|
aschiffler@6757
|
783 |
refRectB.w = refRectA.w;
|
aschiffler@6757
|
784 |
refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
|
aschiffler@6757
|
785 |
rectA = refRectA;
|
aschiffler@6757
|
786 |
rectB = refRectB;
|
aschiffler@6757
|
787 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
788 |
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
789 |
|
aschiffler@6757
|
790 |
// rectB bottom edge
|
aschiffler@6757
|
791 |
refRectB.x = rectA.x;
|
aschiffler@6757
|
792 |
refRectB.y = rectA.h - 1;
|
aschiffler@6757
|
793 |
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
aschiffler@6757
|
794 |
refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
|
aschiffler@6757
|
795 |
rectA = refRectA;
|
aschiffler@6757
|
796 |
rectB = refRectB;
|
aschiffler@6757
|
797 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
798 |
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
799 |
|
aschiffler@6757
|
800 |
// rectB top edge
|
aschiffler@6757
|
801 |
refRectB.x = rectA.x;
|
aschiffler@6757
|
802 |
refRectB.y = 1 - rectA.h;
|
aschiffler@6757
|
803 |
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
aschiffler@6757
|
804 |
refRectB.h = rectA.h;
|
aschiffler@6757
|
805 |
rectA = refRectA;
|
aschiffler@6757
|
806 |
rectB = refRectB;
|
aschiffler@6757
|
807 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
808 |
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
809 |
|
aschiffler@6757
|
810 |
return TEST_COMPLETED;
|
aschiffler@6757
|
811 |
}
|
aschiffler@6757
|
812 |
|
aschiffler@6757
|
813 |
/*!
|
aschiffler@6757
|
814 |
* \brief Tests SDL_HasIntersection() with 1x1 pixel sized rectangles
|
aschiffler@6757
|
815 |
*
|
aschiffler@6757
|
816 |
* \sa
|
aschiffler@6757
|
817 |
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
aschiffler@6757
|
818 |
*/
|
aschiffler@6757
|
819 |
int rect_testHasIntersectionPoint (void *arg)
|
aschiffler@6757
|
820 |
{
|
aschiffler@6757
|
821 |
SDL_Rect refRectA = { 0, 0, 1, 1 };
|
aschiffler@6757
|
822 |
SDL_Rect refRectB = { 0, 0, 1, 1 };
|
aschiffler@6757
|
823 |
SDL_Rect rectA;
|
aschiffler@6757
|
824 |
SDL_Rect rectB;
|
aschiffler@6757
|
825 |
SDL_bool intersection;
|
aschiffler@6757
|
826 |
int offsetX, offsetY;
|
aschiffler@6757
|
827 |
|
aschiffler@6757
|
828 |
// intersecting pixels
|
aschiffler@6757
|
829 |
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
830 |
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
831 |
refRectB.x = refRectA.x;
|
aschiffler@6757
|
832 |
refRectB.y = refRectA.y;
|
aschiffler@6757
|
833 |
rectA = refRectA;
|
aschiffler@6757
|
834 |
rectB = refRectB;
|
aschiffler@6757
|
835 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
836 |
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
837 |
|
aschiffler@6757
|
838 |
// non-intersecting pixels cases
|
aschiffler@6757
|
839 |
for (offsetX = -1; offsetX <= 1; offsetX++) {
|
aschiffler@6757
|
840 |
for (offsetY = -1; offsetY <= 1; offsetY++) {
|
aschiffler@6757
|
841 |
if (offsetX != 0 || offsetY != 0) {
|
aschiffler@6757
|
842 |
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
843 |
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
844 |
refRectB.x = refRectA.x;
|
aschiffler@6757
|
845 |
refRectB.y = refRectA.y;
|
aschiffler@6757
|
846 |
refRectB.x += offsetX;
|
aschiffler@6757
|
847 |
refRectB.y += offsetY;
|
aschiffler@6757
|
848 |
rectA = refRectA;
|
aschiffler@6757
|
849 |
rectB = refRectB;
|
aschiffler@6757
|
850 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
851 |
_validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
852 |
}
|
aschiffler@6757
|
853 |
}
|
aschiffler@6757
|
854 |
}
|
aschiffler@6757
|
855 |
|
aschiffler@6757
|
856 |
return TEST_COMPLETED;
|
aschiffler@6757
|
857 |
}
|
aschiffler@6757
|
858 |
|
aschiffler@6757
|
859 |
/*!
|
aschiffler@6757
|
860 |
* \brief Tests SDL_HasIntersection() with empty rectangles
|
aschiffler@6757
|
861 |
*
|
aschiffler@6757
|
862 |
* \sa
|
aschiffler@6757
|
863 |
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
aschiffler@6757
|
864 |
*/
|
aschiffler@6757
|
865 |
int rect_testHasIntersectionEmpty (void *arg)
|
aschiffler@6757
|
866 |
{
|
aschiffler@6757
|
867 |
SDL_Rect refRectA;
|
aschiffler@6757
|
868 |
SDL_Rect refRectB;
|
aschiffler@6757
|
869 |
SDL_Rect rectA;
|
aschiffler@6757
|
870 |
SDL_Rect rectB;
|
aschiffler@6757
|
871 |
SDL_bool intersection;
|
aschiffler@6757
|
872 |
|
aschiffler@6757
|
873 |
// Rect A empty
|
aschiffler@6757
|
874 |
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
875 |
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
876 |
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
877 |
refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
878 |
refRectB = refRectA;
|
aschiffler@6757
|
879 |
refRectA.w = 0;
|
aschiffler@6757
|
880 |
refRectA.h = 0;
|
aschiffler@6757
|
881 |
rectA = refRectA;
|
aschiffler@6757
|
882 |
rectB = refRectB;
|
aschiffler@6757
|
883 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
884 |
_validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
885 |
|
aschiffler@6757
|
886 |
// Rect B empty
|
aschiffler@6757
|
887 |
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
888 |
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
889 |
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
890 |
refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
891 |
refRectB = refRectA;
|
aschiffler@6757
|
892 |
refRectB.w = 0;
|
aschiffler@6757
|
893 |
refRectB.h = 0;
|
aschiffler@6757
|
894 |
rectA = refRectA;
|
aschiffler@6757
|
895 |
rectB = refRectB;
|
aschiffler@6757
|
896 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
897 |
_validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
898 |
|
aschiffler@6757
|
899 |
// Rect A and B empty
|
aschiffler@6757
|
900 |
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
901 |
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
902 |
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
903 |
refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
|
aschiffler@6757
|
904 |
refRectB = refRectA;
|
aschiffler@6757
|
905 |
refRectA.w = 0;
|
aschiffler@6757
|
906 |
refRectA.h = 0;
|
aschiffler@6757
|
907 |
refRectB.w = 0;
|
aschiffler@6757
|
908 |
refRectB.h = 0;
|
aschiffler@6757
|
909 |
rectA = refRectA;
|
aschiffler@6757
|
910 |
rectB = refRectB;
|
aschiffler@6757
|
911 |
intersection = SDL_HasIntersection(&rectA, &rectB);
|
aschiffler@6757
|
912 |
_validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
913 |
|
aschiffler@6757
|
914 |
return TEST_COMPLETED;
|
aschiffler@6757
|
915 |
}
|
aschiffler@6757
|
916 |
|
aschiffler@6757
|
917 |
/*!
|
aschiffler@6757
|
918 |
* \brief Negative tests against SDL_HasIntersection() with invalid parameters
|
aschiffler@6757
|
919 |
*
|
aschiffler@6757
|
920 |
* \sa
|
aschiffler@6757
|
921 |
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
aschiffler@6757
|
922 |
*/
|
aschiffler@6757
|
923 |
int rect_testHasIntersectionParam(void *arg)
|
aschiffler@6757
|
924 |
{
|
aschiffler@6757
|
925 |
SDL_Rect rectA;
|
aschiffler@6757
|
926 |
SDL_Rect rectB;
|
aschiffler@6757
|
927 |
SDL_bool intersection;
|
aschiffler@6757
|
928 |
|
aschiffler@6757
|
929 |
// invalid parameter combinations
|
aschiffler@6757
|
930 |
intersection = SDL_HasIntersection((SDL_Rect *)NULL, &rectB);
|
aschiffler@6757
|
931 |
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
|
aschiffler@6757
|
932 |
intersection = SDL_HasIntersection(&rectA, (SDL_Rect *)NULL);
|
aschiffler@6757
|
933 |
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL");
|
aschiffler@6757
|
934 |
intersection = SDL_HasIntersection((SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
935 |
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
|
aschiffler@6757
|
936 |
|
aschiffler@6757
|
937 |
return TEST_COMPLETED;
|
aschiffler@6757
|
938 |
}
|
aschiffler@6757
|
939 |
|
aschiffler@6757
|
940 |
/*!
|
aschiffler@6757
|
941 |
* \brief Test SDL_EnclosePoints() without clipping
|
aschiffler@6757
|
942 |
*
|
aschiffler@6757
|
943 |
* \sa
|
aschiffler@6757
|
944 |
* http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
|
aschiffler@6757
|
945 |
*/
|
aschiffler@6757
|
946 |
int rect_testEnclosePoints(void *arg)
|
aschiffler@6757
|
947 |
{
|
aschiffler@6757
|
948 |
const int numPoints = 16;
|
aschiffler@6757
|
949 |
SDL_Point refPoints[16];
|
aschiffler@6757
|
950 |
SDL_Point points[16];
|
aschiffler@6757
|
951 |
SDL_Rect result;
|
aschiffler@6757
|
952 |
SDL_bool anyEnclosed;
|
aschiffler@6757
|
953 |
SDL_bool anyEnclosedNoResult;
|
aschiffler@6757
|
954 |
|
aschiffler@6757
|
955 |
// Create input data, tracking result
|
aschiffler@6757
|
956 |
SDL_bool expectedEnclosed = SDL_TRUE;
|
aschiffler@6757
|
957 |
int newx, newy;
|
aschiffler@6757
|
958 |
int minx, maxx, miny, maxy;
|
aschiffler@6757
|
959 |
int i;
|
aschiffler@6757
|
960 |
for (i=0; i<numPoints; i++) {
|
aschiffler@6757
|
961 |
newx = SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
962 |
newy = SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
963 |
refPoints[i].x = newx;
|
aschiffler@6757
|
964 |
refPoints[i].y = newy;
|
aschiffler@6757
|
965 |
points[i].x = newx;
|
aschiffler@6757
|
966 |
points[i].y = newy;
|
aschiffler@6757
|
967 |
if (i==0) {
|
aschiffler@6757
|
968 |
minx=maxx=newx;
|
aschiffler@6757
|
969 |
miny=maxy=newy;
|
aschiffler@6757
|
970 |
} else {
|
aschiffler@6757
|
971 |
if (newx<minx) minx=newx;
|
aschiffler@6757
|
972 |
if (newx>maxx) maxx=newx;
|
aschiffler@6757
|
973 |
if (newy<miny) miny=newy;
|
aschiffler@6757
|
974 |
if (newy>maxy) maxy=newy;
|
aschiffler@6757
|
975 |
}
|
aschiffler@6757
|
976 |
}
|
aschiffler@6757
|
977 |
|
aschiffler@6757
|
978 |
// Call function and validate - special case: no result requested
|
aschiffler@6757
|
979 |
anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
980 |
SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
|
aschiffler@6757
|
981 |
"Check expected return value %s, got %s",
|
aschiffler@6757
|
982 |
(expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
983 |
(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
|
aschiffler@6757
|
984 |
for (i=0; i<numPoints; i++) {
|
aschiffler@6757
|
985 |
SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
|
aschiffler@6757
|
986 |
"Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
|
aschiffler@6757
|
987 |
i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
|
aschiffler@6757
|
988 |
}
|
aschiffler@6757
|
989 |
|
aschiffler@6757
|
990 |
// Call function and validate
|
aschiffler@6757
|
991 |
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
|
aschiffler@6757
|
992 |
SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
|
aschiffler@6757
|
993 |
"Check return value %s, got %s",
|
aschiffler@6757
|
994 |
(expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
995 |
(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
|
aschiffler@6757
|
996 |
for (i=0; i<numPoints; i++) {
|
aschiffler@6757
|
997 |
SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
|
aschiffler@6757
|
998 |
"Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
|
aschiffler@6757
|
999 |
i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
|
aschiffler@6757
|
1000 |
}
|
aschiffler@6757
|
1001 |
SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
|
aschiffler@6757
|
1002 |
"Resulting enclosing rectangle incorrect: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
|
aschiffler@6757
|
1003 |
minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
|
aschiffler@6757
|
1004 |
|
aschiffler@6757
|
1005 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1006 |
}
|
aschiffler@6757
|
1007 |
|
aschiffler@6757
|
1008 |
/*!
|
aschiffler@6757
|
1009 |
* \brief Test SDL_EnclosePoints() with repeated input points
|
aschiffler@6757
|
1010 |
*
|
aschiffler@6757
|
1011 |
* \sa
|
aschiffler@6757
|
1012 |
* http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
|
aschiffler@6757
|
1013 |
*/
|
aschiffler@6757
|
1014 |
int rect_testEnclosePointsRepeatedInput(void *arg)
|
aschiffler@6757
|
1015 |
{
|
aschiffler@6757
|
1016 |
const int numPoints = 8;
|
aschiffler@6757
|
1017 |
const int halfPoints = 4;
|
aschiffler@6757
|
1018 |
SDL_Point refPoints[8];
|
aschiffler@6757
|
1019 |
SDL_Point points[8];
|
aschiffler@6757
|
1020 |
SDL_Rect result;
|
aschiffler@6757
|
1021 |
SDL_bool anyEnclosed;
|
aschiffler@6757
|
1022 |
SDL_bool anyEnclosedNoResult;
|
aschiffler@6757
|
1023 |
|
aschiffler@6757
|
1024 |
// Create input data, tracking result
|
aschiffler@6757
|
1025 |
SDL_bool expectedEnclosed = SDL_TRUE;
|
aschiffler@6757
|
1026 |
int newx, newy;
|
aschiffler@6757
|
1027 |
int minx, maxx, miny, maxy;
|
aschiffler@6757
|
1028 |
int i;
|
aschiffler@6757
|
1029 |
for (i=0; i<numPoints; i++) {
|
aschiffler@6757
|
1030 |
if (i < halfPoints) {
|
aschiffler@6757
|
1031 |
newx = SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1032 |
newy = SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1033 |
} else {
|
aschiffler@6757
|
1034 |
newx = refPoints[i-halfPoints].x;
|
aschiffler@6757
|
1035 |
newy = refPoints[i-halfPoints].y;
|
aschiffler@6757
|
1036 |
}
|
aschiffler@6757
|
1037 |
refPoints[i].x = newx;
|
aschiffler@6757
|
1038 |
refPoints[i].y = newy;
|
aschiffler@6757
|
1039 |
points[i].x = newx;
|
aschiffler@6757
|
1040 |
points[i].y = newy;
|
aschiffler@6757
|
1041 |
if (i==0) {
|
aschiffler@6757
|
1042 |
minx=maxx=newx;
|
aschiffler@6757
|
1043 |
miny=maxy=newy;
|
aschiffler@6757
|
1044 |
} else {
|
aschiffler@6757
|
1045 |
if (newx<minx) minx=newx;
|
aschiffler@6757
|
1046 |
if (newx>maxx) maxx=newx;
|
aschiffler@6757
|
1047 |
if (newy<miny) miny=newy;
|
aschiffler@6757
|
1048 |
if (newy>maxy) maxy=newy;
|
aschiffler@6757
|
1049 |
}
|
aschiffler@6757
|
1050 |
}
|
aschiffler@6757
|
1051 |
|
aschiffler@6757
|
1052 |
// Call function and validate - special case: no result requested
|
aschiffler@6757
|
1053 |
anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
1054 |
SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
|
aschiffler@6757
|
1055 |
"Check return value %s, got %s",
|
aschiffler@6757
|
1056 |
(expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
1057 |
(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
|
aschiffler@6757
|
1058 |
for (i=0; i<numPoints; i++) {
|
aschiffler@6757
|
1059 |
SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
|
aschiffler@6757
|
1060 |
"Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
|
aschiffler@6757
|
1061 |
i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
|
aschiffler@6757
|
1062 |
}
|
aschiffler@6757
|
1063 |
|
aschiffler@6757
|
1064 |
// Call function and validate
|
aschiffler@6757
|
1065 |
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
|
aschiffler@6757
|
1066 |
SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
|
aschiffler@6757
|
1067 |
"Check return value %s, got %s",
|
aschiffler@6757
|
1068 |
(expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
1069 |
(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
|
aschiffler@6757
|
1070 |
for (i=0; i<numPoints; i++) {
|
aschiffler@6757
|
1071 |
SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
|
aschiffler@6757
|
1072 |
"Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
|
aschiffler@6757
|
1073 |
i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
|
aschiffler@6757
|
1074 |
}
|
aschiffler@6757
|
1075 |
SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
|
aschiffler@6757
|
1076 |
"Check resulting enclosing rectangle: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
|
aschiffler@6757
|
1077 |
minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
|
aschiffler@6757
|
1078 |
|
aschiffler@6757
|
1079 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1080 |
}
|
aschiffler@6757
|
1081 |
|
aschiffler@6757
|
1082 |
/*!
|
aschiffler@6757
|
1083 |
* \brief Test SDL_EnclosePoints() with clipping
|
aschiffler@6757
|
1084 |
*
|
aschiffler@6757
|
1085 |
* \sa
|
aschiffler@6757
|
1086 |
* http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
|
aschiffler@6757
|
1087 |
*/
|
aschiffler@6757
|
1088 |
int rect_testEnclosePointsWithClipping(void *arg)
|
aschiffler@6757
|
1089 |
{
|
aschiffler@6757
|
1090 |
const int numPoints = 16;
|
aschiffler@6757
|
1091 |
SDL_Point refPoints[16];
|
aschiffler@6757
|
1092 |
SDL_Point points[16];
|
aschiffler@6757
|
1093 |
SDL_Rect refClip;
|
aschiffler@6757
|
1094 |
SDL_Rect clip;
|
aschiffler@6757
|
1095 |
SDL_Rect result;
|
aschiffler@6757
|
1096 |
SDL_bool anyEnclosed;
|
aschiffler@6757
|
1097 |
SDL_bool anyEnclosedNoResult;
|
aschiffler@6757
|
1098 |
SDL_bool expectedEnclosed = SDL_FALSE;
|
aschiffler@6757
|
1099 |
int newx, newy;
|
aschiffler@6757
|
1100 |
int minx, maxx, miny, maxy;
|
aschiffler@6757
|
1101 |
int i;
|
aschiffler@6757
|
1102 |
|
aschiffler@6757
|
1103 |
// Setup clipping rectangle
|
aschiffler@6757
|
1104 |
refClip.x = SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1105 |
refClip.y = SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1106 |
refClip.w = SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1107 |
refClip.h = SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1108 |
|
aschiffler@6757
|
1109 |
// Create input data, tracking result
|
aschiffler@6757
|
1110 |
for (i=0; i<numPoints; i++) {
|
aschiffler@6757
|
1111 |
newx = SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1112 |
newy = SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1113 |
refPoints[i].x = newx;
|
aschiffler@6757
|
1114 |
refPoints[i].y = newy;
|
aschiffler@6757
|
1115 |
points[i].x = newx;
|
aschiffler@6757
|
1116 |
points[i].y = newy;
|
aschiffler@6757
|
1117 |
if ((newx>=refClip.x) && (newx<(refClip.x + refClip.w)) &&
|
aschiffler@6757
|
1118 |
(newy>=refClip.y) && (newy<(refClip.y + refClip.h))) {
|
aschiffler@6757
|
1119 |
if (expectedEnclosed==SDL_FALSE) {
|
aschiffler@6757
|
1120 |
minx=maxx=newx;
|
aschiffler@6757
|
1121 |
miny=maxy=newy;
|
aschiffler@6757
|
1122 |
} else {
|
aschiffler@6757
|
1123 |
if (newx<minx) minx=newx;
|
aschiffler@6757
|
1124 |
if (newx>maxx) maxx=newx;
|
aschiffler@6757
|
1125 |
if (newy<miny) miny=newy;
|
aschiffler@6757
|
1126 |
if (newy>maxy) maxy=newy;
|
aschiffler@6757
|
1127 |
}
|
aschiffler@6757
|
1128 |
expectedEnclosed = SDL_TRUE;
|
aschiffler@6757
|
1129 |
}
|
aschiffler@6757
|
1130 |
}
|
aschiffler@6757
|
1131 |
|
aschiffler@6757
|
1132 |
// Call function and validate - special case: no result requested
|
aschiffler@6757
|
1133 |
clip = refClip;
|
aschiffler@6757
|
1134 |
anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, (SDL_Rect *)NULL);
|
aschiffler@6757
|
1135 |
SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
|
aschiffler@6757
|
1136 |
"Expected return value %s, got %s",
|
aschiffler@6757
|
1137 |
(expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
1138 |
(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
|
aschiffler@6757
|
1139 |
for (i=0; i<numPoints; i++) {
|
aschiffler@6757
|
1140 |
SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
|
aschiffler@6757
|
1141 |
"Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
|
aschiffler@6757
|
1142 |
i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
|
aschiffler@6757
|
1143 |
}
|
aschiffler@6757
|
1144 |
SDLTest_AssertCheck(refClip.x==clip.x && refClip.y==clip.y && refClip.w==clip.w && refClip.h==clip.h,
|
aschiffler@6757
|
1145 |
"Check that source clipping rectangle was not modified");
|
aschiffler@6757
|
1146 |
|
aschiffler@6757
|
1147 |
// Call function and validate
|
aschiffler@6757
|
1148 |
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result);
|
aschiffler@6757
|
1149 |
SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
|
aschiffler@6757
|
1150 |
"Check return value %s, got %s",
|
aschiffler@6757
|
1151 |
(expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
1152 |
(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
|
aschiffler@6757
|
1153 |
for (i=0; i<numPoints; i++) {
|
aschiffler@6757
|
1154 |
SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
|
aschiffler@6757
|
1155 |
"Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
|
aschiffler@6757
|
1156 |
i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
|
aschiffler@6757
|
1157 |
}
|
aschiffler@6757
|
1158 |
SDLTest_AssertCheck(refClip.x==clip.x && refClip.y==clip.y && refClip.w==clip.w && refClip.h==clip.h,
|
aschiffler@6757
|
1159 |
"Check that source clipping rectangle was not modified");
|
aschiffler@6757
|
1160 |
if (expectedEnclosed==SDL_TRUE) {
|
aschiffler@6757
|
1161 |
SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
|
aschiffler@6757
|
1162 |
"Check resulting enclosing rectangle: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
|
aschiffler@6757
|
1163 |
minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
|
aschiffler@6757
|
1164 |
}
|
aschiffler@6757
|
1165 |
|
aschiffler@6757
|
1166 |
/* Empty clipping rectangle */
|
aschiffler@6757
|
1167 |
clip.w = 0;
|
aschiffler@6757
|
1168 |
clip.h = 0;
|
aschiffler@6757
|
1169 |
expectedEnclosed = SDL_FALSE;
|
aschiffler@6757
|
1170 |
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result);
|
aschiffler@6757
|
1171 |
SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
|
aschiffler@6757
|
1172 |
"Check return value %s, got %s",
|
aschiffler@6757
|
1173 |
(expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
|
aschiffler@6757
|
1174 |
(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
|
aschiffler@6757
|
1175 |
|
aschiffler@6757
|
1176 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1177 |
}
|
aschiffler@6757
|
1178 |
|
aschiffler@6757
|
1179 |
/*!
|
aschiffler@6757
|
1180 |
* \brief Negative tests against SDL_EnclosePoints() with invalid parameters
|
aschiffler@6757
|
1181 |
*
|
aschiffler@6757
|
1182 |
* \sa
|
aschiffler@6757
|
1183 |
* http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
|
aschiffler@6757
|
1184 |
*/
|
aschiffler@6757
|
1185 |
int rect_testEnclosePointsParam(void *arg)
|
aschiffler@6757
|
1186 |
{
|
aschiffler@6757
|
1187 |
SDL_Point points[1];
|
aschiffler@6757
|
1188 |
int count;
|
aschiffler@6757
|
1189 |
SDL_Rect clip;
|
aschiffler@6757
|
1190 |
SDL_Rect result;
|
aschiffler@6757
|
1191 |
SDL_bool anyEnclosed;
|
aschiffler@6757
|
1192 |
|
aschiffler@6757
|
1193 |
// invalid parameter combinations
|
aschiffler@6757
|
1194 |
anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 1, (const SDL_Rect *)&clip, &result);
|
aschiffler@6757
|
1195 |
SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL");
|
aschiffler@6757
|
1196 |
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, 0, (const SDL_Rect *)&clip, &result);
|
aschiffler@6757
|
1197 |
SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 2nd parameter is 0");
|
aschiffler@6757
|
1198 |
count = SDLTest_RandomIntegerInRange(-100, -1);
|
aschiffler@6757
|
1199 |
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, count, (const SDL_Rect *)&clip, &result);
|
aschiffler@6757
|
1200 |
SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 2nd parameter is %i (negative)", count);
|
aschiffler@6757
|
1201 |
anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 0, (const SDL_Rect *)&clip, &result);
|
aschiffler@6757
|
1202 |
SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL and 2nd parameter was 0");
|
aschiffler@6757
|
1203 |
|
aschiffler@6757
|
1204 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1205 |
}
|
aschiffler@6757
|
1206 |
|
aschiffler@6757
|
1207 |
/*!
|
aschiffler@6757
|
1208 |
* \brief Tests SDL_UnionRect() where rect B is outside rect A
|
aschiffler@6757
|
1209 |
*
|
aschiffler@6757
|
1210 |
* \sa
|
aschiffler@6757
|
1211 |
* http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
|
aschiffler@6757
|
1212 |
*/
|
aschiffler@6757
|
1213 |
int rect_testUnionRectOutside(void *arg)
|
aschiffler@6757
|
1214 |
{
|
aschiffler@6757
|
1215 |
SDL_Rect refRectA, refRectB;
|
aschiffler@6757
|
1216 |
SDL_Rect rectA, rectB;
|
aschiffler@6757
|
1217 |
SDL_Rect expectedResult;
|
aschiffler@6757
|
1218 |
SDL_Rect result;
|
aschiffler@6757
|
1219 |
int minx, maxx, miny, maxy;
|
aschiffler@6757
|
1220 |
int dx, dy;
|
aschiffler@6757
|
1221 |
|
aschiffler@6757
|
1222 |
/* Union 1x1 outside */
|
aschiffler@6757
|
1223 |
for (dx = -1; dx < 2; dx++) {
|
aschiffler@6757
|
1224 |
for (dy = -1; dy < 2; dy++) {
|
aschiffler@6757
|
1225 |
if ((dx != 0) || (dy != 0)) {
|
aschiffler@6757
|
1226 |
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1227 |
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1228 |
refRectA.w=1;
|
aschiffler@6757
|
1229 |
refRectA.h=1;
|
aschiffler@6757
|
1230 |
refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024) + dx*2048;
|
aschiffler@6757
|
1231 |
refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024) + dx*2048;
|
aschiffler@6757
|
1232 |
refRectB.w=1;
|
aschiffler@6757
|
1233 |
refRectB.h=1;
|
aschiffler@6757
|
1234 |
minx = (refRectA.x<refRectB.x) ? refRectA.x : refRectB.x;
|
aschiffler@6757
|
1235 |
maxx = (refRectA.x>refRectB.x) ? refRectA.x : refRectB.x;
|
aschiffler@6757
|
1236 |
miny = (refRectA.y<refRectB.y) ? refRectA.y : refRectB.y;
|
aschiffler@6757
|
1237 |
maxy = (refRectA.y>refRectB.y) ? refRectA.y : refRectB.y;
|
aschiffler@6757
|
1238 |
expectedResult.x = minx;
|
aschiffler@6757
|
1239 |
expectedResult.y = miny;
|
aschiffler@6757
|
1240 |
expectedResult.w = maxx - minx + 1;
|
aschiffler@6757
|
1241 |
expectedResult.h = maxy - miny + 1;
|
aschiffler@6757
|
1242 |
rectA = refRectA;
|
aschiffler@6757
|
1243 |
rectB = refRectB;
|
aschiffler@6757
|
1244 |
SDL_UnionRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
1245 |
_validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
1246 |
}
|
aschiffler@6757
|
1247 |
}
|
aschiffler@6757
|
1248 |
}
|
aschiffler@6757
|
1249 |
|
aschiffler@6757
|
1250 |
/* Union outside overlap */
|
aschiffler@6757
|
1251 |
for (dx = -1; dx < 2; dx++) {
|
aschiffler@6757
|
1252 |
for (dy = -1; dy < 2; dy++) {
|
aschiffler@6757
|
1253 |
if ((dx != 0) || (dy != 0)) {
|
aschiffler@6757
|
1254 |
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1255 |
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1256 |
refRectA.w=SDLTest_RandomIntegerInRange(256, 512);
|
aschiffler@6757
|
1257 |
refRectA.h=SDLTest_RandomIntegerInRange(256, 512);
|
aschiffler@6757
|
1258 |
refRectB.x=refRectA.x + 1 + dx*2;
|
aschiffler@6757
|
1259 |
refRectB.y=refRectA.y + 1 + dy*2;
|
aschiffler@6757
|
1260 |
refRectB.w=refRectA.w - 2;
|
aschiffler@6757
|
1261 |
refRectB.h=refRectA.h - 2;
|
aschiffler@6757
|
1262 |
expectedResult = refRectA;
|
aschiffler@6757
|
1263 |
if (dx == -1) expectedResult.x--;
|
aschiffler@6757
|
1264 |
if (dy == -1) expectedResult.y--;
|
aschiffler@6757
|
1265 |
if ((dx == 1) || (dx == -1)) expectedResult.w++;
|
aschiffler@6757
|
1266 |
if ((dy == 1) || (dy == -1)) expectedResult.h++;
|
aschiffler@6757
|
1267 |
rectA = refRectA;
|
aschiffler@6757
|
1268 |
rectB = refRectB;
|
aschiffler@6757
|
1269 |
SDL_UnionRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
1270 |
_validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
1271 |
}
|
aschiffler@6757
|
1272 |
}
|
aschiffler@6757
|
1273 |
}
|
aschiffler@6757
|
1274 |
|
aschiffler@6757
|
1275 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1276 |
}
|
aschiffler@6757
|
1277 |
|
aschiffler@6757
|
1278 |
/*!
|
aschiffler@6757
|
1279 |
* \brief Tests SDL_UnionRect() where rect A or rect B are empty
|
aschiffler@6757
|
1280 |
*
|
aschiffler@6757
|
1281 |
* \sa
|
aschiffler@6757
|
1282 |
* http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
|
aschiffler@6757
|
1283 |
*/
|
aschiffler@6757
|
1284 |
int rect_testUnionRectEmpty(void *arg)
|
aschiffler@6757
|
1285 |
{
|
aschiffler@6757
|
1286 |
SDL_Rect refRectA, refRectB;
|
aschiffler@6757
|
1287 |
SDL_Rect rectA, rectB;
|
aschiffler@6757
|
1288 |
SDL_Rect expectedResult;
|
aschiffler@6757
|
1289 |
SDL_Rect result;
|
aschiffler@6757
|
1290 |
|
aschiffler@6757
|
1291 |
/* A empty */
|
aschiffler@6757
|
1292 |
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1293 |
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1294 |
refRectA.w=0;
|
aschiffler@6757
|
1295 |
refRectA.h=0;
|
aschiffler@6757
|
1296 |
refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1297 |
refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1298 |
refRectB.w=SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1299 |
refRectB.h=SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1300 |
expectedResult = refRectB;
|
aschiffler@6757
|
1301 |
rectA = refRectA;
|
aschiffler@6757
|
1302 |
rectB = refRectB;
|
aschiffler@6757
|
1303 |
SDL_UnionRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
1304 |
_validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
1305 |
|
aschiffler@6757
|
1306 |
/* B empty */
|
aschiffler@6757
|
1307 |
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1308 |
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1309 |
refRectA.w=SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1310 |
refRectA.h=SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1311 |
refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1312 |
refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1313 |
refRectB.w=0;
|
aschiffler@6757
|
1314 |
refRectB.h=0;
|
aschiffler@6757
|
1315 |
expectedResult = refRectA;
|
aschiffler@6757
|
1316 |
rectA = refRectA;
|
aschiffler@6757
|
1317 |
rectB = refRectB;
|
aschiffler@6757
|
1318 |
SDL_UnionRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
1319 |
_validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
1320 |
|
aschiffler@6757
|
1321 |
/* A and B empty */
|
aschiffler@6757
|
1322 |
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1323 |
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1324 |
refRectA.w=0;
|
aschiffler@6757
|
1325 |
refRectA.h=0;
|
aschiffler@6757
|
1326 |
refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1327 |
refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1328 |
refRectB.w=0;
|
aschiffler@6757
|
1329 |
refRectB.h=0;
|
aschiffler@6757
|
1330 |
result.x=0;
|
aschiffler@6757
|
1331 |
result.y=0;
|
aschiffler@6757
|
1332 |
result.w=0;
|
aschiffler@6757
|
1333 |
result.h=0;
|
aschiffler@6757
|
1334 |
expectedResult = result;
|
aschiffler@6757
|
1335 |
rectA = refRectA;
|
aschiffler@6757
|
1336 |
rectB = refRectB;
|
aschiffler@6757
|
1337 |
SDL_UnionRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
1338 |
_validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
1339 |
|
aschiffler@6757
|
1340 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1341 |
}
|
aschiffler@6757
|
1342 |
|
aschiffler@6757
|
1343 |
/*!
|
aschiffler@6757
|
1344 |
* \brief Tests SDL_UnionRect() where rect B is inside rect A
|
aschiffler@6757
|
1345 |
*
|
aschiffler@6757
|
1346 |
* \sa
|
aschiffler@6757
|
1347 |
* http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
|
aschiffler@6757
|
1348 |
*/
|
aschiffler@6757
|
1349 |
int rect_testUnionRectInside(void *arg)
|
aschiffler@6757
|
1350 |
{
|
aschiffler@6757
|
1351 |
SDL_Rect refRectA, refRectB;
|
aschiffler@6757
|
1352 |
SDL_Rect rectA, rectB;
|
aschiffler@6757
|
1353 |
SDL_Rect expectedResult;
|
aschiffler@6757
|
1354 |
SDL_Rect result;
|
aschiffler@6757
|
1355 |
int dx, dy;
|
aschiffler@6757
|
1356 |
|
aschiffler@6757
|
1357 |
/* Union 1x1 with itself */
|
aschiffler@6757
|
1358 |
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1359 |
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1360 |
refRectA.w=1;
|
aschiffler@6757
|
1361 |
refRectA.h=1;
|
aschiffler@6757
|
1362 |
expectedResult = refRectA;
|
aschiffler@6757
|
1363 |
rectA = refRectA;
|
aschiffler@6757
|
1364 |
SDL_UnionRect(&rectA, &rectA, &result);
|
aschiffler@6757
|
1365 |
_validateUnionRectResults(&rectA, &rectA, &refRectA, &refRectA, &result, &expectedResult);
|
aschiffler@6757
|
1366 |
|
aschiffler@6757
|
1367 |
/* Union 1x1 somewhere inside */
|
aschiffler@6757
|
1368 |
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1369 |
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1370 |
refRectA.w=SDLTest_RandomIntegerInRange(256, 1024);
|
aschiffler@6757
|
1371 |
refRectA.h=SDLTest_RandomIntegerInRange(256, 1024);
|
aschiffler@6757
|
1372 |
refRectB.x=refRectA.x + 1 + SDLTest_RandomIntegerInRange(1, refRectA.w - 2);
|
aschiffler@6757
|
1373 |
refRectB.y=refRectA.y + 1 + SDLTest_RandomIntegerInRange(1, refRectA.h - 2);
|
aschiffler@6757
|
1374 |
refRectB.w=1;
|
aschiffler@6757
|
1375 |
refRectB.h=1;
|
aschiffler@6757
|
1376 |
expectedResult = refRectA;
|
aschiffler@6757
|
1377 |
rectA = refRectA;
|
aschiffler@6757
|
1378 |
rectB = refRectB;
|
aschiffler@6757
|
1379 |
SDL_UnionRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
1380 |
_validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
1381 |
|
aschiffler@6757
|
1382 |
/* Union inside with edges modified */
|
aschiffler@6757
|
1383 |
for (dx = -1; dx < 2; dx++) {
|
aschiffler@6757
|
1384 |
for (dy = -1; dy < 2; dy++) {
|
aschiffler@6757
|
1385 |
if ((dx != 0) || (dy != 0)) {
|
aschiffler@6757
|
1386 |
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1387 |
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1388 |
refRectA.w=SDLTest_RandomIntegerInRange(256, 1024);
|
aschiffler@6757
|
1389 |
refRectA.h=SDLTest_RandomIntegerInRange(256, 1024);
|
aschiffler@6757
|
1390 |
refRectB = refRectA;
|
aschiffler@6757
|
1391 |
if (dx == -1) refRectB.x++;
|
aschiffler@6757
|
1392 |
if ((dx == 1) || (dx == -1)) refRectB.w--;
|
aschiffler@6757
|
1393 |
if (dy == -1) refRectB.y++;
|
aschiffler@6757
|
1394 |
if ((dy == 1) || (dy == -1)) refRectB.h--;
|
aschiffler@6757
|
1395 |
expectedResult = refRectA;
|
aschiffler@6757
|
1396 |
rectA = refRectA;
|
aschiffler@6757
|
1397 |
rectB = refRectB;
|
aschiffler@6757
|
1398 |
SDL_UnionRect(&rectA, &rectB, &result);
|
aschiffler@6757
|
1399 |
_validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
aschiffler@6757
|
1400 |
}
|
aschiffler@6757
|
1401 |
}
|
aschiffler@6757
|
1402 |
}
|
aschiffler@6757
|
1403 |
|
aschiffler@6757
|
1404 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1405 |
}
|
aschiffler@6757
|
1406 |
|
aschiffler@6757
|
1407 |
/*!
|
aschiffler@6757
|
1408 |
* \brief Negative tests against SDL_UnionRect() with invalid parameters
|
aschiffler@6757
|
1409 |
*
|
aschiffler@6757
|
1410 |
* \sa
|
aschiffler@6757
|
1411 |
* http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
|
aschiffler@6757
|
1412 |
*/
|
aschiffler@6757
|
1413 |
int rect_testUnionRectParam(void *arg)
|
aschiffler@6757
|
1414 |
{
|
aschiffler@6757
|
1415 |
SDL_Rect rectA, rectB;
|
aschiffler@6757
|
1416 |
SDL_Rect result;
|
aschiffler@6757
|
1417 |
|
aschiffler@6757
|
1418 |
// invalid parameter combinations
|
aschiffler@6757
|
1419 |
SDL_UnionRect((SDL_Rect *)NULL, &rectB, &result);
|
aschiffler@6757
|
1420 |
SDLTest_AssertPass("Check that function returns when 1st parameter is NULL");
|
aschiffler@6757
|
1421 |
SDL_UnionRect(&rectA, (SDL_Rect *)NULL, &result);
|
aschiffler@6757
|
1422 |
SDLTest_AssertPass("Check that function returns when 2nd parameter is NULL");
|
aschiffler@6757
|
1423 |
SDL_UnionRect(&rectA, &rectB, (SDL_Rect *)NULL);
|
aschiffler@6757
|
1424 |
SDLTest_AssertPass("Check that function returns when 3rd parameter is NULL");
|
aschiffler@6757
|
1425 |
SDL_UnionRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL);
|
aschiffler@6757
|
1426 |
SDLTest_AssertPass("Check that function returns when 1st and 3rd parameter are NULL");
|
aschiffler@6757
|
1427 |
SDL_UnionRect(&rectA, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
1428 |
SDLTest_AssertPass("Check that function returns when 2nd and 3rd parameter are NULL");
|
aschiffler@6757
|
1429 |
SDL_UnionRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
aschiffler@6757
|
1430 |
SDLTest_AssertPass("Check that function returns when all parameters are NULL");
|
aschiffler@6757
|
1431 |
|
aschiffler@6757
|
1432 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1433 |
}
|
aschiffler@6757
|
1434 |
|
aschiffler@6757
|
1435 |
/*!
|
aschiffler@6757
|
1436 |
* \brief Tests SDL_RectEmpty() with various inputs
|
aschiffler@6757
|
1437 |
*
|
aschiffler@6757
|
1438 |
* \sa
|
aschiffler@6757
|
1439 |
* http://wiki.libsdl.org/moin.cgi/SDL_RectEmpty
|
aschiffler@6757
|
1440 |
*/
|
aschiffler@6757
|
1441 |
int rect_testRectEmpty(void *arg)
|
aschiffler@6757
|
1442 |
{
|
aschiffler@6757
|
1443 |
SDL_Rect refRect;
|
aschiffler@6757
|
1444 |
SDL_Rect rect;
|
aschiffler@6757
|
1445 |
SDL_bool expectedResult;
|
aschiffler@6757
|
1446 |
SDL_bool result;
|
aschiffler@6757
|
1447 |
int w, h;
|
aschiffler@6757
|
1448 |
|
aschiffler@6757
|
1449 |
// Non-empty case
|
aschiffler@6757
|
1450 |
refRect.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1451 |
refRect.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1452 |
refRect.w=SDLTest_RandomIntegerInRange(256, 1024);
|
aschiffler@6757
|
1453 |
refRect.h=SDLTest_RandomIntegerInRange(256, 1024);
|
aschiffler@6757
|
1454 |
expectedResult = SDL_FALSE;
|
aschiffler@6757
|
1455 |
rect = refRect;
|
aschiffler@6757
|
1456 |
result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)&rect);
|
aschiffler@6757
|
1457 |
_validateRectEmptyResults(result, expectedResult, &rect, &refRect);
|
aschiffler@6757
|
1458 |
|
aschiffler@6757
|
1459 |
// Empty case
|
aschiffler@6757
|
1460 |
for (w=-1; w<2; w++) {
|
aschiffler@6757
|
1461 |
for (h=-1; h<2; h++) {
|
aschiffler@6757
|
1462 |
if ((w != 1) || (h != 1)) {
|
aschiffler@6757
|
1463 |
refRect.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1464 |
refRect.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1465 |
refRect.w=w;
|
aschiffler@6757
|
1466 |
refRect.h=h;
|
aschiffler@6757
|
1467 |
expectedResult = SDL_TRUE;
|
aschiffler@6757
|
1468 |
rect = refRect;
|
aschiffler@6757
|
1469 |
result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)&rect);
|
aschiffler@6757
|
1470 |
_validateRectEmptyResults(result, expectedResult, &rect, &refRect);
|
aschiffler@6757
|
1471 |
}
|
aschiffler@6757
|
1472 |
}
|
aschiffler@6757
|
1473 |
}
|
aschiffler@6757
|
1474 |
|
aschiffler@6757
|
1475 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1476 |
}
|
aschiffler@6757
|
1477 |
|
aschiffler@6757
|
1478 |
/*!
|
aschiffler@6757
|
1479 |
* \brief Negative tests against SDL_RectEmpty() with invalid parameters
|
aschiffler@6757
|
1480 |
*
|
aschiffler@6757
|
1481 |
* \sa
|
aschiffler@6757
|
1482 |
* http://wiki.libsdl.org/moin.cgi/SDL_RectEmpty
|
aschiffler@6757
|
1483 |
*/
|
aschiffler@6757
|
1484 |
int rect_testRectEmptyParam(void *arg)
|
aschiffler@6757
|
1485 |
{
|
aschiffler@6757
|
1486 |
SDL_bool result;
|
aschiffler@6757
|
1487 |
|
aschiffler@6757
|
1488 |
// invalid parameter combinations
|
aschiffler@6757
|
1489 |
result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)NULL);
|
aschiffler@6757
|
1490 |
SDLTest_AssertCheck(result == SDL_TRUE, "Check that function returns TRUE when 1st parameter is NULL");
|
aschiffler@6757
|
1491 |
|
aschiffler@6757
|
1492 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1493 |
}
|
aschiffler@6757
|
1494 |
|
aschiffler@6757
|
1495 |
/*!
|
aschiffler@6757
|
1496 |
* \brief Tests SDL_RectEquals() with various inputs
|
aschiffler@6757
|
1497 |
*
|
aschiffler@6757
|
1498 |
* \sa
|
aschiffler@6757
|
1499 |
* http://wiki.libsdl.org/moin.cgi/SDL_RectEquals
|
aschiffler@6757
|
1500 |
*/
|
aschiffler@6757
|
1501 |
int rect_testRectEquals(void *arg)
|
aschiffler@6757
|
1502 |
{
|
aschiffler@6757
|
1503 |
SDL_Rect refRectA;
|
aschiffler@6757
|
1504 |
SDL_Rect refRectB;
|
aschiffler@6757
|
1505 |
SDL_Rect rectA;
|
aschiffler@6757
|
1506 |
SDL_Rect rectB;
|
aschiffler@6757
|
1507 |
SDL_bool expectedResult;
|
aschiffler@6757
|
1508 |
SDL_bool result;
|
aschiffler@6757
|
1509 |
|
aschiffler@6757
|
1510 |
// Equals
|
aschiffler@6757
|
1511 |
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1512 |
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1513 |
refRectA.w=SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1514 |
refRectA.h=SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1515 |
refRectB = refRectA;
|
aschiffler@6757
|
1516 |
expectedResult = SDL_TRUE;
|
aschiffler@6757
|
1517 |
rectA = refRectA;
|
aschiffler@6757
|
1518 |
rectB = refRectB;
|
aschiffler@6757
|
1519 |
result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)&rectA, (const SDL_Rect *)&rectB);
|
aschiffler@6757
|
1520 |
_validateRectEqualsResults(result, expectedResult, &rectA, &rectB, &refRectA, &refRectB);
|
aschiffler@6757
|
1521 |
|
aschiffler@6757
|
1522 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1523 |
}
|
aschiffler@6757
|
1524 |
|
aschiffler@6757
|
1525 |
/*!
|
aschiffler@6757
|
1526 |
* \brief Negative tests against SDL_RectEquals() with invalid parameters
|
aschiffler@6757
|
1527 |
*
|
aschiffler@6757
|
1528 |
* \sa
|
aschiffler@6757
|
1529 |
* http://wiki.libsdl.org/moin.cgi/SDL_RectEquals
|
aschiffler@6757
|
1530 |
*/
|
aschiffler@6757
|
1531 |
int rect_testRectEqualsParam(void *arg)
|
aschiffler@6757
|
1532 |
{
|
aschiffler@6757
|
1533 |
SDL_Rect rectA;
|
aschiffler@6757
|
1534 |
SDL_Rect rectB;
|
aschiffler@6757
|
1535 |
SDL_bool result;
|
aschiffler@6757
|
1536 |
|
aschiffler@6757
|
1537 |
/* data setup */
|
aschiffler@6757
|
1538 |
rectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1539 |
rectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1540 |
rectA.w=SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1541 |
rectA.h=SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1542 |
rectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1543 |
rectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
aschiffler@6757
|
1544 |
rectB.w=SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1545 |
rectB.h=SDLTest_RandomIntegerInRange(1, 1024);
|
aschiffler@6757
|
1546 |
|
aschiffler@6757
|
1547 |
// invalid parameter combinations
|
aschiffler@6757
|
1548 |
result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)NULL, (const SDL_Rect *)&rectB);
|
aschiffler@6757
|
1549 |
SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
|
aschiffler@6757
|
1550 |
result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)&rectA, (const SDL_Rect *)NULL);
|
aschiffler@6757
|
1551 |
SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL");
|
aschiffler@6757
|
1552 |
result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)NULL, (const SDL_Rect *)NULL);
|
aschiffler@6757
|
1553 |
SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameter are NULL");
|
aschiffler@6757
|
1554 |
|
aschiffler@6757
|
1555 |
return TEST_COMPLETED;
|
aschiffler@6757
|
1556 |
}
|
aschiffler@6757
|
1557 |
|
aschiffler@6757
|
1558 |
/* ================= Test References ================== */
|
aschiffler@6757
|
1559 |
|
aschiffler@6757
|
1560 |
/* Rect test cases */
|
aschiffler@6757
|
1561 |
|
aschiffler@6757
|
1562 |
/* SDL_IntersectRectAndLine */
|
aschiffler@6757
|
1563 |
static const SDLTest_TestCaseReference rectTest1 =
|
aschiffler@6757
|
1564 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLine,"rect_testIntersectRectAndLine", "Tests SDL_IntersectRectAndLine clipping cases", TEST_ENABLED };
|
aschiffler@6757
|
1565 |
|
aschiffler@6757
|
1566 |
static const SDLTest_TestCaseReference rectTest2 =
|
aschiffler@6757
|
1567 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineInside, "rect_testIntersectRectAndLineInside", "Tests SDL_IntersectRectAndLine with line fully contained in rect", TEST_ENABLED };
|
aschiffler@6757
|
1568 |
|
aschiffler@6757
|
1569 |
static const SDLTest_TestCaseReference rectTest3 =
|
aschiffler@6757
|
1570 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineOutside, "rect_testIntersectRectAndLineOutside", "Tests SDL_IntersectRectAndLine with line fully outside of rect", TEST_ENABLED };
|
aschiffler@6757
|
1571 |
|
aschiffler@6757
|
1572 |
static const SDLTest_TestCaseReference rectTest4 =
|
aschiffler@6757
|
1573 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineEmpty, "rect_testIntersectRectAndLineEmpty", "Tests SDL_IntersectRectAndLine with empty rectangle ", TEST_ENABLED };
|
aschiffler@6757
|
1574 |
|
aschiffler@6757
|
1575 |
static const SDLTest_TestCaseReference rectTest5 =
|
aschiffler@6757
|
1576 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineParam, "rect_testIntersectRectAndLineParam", "Negative tests against SDL_IntersectRectAndLine with invalid parameters", TEST_ENABLED };
|
aschiffler@6757
|
1577 |
|
aschiffler@6757
|
1578 |
/* SDL_IntersectRect */
|
aschiffler@6757
|
1579 |
static const SDLTest_TestCaseReference rectTest6 =
|
aschiffler@6757
|
1580 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectInside, "rect_testIntersectRectInside", "Tests SDL_IntersectRect with B fully contained in A", TEST_ENABLED };
|
aschiffler@6757
|
1581 |
|
aschiffler@6757
|
1582 |
static const SDLTest_TestCaseReference rectTest7 =
|
aschiffler@6757
|
1583 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectOutside, "rect_testIntersectRectOutside", "Tests SDL_IntersectRect with B fully outside of A", TEST_ENABLED };
|
aschiffler@6757
|
1584 |
|
aschiffler@6757
|
1585 |
static const SDLTest_TestCaseReference rectTest8 =
|
aschiffler@6757
|
1586 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectPartial, "rect_testIntersectRectPartial", "Tests SDL_IntersectRect with B partially intersecting A", TEST_ENABLED };
|
aschiffler@6757
|
1587 |
|
aschiffler@6757
|
1588 |
static const SDLTest_TestCaseReference rectTest9 =
|
aschiffler@6757
|
1589 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectPoint, "rect_testIntersectRectPoint", "Tests SDL_IntersectRect with 1x1 sized rectangles", TEST_ENABLED };
|
aschiffler@6757
|
1590 |
|
aschiffler@6757
|
1591 |
static const SDLTest_TestCaseReference rectTest10 =
|
aschiffler@6757
|
1592 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectEmpty, "rect_testIntersectRectEmpty", "Tests SDL_IntersectRect with empty rectangles", TEST_ENABLED };
|
aschiffler@6757
|
1593 |
|
aschiffler@6757
|
1594 |
static const SDLTest_TestCaseReference rectTest11 =
|
aschiffler@6757
|
1595 |
{ (SDLTest_TestCaseFp)rect_testIntersectRectParam, "rect_testIntersectRectParam", "Negative tests against SDL_IntersectRect with invalid parameters", TEST_ENABLED };
|
aschiffler@6757
|
1596 |
|
aschiffler@6757
|
1597 |
/* SDL_HasIntersection */
|
aschiffler@6757
|
1598 |
static const SDLTest_TestCaseReference rectTest12 =
|
aschiffler@6757
|
1599 |
{ (SDLTest_TestCaseFp)rect_testHasIntersectionInside, "rect_testHasIntersectionInside", "Tests SDL_HasIntersection with B fully contained in A", TEST_ENABLED };
|
aschiffler@6757
|
1600 |
|
aschiffler@6757
|
1601 |
static const SDLTest_TestCaseReference rectTest13 =
|
aschiffler@6757
|
1602 |
{ (SDLTest_TestCaseFp)rect_testHasIntersectionOutside, "rect_testHasIntersectionOutside", "Tests SDL_HasIntersection with B fully outside of A", TEST_ENABLED };
|
aschiffler@6757
|
1603 |
|
aschiffler@6757
|
1604 |
static const SDLTest_TestCaseReference rectTest14 =
|
aschiffler@6757
|
1605 |
{ (SDLTest_TestCaseFp)rect_testHasIntersectionPartial,"rect_testHasIntersectionPartial", "Tests SDL_HasIntersection with B partially intersecting A", TEST_ENABLED };
|
aschiffler@6757
|
1606 |
|
aschiffler@6757
|
1607 |
static const SDLTest_TestCaseReference rectTest15 =
|
aschiffler@6757
|
1608 |
{ (SDLTest_TestCaseFp)rect_testHasIntersectionPoint, "rect_testHasIntersectionPoint", "Tests SDL_HasIntersection with 1x1 sized rectangles", TEST_ENABLED };
|
aschiffler@6757
|
1609 |
|
aschiffler@6757
|
1610 |
static const SDLTest_TestCaseReference rectTest16 =
|
aschiffler@6757
|
1611 |
{ (SDLTest_TestCaseFp)rect_testHasIntersectionEmpty, "rect_testHasIntersectionEmpty", "Tests SDL_HasIntersection with empty rectangles", TEST_ENABLED };
|
aschiffler@6757
|
1612 |
|
aschiffler@6757
|
1613 |
static const SDLTest_TestCaseReference rectTest17 =
|
aschiffler@6757
|
1614 |
{ (SDLTest_TestCaseFp)rect_testHasIntersectionParam, "rect_testHasIntersectionParam", "Negative tests against SDL_HasIntersection with invalid parameters", TEST_ENABLED };
|
aschiffler@6757
|
1615 |
|
aschiffler@6757
|
1616 |
/* SDL_EnclosePoints */
|
aschiffler@6757
|
1617 |
static const SDLTest_TestCaseReference rectTest18 =
|
aschiffler@6757
|
1618 |
{ (SDLTest_TestCaseFp)rect_testEnclosePoints, "rect_testEnclosePoints", "Tests SDL_EnclosePoints without clipping", TEST_ENABLED };
|
aschiffler@6757
|
1619 |
|
aschiffler@6757
|
1620 |
static const SDLTest_TestCaseReference rectTest19 =
|
aschiffler@6757
|
1621 |
{ (SDLTest_TestCaseFp)rect_testEnclosePointsWithClipping, "rect_testEnclosePointsWithClipping", "Tests SDL_EnclosePoints with clipping", TEST_ENABLED };
|
aschiffler@6757
|
1622 |
|
aschiffler@6757
|
1623 |
static const SDLTest_TestCaseReference rectTest20 =
|
aschiffler@6757
|
1624 |
{ (SDLTest_TestCaseFp)rect_testEnclosePointsRepeatedInput, "rect_testEnclosePointsRepeatedInput", "Tests SDL_EnclosePoints with repeated input", TEST_ENABLED };
|
aschiffler@6757
|
1625 |
|
aschiffler@6757
|
1626 |
static const SDLTest_TestCaseReference rectTest21 =
|
aschiffler@6757
|
1627 |
{ (SDLTest_TestCaseFp)rect_testEnclosePointsParam, "rect_testEnclosePointsParam", "Negative tests against SDL_EnclosePoints with invalid parameters", TEST_ENABLED };
|
aschiffler@6757
|
1628 |
|
aschiffler@6757
|
1629 |
/* SDL_UnionRect */
|
aschiffler@6757
|
1630 |
static const SDLTest_TestCaseReference rectTest22 =
|
aschiffler@6757
|
1631 |
{ (SDLTest_TestCaseFp)rect_testUnionRectInside, "rect_testUnionRectInside", "Tests SDL_UnionRect where rect B is inside rect A", TEST_ENABLED };
|
aschiffler@6757
|
1632 |
|
aschiffler@6757
|
1633 |
static const SDLTest_TestCaseReference rectTest23 =
|
aschiffler@6757
|
1634 |
{ (SDLTest_TestCaseFp)rect_testUnionRectOutside, "rect_testUnionRectOutside", "Tests SDL_UnionRect where rect B is outside rect A", TEST_ENABLED };
|
aschiffler@6757
|
1635 |
|
aschiffler@6757
|
1636 |
static const SDLTest_TestCaseReference rectTest24 =
|
aschiffler@6757
|
1637 |
{ (SDLTest_TestCaseFp)rect_testUnionRectEmpty, "rect_testUnionRectEmpty", "Tests SDL_UnionRect where rect A or rect B are empty", TEST_ENABLED };
|
aschiffler@6757
|
1638 |
|
aschiffler@6757
|
1639 |
static const SDLTest_TestCaseReference rectTest25 =
|
aschiffler@6757
|
1640 |
{ (SDLTest_TestCaseFp)rect_testUnionRectParam, "rect_testUnionRectParam", "Negative tests against SDL_UnionRect with invalid parameters", TEST_ENABLED };
|
aschiffler@6757
|
1641 |
|
aschiffler@6757
|
1642 |
/* SDL_RectEmpty */
|
aschiffler@6757
|
1643 |
static const SDLTest_TestCaseReference rectTest26 =
|
aschiffler@6757
|
1644 |
{ (SDLTest_TestCaseFp)rect_testRectEmpty, "rect_testRectEmpty", "Tests SDL_RectEmpty with various inputs", TEST_ENABLED };
|
aschiffler@6757
|
1645 |
|
aschiffler@6757
|
1646 |
static const SDLTest_TestCaseReference rectTest27 =
|
aschiffler@6757
|
1647 |
{ (SDLTest_TestCaseFp)rect_testRectEmptyParam, "rect_testRectEmptyParam", "Negative tests against SDL_RectEmpty with invalid parameters", TEST_ENABLED };
|
aschiffler@6757
|
1648 |
|
aschiffler@6757
|
1649 |
/* SDL_RectEquals */
|
aschiffler@6757
|
1650 |
|
aschiffler@6757
|
1651 |
static const SDLTest_TestCaseReference rectTest28 =
|
aschiffler@6757
|
1652 |
{ (SDLTest_TestCaseFp)rect_testRectEquals, "rect_testRectEquals", "Tests SDL_RectEquals with various inputs", TEST_ENABLED };
|
aschiffler@6757
|
1653 |
|
aschiffler@6757
|
1654 |
static const SDLTest_TestCaseReference rectTest29 =
|
aschiffler@6757
|
1655 |
{ (SDLTest_TestCaseFp)rect_testRectEqualsParam, "rect_testRectEqualsParam", "Negative tests against SDL_RectEquals with invalid parameters", TEST_ENABLED };
|
aschiffler@6757
|
1656 |
|
aschiffler@6757
|
1657 |
|
aschiffler@6757
|
1658 |
/*!
|
aschiffler@6757
|
1659 |
* \brief Sequence of Rect test cases; functions that handle simple rectangles including overlaps and merges.
|
aschiffler@6757
|
1660 |
*
|
aschiffler@6757
|
1661 |
* \sa
|
aschiffler@6757
|
1662 |
* http://wiki.libsdl.org/moin.cgi/CategoryRect
|
aschiffler@6757
|
1663 |
*/
|
aschiffler@6757
|
1664 |
static const SDLTest_TestCaseReference *rectTests[] = {
|
aschiffler@6757
|
1665 |
&rectTest1, &rectTest2, &rectTest3, &rectTest4, &rectTest5, &rectTest6, &rectTest7, &rectTest8, &rectTest9, &rectTest10, &rectTest11, &rectTest12, &rectTest13, &rectTest14,
|
aschiffler@6757
|
1666 |
&rectTest15, &rectTest16, &rectTest17, &rectTest18, &rectTest19, &rectTest20, &rectTest21, &rectTest22, &rectTest23, &rectTest24, &rectTest25, &rectTest26, &rectTest27,
|
aschiffler@6757
|
1667 |
&rectTest28, &rectTest29, NULL
|
aschiffler@6757
|
1668 |
};
|
aschiffler@6757
|
1669 |
|
aschiffler@6757
|
1670 |
|
aschiffler@6757
|
1671 |
/* Rect test suite (global) */
|
aschiffler@6757
|
1672 |
SDLTest_TestSuiteReference rectTestSuite = {
|
aschiffler@6757
|
1673 |
"Rect",
|
aschiffler@6757
|
1674 |
NULL,
|
aschiffler@6757
|
1675 |
rectTests,
|
aschiffler@6757
|
1676 |
NULL
|
aschiffler@6757
|
1677 |
};
|