#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
Go to the source code of this file.
|
void | _validateIntersectRectAndLineResults (SDL_bool intersection, SDL_bool expectedIntersection, SDL_Rect *rect, SDL_Rect *refRect, int x1, int y1, int x2, int y2, int x1Ref, int y1Ref, int x2Ref, int y2Ref) |
|
int | rect_testIntersectRectAndLine (void *arg) |
|
int | rect_testIntersectRectAndLineInside (void *arg) |
|
int | rect_testIntersectRectAndLineOutside (void *arg) |
|
int | rect_testIntersectRectAndLineEmpty (void *arg) |
|
int | rect_testIntersectRectAndLineParam (void *arg) |
|
void | _validateHasIntersectionResults (SDL_bool intersection, SDL_bool expectedIntersection, SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB) |
|
void | _validateIntersectRectResults (SDL_bool intersection, SDL_bool expectedIntersection, SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, SDL_Rect *result, SDL_Rect *expectedResult) |
|
void | _validateUnionRectResults (SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, SDL_Rect *result, SDL_Rect *expectedResult) |
|
void | _validateRectEmptyResults (SDL_bool empty, SDL_bool expectedEmpty, SDL_Rect *rect, SDL_Rect *refRect) |
|
void | _validateRectEqualsResults (SDL_bool equals, SDL_bool expectedEquals, SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB) |
|
int | rect_testIntersectRectInside (void *arg) |
|
int | rect_testIntersectRectOutside (void *arg) |
|
int | rect_testIntersectRectPartial (void *arg) |
|
int | rect_testIntersectRectPoint (void *arg) |
|
int | rect_testIntersectRectEmpty (void *arg) |
|
int | rect_testIntersectRectParam (void *arg) |
|
int | rect_testHasIntersectionInside (void *arg) |
|
int | rect_testHasIntersectionOutside (void *arg) |
|
int | rect_testHasIntersectionPartial (void *arg) |
|
int | rect_testHasIntersectionPoint (void *arg) |
|
int | rect_testHasIntersectionEmpty (void *arg) |
|
int | rect_testHasIntersectionParam (void *arg) |
|
int | rect_testEnclosePoints (void *arg) |
|
int | rect_testEnclosePointsRepeatedInput (void *arg) |
|
int | rect_testEnclosePointsWithClipping (void *arg) |
|
int | rect_testEnclosePointsParam (void *arg) |
|
int | rect_testUnionRectOutside (void *arg) |
|
int | rect_testUnionRectEmpty (void *arg) |
|
int | rect_testUnionRectInside (void *arg) |
|
int | rect_testUnionRectParam (void *arg) |
|
int | rect_testRectEmpty (void *arg) |
|
int | rect_testRectEmptyParam (void *arg) |
|
int | rect_testRectEquals (void *arg) |
|
int | rect_testRectEqualsParam (void *arg) |
|
◆ _validateHasIntersectionResults()
Definition at line 308 of file testautomation_rect.c.
313 "Check intersection result: expected %s, got %s intersecting A (%d,%d,%d,%d) with B (%d,%d,%d,%d)",
314 (expectedIntersection ==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
315 (intersection ==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
316 rectA->
x, rectA->
y, rectA->
w, rectA->
h,
317 rectB->
x, rectB->
y, rectB->
w, rectB->
h);
319 "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
320 rectA->
x, rectA->
y, rectA->
w, rectA->
h,
321 refRectA->
x, refRectA->
y, refRectA->
w, refRectA->
h);
323 "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
324 rectB->
x, rectB->
y, rectB->
w, rectB->
h,
325 refRectB->
x, refRectB->
y, refRectB->
w, refRectB->
h);
References SDL_Rect::h, SDL_TRUE, SDLTest_AssertCheck(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by _validateIntersectRectResults(), rect_testHasIntersectionEmpty(), rect_testHasIntersectionInside(), rect_testHasIntersectionOutside(), rect_testHasIntersectionPartial(), and rect_testHasIntersectionPoint().
◆ _validateIntersectRectAndLineResults()
void _validateIntersectRectAndLineResults |
( |
SDL_bool |
intersection, |
|
|
SDL_bool |
expectedIntersection, |
|
|
SDL_Rect * |
rect, |
|
|
SDL_Rect * |
refRect, |
|
|
int |
x1, |
|
|
int |
y1, |
|
|
int |
x2, |
|
|
int |
y2, |
|
|
int |
x1Ref, |
|
|
int |
y1Ref, |
|
|
int |
x2Ref, |
|
|
int |
y2Ref |
|
) |
| |
Original code: automated SDL rect test written by Edgar Simo "bobbens" New/updated tests: aschiffler at ferzkopp dot net
Definition at line 18 of file testautomation_rect.c.
25 "Check for correct intersection result: expected %s, got %s intersecting rect (%d,%d,%d,%d) with line (%d,%d - %d,%d)",
26 (expectedIntersection ==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
27 (intersection ==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
28 refRect->
x, refRect->
y, refRect->
w, refRect->
h,
29 x1Ref, y1Ref, x2Ref, y2Ref);
31 "Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
33 refRect->
x, refRect->
y, refRect->
w, refRect->
h);
35 "Check if line was incorrectly clipped or modified: got (%d,%d - %d,%d) expected (%d,%d - %d,%d)",
37 x1Ref, y1Ref, x2Ref, y2Ref);
References SDL_Rect::h, rect, SDL_TRUE, SDLTest_AssertCheck(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by rect_testIntersectRectAndLine(), rect_testIntersectRectAndLineEmpty(), rect_testIntersectRectAndLineInside(), and rect_testIntersectRectAndLineOutside().
◆ _validateIntersectRectResults()
Definition at line 331 of file testautomation_rect.c.
337 if (
result && expectedResult) {
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)",
340 rectA->
x, rectA->
y, rectA->
w, rectA->
h,
341 rectB->
x, rectB->
y, rectB->
w, rectB->
h,
343 expectedResult->
x, expectedResult->
y, expectedResult->
w, expectedResult->
h);
References _validateHasIntersectionResults(), SDL_Rect::h, SDLTest_AssertCheck(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by rect_testIntersectRectEmpty(), rect_testIntersectRectInside(), rect_testIntersectRectOutside(), rect_testIntersectRectPartial(), and rect_testIntersectRectPoint().
◆ _validateRectEmptyResults()
Definition at line 373 of file testautomation_rect.c.
378 "Check for correct empty result: expected %s, got %s testing (%d,%d,%d,%d)",
379 (expectedEmpty ==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
380 (empty ==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
383 "Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
385 refRect->
x, refRect->
y, refRect->
w, refRect->
h);
References SDL_Rect::h, rect, SDL_TRUE, SDLTest_AssertCheck(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by rect_testRectEmpty().
◆ _validateRectEqualsResults()
Definition at line 391 of file testautomation_rect.c.
396 "Check for correct equals result: expected %s, got %s testing (%d,%d,%d,%d) and (%d,%d,%d,%d)",
397 (expectedEquals ==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
398 (equals ==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
399 rectA->
x, rectA->
y, rectA->
w, rectA->
h,
400 rectB->
x, rectB->
y, rectB->
w, rectB->
h);
402 "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
403 rectA->
x, rectA->
y, rectA->
w, rectA->
h,
404 refRectA->
x, refRectA->
y, refRectA->
w, refRectA->
h);
406 "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
407 rectB->
x, rectB->
y, rectB->
w, rectB->
h,
408 refRectB->
x, refRectB->
y, refRectB->
w, refRectB->
h);
References SDL_Rect::h, SDL_TRUE, SDLTest_AssertCheck(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by rect_testRectEquals().
◆ _validateUnionRectResults()
Definition at line 350 of file testautomation_rect.c.
355 "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
356 rectA->
x, rectA->
y, rectA->
w, rectA->
h,
357 refRectA->
x, refRectA->
y, refRectA->
w, refRectA->
h);
359 "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
360 rectB->
x, rectB->
y, rectB->
w, rectB->
h,
361 refRectB->
x, refRectB->
y, refRectB->
w, refRectB->
h);
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)",
364 rectA->
x, rectA->
y, rectA->
w, rectA->
h,
365 rectB->
x, rectB->
y, rectB->
w, rectB->
h,
367 expectedResult->
x, expectedResult->
y, expectedResult->
w, expectedResult->
h);
References SDL_Rect::h, SDLTest_AssertCheck(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by rect_testUnionRectEmpty(), rect_testUnionRectInside(), and rect_testUnionRectOutside().
◆ rect_testEnclosePoints()
int rect_testEnclosePoints |
( |
void * |
arg | ) |
|
Definition at line 959 of file testautomation_rect.c.
961 const int numPoints = 16;
969 int minx = 0, maxx = 0, miny = 0, maxy = 0;
973 for (
i=0;
i<numPoints;
i++) {
976 refPoints[
i].
x = newx;
977 refPoints[
i].
y = newy;
986 if (newx < minx) minx = newx;
987 if (newx > maxx) maxx = newx;
988 if (newy < miny) miny = newy;
989 if (newy > maxy) maxy = newy;
996 "Check expected return value %s, got %s",
997 (expectedEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
998 (anyEnclosedNoResult==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE");
999 for (
i=0;
i<numPoints;
i++) {
1001 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1008 "Check return value %s, got %s",
1009 (expectedEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
1010 (anyEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE");
1011 for (
i=0;
i<numPoints;
i++) {
1013 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1017 "Resulting enclosing rectangle incorrect: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
References i, NULL, SDL_EnclosePoints, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Point::x, and SDL_Point::y.
◆ rect_testEnclosePointsParam()
int rect_testEnclosePointsParam |
( |
void * |
arg | ) |
|
◆ rect_testEnclosePointsRepeatedInput()
int rect_testEnclosePointsRepeatedInput |
( |
void * |
arg | ) |
|
Definition at line 1029 of file testautomation_rect.c.
1031 const int numPoints = 8;
1032 const int halfPoints = 4;
1040 int minx = 0, maxx = 0, miny = 0, maxy = 0;
1044 for (
i=0;
i<numPoints;
i++) {
1045 if (
i < halfPoints) {
1049 newx = refPoints[
i-halfPoints].
x;
1050 newy = refPoints[
i-halfPoints].
y;
1052 refPoints[
i].
x = newx;
1053 refPoints[
i].
y = newy;
1062 if (newx < minx) minx = newx;
1063 if (newx > maxx) maxx = newx;
1064 if (newy < miny) miny = newy;
1065 if (newy > maxy) maxy = newy;
1072 "Check return value %s, got %s",
1073 (expectedEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
1074 (anyEnclosedNoResult==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE");
1075 for (
i=0;
i<numPoints;
i++) {
1077 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1084 "Check return value %s, got %s",
1085 (expectedEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
1086 (anyEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE");
1087 for (
i=0;
i<numPoints;
i++) {
1089 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1093 "Check resulting enclosing rectangle: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
References i, NULL, SDL_EnclosePoints, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Point::x, and SDL_Point::y.
◆ rect_testEnclosePointsWithClipping()
int rect_testEnclosePointsWithClipping |
( |
void * |
arg | ) |
|
Definition at line 1105 of file testautomation_rect.c.
1107 const int numPoints = 16;
1117 int minx = 0, maxx = 0, miny = 0, maxy = 0;
1127 for (
i=0;
i<numPoints;
i++) {
1130 refPoints[
i].
x = newx;
1131 refPoints[
i].
y = newy;
1134 if ((newx>=refClip.
x) && (newx<(refClip.
x + refClip.
w)) &&
1135 (newy>=refClip.
y) && (newy<(refClip.
y + refClip.
h))) {
1142 if (newx < minx) minx = newx;
1143 if (newx > maxx) maxx = newx;
1144 if (newy < miny) miny = newy;
1145 if (newy > maxy) maxy = newy;
1155 "Expected return value %s, got %s",
1156 (expectedEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
1157 (anyEnclosedNoResult==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE");
1158 for (
i=0;
i<numPoints;
i++) {
1160 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1164 "Check that source clipping rectangle was not modified");
1169 "Check return value %s, got %s",
1170 (expectedEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
1171 (anyEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE");
1172 for (
i=0;
i<numPoints;
i++) {
1174 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1178 "Check that source clipping rectangle was not modified");
1181 "Check resulting enclosing rectangle: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
1191 "Check return value %s, got %s",
1192 (expectedEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE",
1193 (anyEnclosed==
SDL_TRUE) ?
"SDL_TRUE" :
"SDL_FALSE");
References SDL_Rect::h, i, NULL, SDL_EnclosePoints, SDL_FALSE, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Point::x, SDL_Rect::x, SDL_Point::y, and SDL_Rect::y.
◆ rect_testHasIntersectionEmpty()
int rect_testHasIntersectionEmpty |
( |
void * |
arg | ) |
|
◆ rect_testHasIntersectionInside()
int rect_testHasIntersectionInside |
( |
void * |
arg | ) |
|
Definition at line 711 of file testautomation_rect.c.
713 SDL_Rect refRectA = { 0, 0, 32, 32 };
References _validateHasIntersectionResults(), SDL_Rect::h, SDL_HasIntersection, SDL_TRUE, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testHasIntersectionOutside()
int rect_testHasIntersectionOutside |
( |
void * |
arg | ) |
|
Definition at line 738 of file testautomation_rect.c.
740 SDL_Rect refRectA = { 0, 0, 32, 32 };
749 refRectB.
w = refRectA.
w;
750 refRectB.
h = refRectA.
h;
References _validateHasIntersectionResults(), SDL_Rect::h, SDL_FALSE, SDL_HasIntersection, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testHasIntersectionParam()
int rect_testHasIntersectionParam |
( |
void * |
arg | ) |
|
◆ rect_testHasIntersectionPartial()
int rect_testHasIntersectionPartial |
( |
void * |
arg | ) |
|
Definition at line 765 of file testautomation_rect.c.
767 SDL_Rect refRectA = { 0, 0, 32, 32 };
776 refRectB.
w = refRectA.
w;
777 refRectB.
h = refRectA.
h;
784 refRectB.
x = rectA.
w - 1;
785 refRectB.
y = rectA.
y;
794 refRectB.
x = 1 - rectA.
w;
795 refRectB.
y = rectA.
y;
796 refRectB.
w = refRectA.
w;
804 refRectB.
x = rectA.
x;
805 refRectB.
y = rectA.
h - 1;
814 refRectB.
x = rectA.
x;
815 refRectB.
y = 1 - rectA.
h;
817 refRectB.
h = rectA.
h;
References _validateHasIntersectionResults(), SDL_Rect::h, SDL_HasIntersection, SDL_TRUE, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testHasIntersectionPoint()
int rect_testHasIntersectionPoint |
( |
void * |
arg | ) |
|
◆ rect_testIntersectRectAndLine()
int rect_testIntersectRectAndLine |
( |
void * |
arg | ) |
|
Definition at line 49 of file testautomation_rect.c.
68 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, 0, 15, 31, 15);
76 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, 15, 0, 15, 31);
84 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, 0, 0, 31, 31);
92 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, 31, 31, 0, 0);
100 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, 0, 31, 31, 0);
108 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, 31, 0, 0, 31);
References _validateIntersectRectAndLineResults(), SDL_Rect::h, rect, SDL_IntersectRectAndLine, SDL_TRUE, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, and SDL_Rect::w.
◆ rect_testIntersectRectAndLineEmpty()
int rect_testIntersectRectAndLineEmpty |
( |
void * |
arg | ) |
|
Definition at line 242 of file testautomation_rect.c.
246 int x1,
y1, x1Ref, y1Ref;
247 int x2,
y2, x2Ref, y2Ref;
265 _validateIntersectRectAndLineResults(intersected,
SDL_FALSE, &
rect, &refRect,
x1,
y1,
x2,
y2, x1Ref, y1Ref, x2Ref, y2Ref);
References _validateIntersectRectAndLineResults(), SDL_Rect::h, rect, SDL_FALSE, SDL_IntersectRectAndLine, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testIntersectRectAndLineInside()
int rect_testIntersectRectAndLineInside |
( |
void * |
arg | ) |
|
Definition at line 120 of file testautomation_rect.c.
122 SDL_Rect refRect = { 0, 0, 32, 32 };
128 int xmin = refRect.
x;
129 int xmax = refRect.
x + refRect.
w - 1;
130 int ymin = refRect.
y;
131 int ymax = refRect.
y + refRect.
h - 1;
143 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, x1Ref, y1Ref, x2Ref, y2Ref);
151 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, x1Ref, y1Ref, xmax, ymax);
159 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, xmin, ymin, x2Ref, y2Ref);
167 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, xmin, ymin, xmax, ymax);
175 _validateIntersectRectAndLineResults(intersected,
SDL_TRUE, &
rect, &refRect,
x1,
y1,
x2,
y2, xmin, ymax, xmax, ymin);
References _validateIntersectRectAndLineResults(), SDL_Rect::h, rect, SDL_IntersectRectAndLine, SDL_TRUE, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testIntersectRectAndLineOutside()
int rect_testIntersectRectAndLineOutside |
( |
void * |
arg | ) |
|
Definition at line 187 of file testautomation_rect.c.
189 SDL_Rect refRect = { 0, 0, 32, 32 };
206 _validateIntersectRectAndLineResults(intersected,
SDL_FALSE, &
rect, &refRect,
x1,
y1,
x2,
y2, xLeft, 0, xLeft, 31);
214 _validateIntersectRectAndLineResults(intersected,
SDL_FALSE, &
rect, &refRect,
x1,
y1,
x2,
y2, xRight, 0, xRight, 31);
222 _validateIntersectRectAndLineResults(intersected,
SDL_FALSE, &
rect, &refRect,
x1,
y1,
x2,
y2, 0, yTop, 31, yTop);
230 _validateIntersectRectAndLineResults(intersected,
SDL_FALSE, &
rect, &refRect,
x1,
y1,
x2,
y2, 0, yBottom, 31, yBottom);
References _validateIntersectRectAndLineResults(), SDL_Rect::h, rect, SDL_FALSE, SDL_IntersectRectAndLine, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, and SDL_Rect::w.
◆ rect_testIntersectRectAndLineParam()
int rect_testIntersectRectAndLineParam |
( |
void * |
arg | ) |
|
◆ rect_testIntersectRectEmpty()
int rect_testIntersectRectEmpty |
( |
void * |
arg | ) |
|
Definition at line 609 of file testautomation_rect.c.
References _validateIntersectRectResults(), SDL_Rect::h, NULL, SDL_FALSE, SDL_IntersectRect, SDL_RectEmpty(), SDL_TRUE, SDLTest_AssertCheck(), SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testIntersectRectInside()
int rect_testIntersectRectInside |
( |
void * |
arg | ) |
|
Definition at line 417 of file testautomation_rect.c.
419 SDL_Rect refRectA = { 0, 0, 32, 32 };
References _validateIntersectRectResults(), SDL_Rect::h, SDL_IntersectRect, SDL_TRUE, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testIntersectRectOutside()
int rect_testIntersectRectOutside |
( |
void * |
arg | ) |
|
Definition at line 445 of file testautomation_rect.c.
447 SDL_Rect refRectA = { 0, 0, 32, 32 };
457 refRectB.
w = refRectA.
w;
458 refRectB.
h = refRectA.
h;
References _validateIntersectRectResults(), SDL_Rect::h, NULL, SDL_FALSE, SDL_IntersectRect, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testIntersectRectParam()
int rect_testIntersectRectParam |
( |
void * |
arg | ) |
|
◆ rect_testIntersectRectPartial()
int rect_testIntersectRectPartial |
( |
void * |
arg | ) |
|
Definition at line 473 of file testautomation_rect.c.
475 SDL_Rect refRectA = { 0, 0, 32, 32 };
486 refRectB.
w = refRectA.
w;
487 refRectB.
h = refRectA.
h;
490 expectedResult.
x = refRectB.
x;
491 expectedResult.
y = refRectB.
y;
492 expectedResult.
w = refRectA.
w - refRectB.
x;
493 expectedResult.
h = refRectA.
h - refRectB.
y;
498 refRectB.
x = rectA.
w - 1;
499 refRectB.
y = rectA.
y;
504 expectedResult.
x = refRectB.
x;
505 expectedResult.
y = refRectB.
y;
506 expectedResult.
w = 1;
507 expectedResult.
h = refRectB.
h;
512 refRectB.
x = 1 - rectA.
w;
513 refRectB.
y = rectA.
y;
514 refRectB.
w = refRectA.
w;
518 expectedResult.
x = 0;
519 expectedResult.
y = refRectB.
y;
520 expectedResult.
w = 1;
521 expectedResult.
h = refRectB.
h;
526 refRectB.
x = rectA.
x;
527 refRectB.
y = rectA.
h - 1;
532 expectedResult.
x = refRectB.
x;
533 expectedResult.
y = refRectB.
y;
534 expectedResult.
w = refRectB.
w;
535 expectedResult.
h = 1;
540 refRectB.
x = rectA.
x;
541 refRectB.
y = 1 - rectA.
h;
543 refRectB.
h = rectA.
h;
546 expectedResult.
x = refRectB.
x;
547 expectedResult.
y = 0;
548 expectedResult.
w = refRectB.
w;
549 expectedResult.
h = 1;
References _validateIntersectRectResults(), SDL_Rect::h, SDL_IntersectRect, SDL_TRUE, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testIntersectRectPoint()
int rect_testIntersectRectPoint |
( |
void * |
arg | ) |
|
◆ rect_testRectEmpty()
int rect_testRectEmpty |
( |
void * |
arg | ) |
|
Definition at line 1460 of file testautomation_rect.c.
1479 for (
w=-1;
w<2;
w++) {
1480 for (
h=-1;
h<2;
h++) {
1481 if ((
w != 1) || (
h != 1)) {
References _validateRectEmptyResults(), SDL_Rect::h, rect, SDL_FALSE, SDL_RectEmpty(), SDL_TRUE, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testRectEmptyParam()
int rect_testRectEmptyParam |
( |
void * |
arg | ) |
|
◆ rect_testRectEquals()
int rect_testRectEquals |
( |
void * |
arg | ) |
|
◆ rect_testRectEqualsParam()
int rect_testRectEqualsParam |
( |
void * |
arg | ) |
|
◆ rect_testUnionRectEmpty()
int rect_testUnionRectEmpty |
( |
void * |
arg | ) |
|
◆ rect_testUnionRectInside()
int rect_testUnionRectInside |
( |
void * |
arg | ) |
|
◆ rect_testUnionRectOutside()
int rect_testUnionRectOutside |
( |
void * |
arg | ) |
|
Definition at line 1232 of file testautomation_rect.c.
1238 int minx, maxx, miny, maxy;
1242 for (dx = -1; dx < 2; dx++) {
1243 for (dy = -1; dy < 2; dy++) {
1244 if ((dx != 0) || (dy != 0)) {
1253 minx = (refRectA.
x<refRectB.
x) ? refRectA.
x : refRectB.
x;
1254 maxx = (refRectA.
x>refRectB.
x) ? refRectA.
x : refRectB.
x;
1255 miny = (refRectA.
y<refRectB.
y) ? refRectA.
y : refRectB.
y;
1256 maxy = (refRectA.
y>refRectB.
y) ? refRectA.
y : refRectB.
y;
1257 expectedResult.
x = minx;
1258 expectedResult.
y = miny;
1259 expectedResult.
w = maxx - minx + 1;
1260 expectedResult.
h = maxy - miny + 1;
1270 for (dx = -1; dx < 2; dx++) {
1271 for (dy = -1; dy < 2; dy++) {
1272 if ((dx != 0) || (dy != 0)) {
1277 refRectB.
x=refRectA.
x + 1 + dx*2;
1278 refRectB.
y=refRectA.
y + 1 + dy*2;
1279 refRectB.
w=refRectA.
w - 2;
1280 refRectB.
h=refRectA.
h - 2;
1281 expectedResult = refRectA;
1282 if (dx == -1) expectedResult.
x--;
1283 if (dy == -1) expectedResult.
y--;
1284 if ((dx == 1) || (dx == -1)) expectedResult.
w++;
1285 if ((dy == 1) || (dy == -1)) expectedResult.
h++;
References _validateUnionRectResults(), SDL_Rect::h, SDL_UnionRect, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ rect_testUnionRectParam()
int rect_testUnionRectParam |
( |
void * |
arg | ) |
|
◆ rectTest1
◆ rectTest10
◆ rectTest11
◆ rectTest12
◆ rectTest13
◆ rectTest14
◆ rectTest15
◆ rectTest16
◆ rectTest17
◆ rectTest18
◆ rectTest19
◆ rectTest2
◆ rectTest20
◆ rectTest21
◆ rectTest22
◆ rectTest23
◆ rectTest24
◆ rectTest25
◆ rectTest26
◆ rectTest27
◆ rectTest28
◆ rectTest29
◆ rectTest3
◆ rectTest4
◆ rectTest5
◆ rectTest6
◆ rectTest7
◆ rectTest8
◆ rectTest9
◆ rectTests
Initial value:= {
&
rectTest1, &
rectTest2, &
rectTest3, &
rectTest4, &
rectTest5, &
rectTest6, &
rectTest7, &
rectTest8, &
rectTest9, &
rectTest10, &
rectTest11, &
rectTest12, &
rectTest13, &
rectTest14,
&
rectTest15, &
rectTest16, &
rectTest17, &
rectTest18, &
rectTest19, &
rectTest20, &
rectTest21, &
rectTest22, &
rectTest23, &
rectTest24, &
rectTest25, &
rectTest26, &
rectTest27,
}
Definition at line 1683 of file testautomation_rect.c.
◆ rectTestSuite
GLfixed GLfixed GLint GLint GLfixed points
static const SDLTest_TestCaseReference rectTest11
int rect_testIntersectRectPoint(void *arg)
int rect_testRectEqualsParam(void *arg)
static const SDLTest_TestCaseReference rectTest23
int rect_testHasIntersectionParam(void *arg)
#define SDL_HasIntersection
int rect_testIntersectRectAndLine(void *arg)
static const SDLTest_TestCaseReference rectTest7
int rect_testHasIntersectionPoint(void *arg)
int rect_testHasIntersectionPartial(void *arg)
static const SDLTest_TestCaseReference rectTest17
int rect_testRectEquals(void *arg)
void _validateIntersectRectAndLineResults(SDL_bool intersection, SDL_bool expectedIntersection, SDL_Rect *rect, SDL_Rect *refRect, int x1, int y1, int x2, int y2, int x1Ref, int y1Ref, int x2Ref, int y2Ref)
GLuint GLuint GLsizei count
static const SDLTest_TestCaseReference rectTest2
void _validateHasIntersectionResults(SDL_bool intersection, SDL_bool expectedIntersection, SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)
int rect_testIntersectRectAndLineParam(void *arg)
int rect_testIntersectRectInside(void *arg)
static const SDLTest_TestCaseReference rectTest28
#define SDL_IntersectRect
static const SDLTest_TestCaseReference rectTest10
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
Returns true if the rectangle has no area.
static const SDLTest_TestCaseReference rectTest5
int rect_testIntersectRectParam(void *arg)
static const SDLTest_TestCaseReference rectTest27
int rect_testUnionRectParam(void *arg)
GLuint GLfloat GLfloat GLfloat x1
int rect_testEnclosePointsWithClipping(void *arg)
void _validateRectEmptyResults(SDL_bool empty, SDL_bool expectedEmpty, SDL_Rect *rect, SDL_Rect *refRect)
static const SDLTest_TestCaseReference rectTest3
GLfloat GLfloat GLfloat GLfloat h
static const SDLTest_TestCaseReference rectTest14
int rect_testIntersectRectPartial(void *arg)
int rect_testUnionRectOutside(void *arg)
int rect_testIntersectRectAndLineEmpty(void *arg)
static const SDLTest_TestCaseReference * rectTests[]
static const SDLTest_TestCaseReference rectTest21
int rect_testIntersectRectEmpty(void *arg)
int rect_testEnclosePoints(void *arg)
GLint GLint GLint GLint GLint x
static const SDLTest_TestCaseReference rectTest18
static const SDLTest_TestCaseReference rectTest4
int(* SDLTest_TestCaseFp)(void *arg)
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
Explicitly pass without checking an assertion condition. Updates assertion counter.
static const SDLTest_TestCaseReference rectTest20
static const SDLTest_TestCaseReference rectTest22
static const SDLTest_TestCaseReference rectTest15
int rect_testEnclosePointsParam(void *arg)
static const SDLTest_TestCaseReference rectTest29
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
Assert for test cases that logs but does not break execution flow on failures. Updates assertion coun...
int rect_testIntersectRectOutside(void *arg)
void _validateUnionRectResults(SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, SDL_Rect *result, SDL_Rect *expectedResult)
static const SDLTest_TestCaseReference rectTest19
static const SDLTest_TestCaseReference rectTest12
int rect_testIntersectRectAndLineOutside(void *arg)
int rect_testEnclosePointsRepeatedInput(void *arg)
int rect_testUnionRectInside(void *arg)
GLint GLint GLint GLint GLint GLint y
int rect_testHasIntersectionOutside(void *arg)
static const SDLTest_TestCaseReference rectTest8
int rect_testIntersectRectAndLineInside(void *arg)
static const SDLTest_TestCaseReference rectTest1
The structure that defines a point.
int rect_testUnionRectEmpty(void *arg)
static const SDLTest_TestCaseReference rectTest13
SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
Returns true if the two rectangles are equal.
int rect_testRectEmpty(void *arg)
A rectangle, with the origin at the upper left.
void _validateRectEqualsResults(SDL_bool equals, SDL_bool expectedEquals, SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)
static const SDLTest_TestCaseReference rectTest16
int rect_testHasIntersectionInside(void *arg)
GLfixed GLfixed GLfixed y2
static const SDLTest_TestCaseReference rectTest24
#define SDL_EnclosePoints
#define SDL_IntersectRectAndLine
int rect_testRectEmptyParam(void *arg)
static const SDLTest_TestCaseReference rectTest26
static const SDLTest_TestCaseReference rectTest25
void _validateIntersectRectResults(SDL_bool intersection, SDL_bool expectedIntersection, SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, SDL_Rect *result, SDL_Rect *expectedResult)
static const SDLTest_TestCaseReference rectTest6
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
static const SDLTest_TestCaseReference rectTest9
int rect_testHasIntersectionEmpty(void *arg)
GLubyte GLubyte GLubyte GLubyte w
Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max)