SDL 2.0
testautomation_rect.c File Reference
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
+ Include dependency graph for testautomation_rect.c:

Go to the source code of this file.

Functions

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)
 

Variables

static const SDLTest_TestCaseReference rectTest1
 
static const SDLTest_TestCaseReference rectTest2
 
static const SDLTest_TestCaseReference rectTest3
 
static const SDLTest_TestCaseReference rectTest4
 
static const SDLTest_TestCaseReference rectTest5
 
static const SDLTest_TestCaseReference rectTest6
 
static const SDLTest_TestCaseReference rectTest7
 
static const SDLTest_TestCaseReference rectTest8
 
static const SDLTest_TestCaseReference rectTest9
 
static const SDLTest_TestCaseReference rectTest10
 
static const SDLTest_TestCaseReference rectTest11
 
static const SDLTest_TestCaseReference rectTest12
 
static const SDLTest_TestCaseReference rectTest13
 
static const SDLTest_TestCaseReference rectTest14
 
static const SDLTest_TestCaseReference rectTest15
 
static const SDLTest_TestCaseReference rectTest16
 
static const SDLTest_TestCaseReference rectTest17
 
static const SDLTest_TestCaseReference rectTest18
 
static const SDLTest_TestCaseReference rectTest19
 
static const SDLTest_TestCaseReference rectTest20
 
static const SDLTest_TestCaseReference rectTest21
 
static const SDLTest_TestCaseReference rectTest22
 
static const SDLTest_TestCaseReference rectTest23
 
static const SDLTest_TestCaseReference rectTest24
 
static const SDLTest_TestCaseReference rectTest25
 
static const SDLTest_TestCaseReference rectTest26
 
static const SDLTest_TestCaseReference rectTest27
 
static const SDLTest_TestCaseReference rectTest28
 
static const SDLTest_TestCaseReference rectTest29
 
static const SDLTest_TestCaseReferencerectTests []
 
SDLTest_TestSuiteReference rectTestSuite
 

Function Documentation

◆ _validateHasIntersectionResults()

void _validateHasIntersectionResults ( SDL_bool  intersection,
SDL_bool  expectedIntersection,
SDL_Rect rectA,
SDL_Rect rectB,
SDL_Rect refRectA,
SDL_Rect refRectB 
)

Definition at line 308 of file testautomation_rect.c.

311{
312 SDLTest_AssertCheck(intersection == expectedIntersection,
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);
318 SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->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);
322 SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->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);
326}
@ SDL_TRUE
Definition: SDL_stdinc.h:164
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 h
Definition: SDL_rect.h:80
int w
Definition: SDL_rect.h:80
int y
Definition: SDL_rect.h:79
int x
Definition: SDL_rect.h:79

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.

23{
24 SDLTest_AssertCheck(intersection == expectedIntersection,
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);
30 SDLTest_AssertCheck(rect->x == refRect->x && rect->y == refRect->y && rect->w == refRect->w && rect->h == refRect->h,
31 "Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
32 rect->x, rect->y, rect->w, rect->h,
33 refRect->x, refRect->y, refRect->w, refRect->h);
34 SDLTest_AssertCheck(x1 == x1Ref && y1 == y1Ref && x2 == x2Ref && y2 == y2Ref,
35 "Check if line was incorrectly clipped or modified: got (%d,%d - %d,%d) expected (%d,%d - %d,%d)",
36 x1, y1, x2, y2,
37 x1Ref, y1Ref, x2Ref, y2Ref);
38}
GLfixed GLfixed GLfixed y2
GLfixed y1
GLuint GLfloat GLfloat GLfloat x1
GLfixed GLfixed x2
SDL_Rect rect
Definition: testrelative.c:27

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()

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 
)

Definition at line 331 of file testautomation_rect.c.

335{
336 _validateHasIntersectionResults(intersection, expectedIntersection, rectA, rectB, refRectA, refRectB);
337 if (result && expectedResult) {
338 SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->h,
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,
342 result->x, result->y, result->w, result->h,
343 expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
344 }
345}
GLuint64EXT * result
void _validateHasIntersectionResults(SDL_bool intersection, SDL_bool expectedIntersection, SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)

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()

void _validateRectEmptyResults ( SDL_bool  empty,
SDL_bool  expectedEmpty,
SDL_Rect rect,
SDL_Rect refRect 
)

Definition at line 373 of file testautomation_rect.c.

376{
377 SDLTest_AssertCheck(empty == expectedEmpty,
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",
381 rect->x, rect->y, rect->w, rect->h);
382 SDLTest_AssertCheck(rect->x == refRect->x && rect->y == refRect->y && rect->w == refRect->w && rect->h == refRect->h,
383 "Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
384 rect->x, rect->y, rect->w, rect->h,
385 refRect->x, refRect->y, refRect->w, refRect->h);
386}

References SDL_Rect::h, rect, SDL_TRUE, SDLTest_AssertCheck(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by rect_testRectEmpty().

◆ _validateRectEqualsResults()

void _validateRectEqualsResults ( SDL_bool  equals,
SDL_bool  expectedEquals,
SDL_Rect rectA,
SDL_Rect rectB,
SDL_Rect refRectA,
SDL_Rect refRectB 
)

Definition at line 391 of file testautomation_rect.c.

394{
395 SDLTest_AssertCheck(equals == expectedEquals,
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);
401 SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->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);
405 SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->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);
409}

References SDL_Rect::h, SDL_TRUE, SDLTest_AssertCheck(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by rect_testRectEquals().

◆ _validateUnionRectResults()

void _validateUnionRectResults ( SDL_Rect rectA,
SDL_Rect rectB,
SDL_Rect refRectA,
SDL_Rect refRectB,
SDL_Rect result,
SDL_Rect expectedResult 
)

Definition at line 350 of file testautomation_rect.c.

353{
354 SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
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);
358 SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->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);
362 SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->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,
366 result->x, result->y, result->w, result->h,
367 expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
368}

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.

960{
961 const int numPoints = 16;
962 SDL_Point refPoints[16];
963 SDL_Point points[16];
965 SDL_bool anyEnclosed;
966 SDL_bool anyEnclosedNoResult;
967 SDL_bool expectedEnclosed = SDL_TRUE;
968 int newx, newy;
969 int minx = 0, maxx = 0, miny = 0, maxy = 0;
970 int i;
971
972 /* Create input data, tracking result */
973 for (i=0; i<numPoints; i++) {
974 newx = SDLTest_RandomIntegerInRange(-1024, 1024);
975 newy = SDLTest_RandomIntegerInRange(-1024, 1024);
976 refPoints[i].x = newx;
977 refPoints[i].y = newy;
978 points[i].x = newx;
979 points[i].y = newy;
980 if (i==0) {
981 minx = newx;
982 maxx = newx;
983 miny = newy;
984 maxy = newy;
985 } else {
986 if (newx < minx) minx = newx;
987 if (newx > maxx) maxx = newx;
988 if (newy < miny) miny = newy;
989 if (newy > maxy) maxy = newy;
990 }
991 }
992
993 /* Call function and validate - special case: no result requested */
994 anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
995 SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
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++) {
1000 SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
1001 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1002 i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
1003 }
1004
1005 /* Call function and validate */
1006 anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
1007 SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
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++) {
1012 SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
1013 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1014 i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
1015 }
1016 SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
1017 "Resulting enclosing rectangle incorrect: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
1018 minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
1019
1020 return TEST_COMPLETED;
1021}
#define SDL_EnclosePoints
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
GLfixed GLfixed GLint GLint GLfixed points
SDL_bool
Definition: SDL_stdinc.h:162
Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max)
#define TEST_COMPLETED
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)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:167
The structure that defines a point (integer)
Definition: SDL_rect.h:49
int x
Definition: SDL_rect.h:50
int y
Definition: SDL_rect.h:51
A rectangle, with the origin at the upper left (integer).
Definition: SDL_rect.h:78

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)

Definition at line 1204 of file testautomation_rect.c.

1205{
1206 SDL_Point points[1];
1207 int count;
1208 SDL_Rect clip;
1210 SDL_bool anyEnclosed;
1211
1212 /* invalid parameter combinations */
1213 anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 1, (const SDL_Rect *)&clip, &result);
1214 SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL");
1215 anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, 0, (const SDL_Rect *)&clip, &result);
1216 SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 2nd parameter is 0");
1218 anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, count, (const SDL_Rect *)&clip, &result);
1219 SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 2nd parameter is %i (negative)", count);
1220 anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 0, (const SDL_Rect *)&clip, &result);
1221 SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL and 2nd parameter was 0");
1222
1223 return TEST_COMPLETED;
1224}
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
@ SDL_FALSE
Definition: SDL_stdinc.h:163

References NULL, SDL_EnclosePoints, SDL_FALSE, SDLTest_AssertCheck(), SDLTest_RandomIntegerInRange(), and TEST_COMPLETED.

◆ rect_testEnclosePointsRepeatedInput()

int rect_testEnclosePointsRepeatedInput ( void arg)

Definition at line 1029 of file testautomation_rect.c.

1030{
1031 const int numPoints = 8;
1032 const int halfPoints = 4;
1033 SDL_Point refPoints[8];
1034 SDL_Point points[8];
1036 SDL_bool anyEnclosed;
1037 SDL_bool anyEnclosedNoResult;
1038 SDL_bool expectedEnclosed = SDL_TRUE;
1039 int newx, newy;
1040 int minx = 0, maxx = 0, miny = 0, maxy = 0;
1041 int i;
1042
1043 /* Create input data, tracking result */
1044 for (i=0; i<numPoints; i++) {
1045 if (i < halfPoints) {
1046 newx = SDLTest_RandomIntegerInRange(-1024, 1024);
1047 newy = SDLTest_RandomIntegerInRange(-1024, 1024);
1048 } else {
1049 newx = refPoints[i-halfPoints].x;
1050 newy = refPoints[i-halfPoints].y;
1051 }
1052 refPoints[i].x = newx;
1053 refPoints[i].y = newy;
1054 points[i].x = newx;
1055 points[i].y = newy;
1056 if (i==0) {
1057 minx = newx;
1058 maxx = newx;
1059 miny = newy;
1060 maxy = newy;
1061 } else {
1062 if (newx < minx) minx = newx;
1063 if (newx > maxx) maxx = newx;
1064 if (newy < miny) miny = newy;
1065 if (newy > maxy) maxy = newy;
1066 }
1067 }
1068
1069 /* Call function and validate - special case: no result requested */
1070 anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
1071 SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
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++) {
1076 SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
1077 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1078 i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
1079 }
1080
1081 /* Call function and validate */
1082 anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
1083 SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
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++) {
1088 SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
1089 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1090 i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
1091 }
1092 SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
1093 "Check resulting enclosing rectangle: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
1094 minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
1095
1096 return TEST_COMPLETED;
1097}

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.

1106{
1107 const int numPoints = 16;
1108 SDL_Point refPoints[16];
1109 SDL_Point points[16];
1110 SDL_Rect refClip;
1111 SDL_Rect clip;
1113 SDL_bool anyEnclosed;
1114 SDL_bool anyEnclosedNoResult;
1115 SDL_bool expectedEnclosed = SDL_FALSE;
1116 int newx, newy;
1117 int minx = 0, maxx = 0, miny = 0, maxy = 0;
1118 int i;
1119
1120 /* Setup clipping rectangle */
1121 refClip.x = SDLTest_RandomIntegerInRange(-1024, 1024);
1122 refClip.y = SDLTest_RandomIntegerInRange(-1024, 1024);
1123 refClip.w = SDLTest_RandomIntegerInRange(1, 1024);
1124 refClip.h = SDLTest_RandomIntegerInRange(1, 1024);
1125
1126 /* Create input data, tracking result */
1127 for (i=0; i<numPoints; i++) {
1128 newx = SDLTest_RandomIntegerInRange(-1024, 1024);
1129 newy = SDLTest_RandomIntegerInRange(-1024, 1024);
1130 refPoints[i].x = newx;
1131 refPoints[i].y = newy;
1132 points[i].x = newx;
1133 points[i].y = newy;
1134 if ((newx>=refClip.x) && (newx<(refClip.x + refClip.w)) &&
1135 (newy>=refClip.y) && (newy<(refClip.y + refClip.h))) {
1136 if (expectedEnclosed==SDL_FALSE) {
1137 minx = newx;
1138 maxx = newx;
1139 miny = newy;
1140 maxy = newy;
1141 } else {
1142 if (newx < minx) minx = newx;
1143 if (newx > maxx) maxx = newx;
1144 if (newy < miny) miny = newy;
1145 if (newy > maxy) maxy = newy;
1146 }
1147 expectedEnclosed = SDL_TRUE;
1148 }
1149 }
1150
1151 /* Call function and validate - special case: no result requested */
1152 clip = refClip;
1153 anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, (SDL_Rect *)NULL);
1154 SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
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++) {
1159 SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
1160 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1161 i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
1162 }
1163 SDLTest_AssertCheck(refClip.x==clip.x && refClip.y==clip.y && refClip.w==clip.w && refClip.h==clip.h,
1164 "Check that source clipping rectangle was not modified");
1165
1166 /* Call function and validate */
1167 anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result);
1168 SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
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++) {
1173 SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
1174 "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)",
1175 i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
1176 }
1177 SDLTest_AssertCheck(refClip.x==clip.x && refClip.y==clip.y && refClip.w==clip.w && refClip.h==clip.h,
1178 "Check that source clipping rectangle was not modified");
1179 if (expectedEnclosed==SDL_TRUE) {
1180 SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
1181 "Check resulting enclosing rectangle: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
1182 minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
1183 }
1184
1185 /* Empty clipping rectangle */
1186 clip.w = 0;
1187 clip.h = 0;
1188 expectedEnclosed = SDL_FALSE;
1189 anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result);
1190 SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
1191 "Check return value %s, got %s",
1192 (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
1193 (anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
1194
1195 return TEST_COMPLETED;
1196}

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)

Definition at line 878 of file testautomation_rect.c.

879{
880 SDL_Rect refRectA;
881 SDL_Rect refRectB;
882 SDL_Rect rectA;
883 SDL_Rect rectB;
884 SDL_bool intersection;
885
886 /* Rect A empty */
887 refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
888 refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
889 refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
890 refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
891 refRectB = refRectA;
892 refRectA.w = 0;
893 refRectA.h = 0;
894 rectA = refRectA;
895 rectB = refRectB;
896 intersection = SDL_HasIntersection(&rectA, &rectB);
897 _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
898
899 /* Rect B empty */
900 refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
901 refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
902 refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
903 refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
904 refRectB = refRectA;
905 refRectB.w = 0;
906 refRectB.h = 0;
907 rectA = refRectA;
908 rectB = refRectB;
909 intersection = SDL_HasIntersection(&rectA, &rectB);
910 _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
911
912 /* Rect A and B empty */
913 refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
914 refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
915 refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
916 refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
917 refRectB = refRectA;
918 refRectA.w = 0;
919 refRectA.h = 0;
920 refRectB.w = 0;
921 refRectB.h = 0;
922 rectA = refRectA;
923 rectB = refRectB;
924 intersection = SDL_HasIntersection(&rectA, &rectB);
925 _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
926
927 return TEST_COMPLETED;
928}
#define SDL_HasIntersection

References _validateHasIntersectionResults(), SDL_Rect::h, SDL_FALSE, SDL_HasIntersection, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

◆ rect_testHasIntersectionInside()

int rect_testHasIntersectionInside ( void arg)

Definition at line 711 of file testautomation_rect.c.

712{
713 SDL_Rect refRectA = { 0, 0, 32, 32 };
714 SDL_Rect refRectB;
715 SDL_Rect rectA;
716 SDL_Rect rectB;
717 SDL_bool intersection;
718
719 /* rectB fully contained in rectA */
720 refRectB.x = 0;
721 refRectB.y = 0;
722 refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
723 refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
724 rectA = refRectA;
725 rectB = refRectB;
726 intersection = SDL_HasIntersection(&rectA, &rectB);
727 _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
728
729 return TEST_COMPLETED;
730}

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.

739{
740 SDL_Rect refRectA = { 0, 0, 32, 32 };
741 SDL_Rect refRectB;
742 SDL_Rect rectA;
743 SDL_Rect rectB;
744 SDL_bool intersection;
745
746 /* rectB fully outside of rectA */
747 refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
748 refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
749 refRectB.w = refRectA.w;
750 refRectB.h = refRectA.h;
751 rectA = refRectA;
752 rectB = refRectB;
753 intersection = SDL_HasIntersection(&rectA, &rectB);
754 _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
755
756 return TEST_COMPLETED;
757}

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)

Definition at line 936 of file testautomation_rect.c.

937{
938 SDL_Rect rectA;
939 SDL_Rect rectB;
940 SDL_bool intersection;
941
942 /* invalid parameter combinations */
943 intersection = SDL_HasIntersection((SDL_Rect *)NULL, &rectB);
944 SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
945 intersection = SDL_HasIntersection(&rectA, (SDL_Rect *)NULL);
946 SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL");
947 intersection = SDL_HasIntersection((SDL_Rect *)NULL, (SDL_Rect *)NULL);
948 SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
949
950 return TEST_COMPLETED;
951}

References NULL, SDL_FALSE, SDL_HasIntersection, SDLTest_AssertCheck(), and TEST_COMPLETED.

◆ rect_testHasIntersectionPartial()

int rect_testHasIntersectionPartial ( void arg)

Definition at line 765 of file testautomation_rect.c.

766{
767 SDL_Rect refRectA = { 0, 0, 32, 32 };
768 SDL_Rect refRectB;
769 SDL_Rect rectA;
770 SDL_Rect rectB;
771 SDL_bool intersection;
772
773 /* rectB partially contained in rectA */
774 refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
775 refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
776 refRectB.w = refRectA.w;
777 refRectB.h = refRectA.h;
778 rectA = refRectA;
779 rectB = refRectB;
780 intersection = SDL_HasIntersection(&rectA, &rectB);
781 _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
782
783 /* rectB right edge */
784 refRectB.x = rectA.w - 1;
785 refRectB.y = rectA.y;
786 refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
787 refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
788 rectA = refRectA;
789 rectB = refRectB;
790 intersection = SDL_HasIntersection(&rectA, &rectB);
791 _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
792
793 /* rectB left edge */
794 refRectB.x = 1 - rectA.w;
795 refRectB.y = rectA.y;
796 refRectB.w = refRectA.w;
797 refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
798 rectA = refRectA;
799 rectB = refRectB;
800 intersection = SDL_HasIntersection(&rectA, &rectB);
801 _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
802
803 /* rectB bottom edge */
804 refRectB.x = rectA.x;
805 refRectB.y = rectA.h - 1;
806 refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
807 refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
808 rectA = refRectA;
809 rectB = refRectB;
810 intersection = SDL_HasIntersection(&rectA, &rectB);
811 _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
812
813 /* rectB top edge */
814 refRectB.x = rectA.x;
815 refRectB.y = 1 - rectA.h;
816 refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
817 refRectB.h = rectA.h;
818 rectA = refRectA;
819 rectB = refRectB;
820 intersection = SDL_HasIntersection(&rectA, &rectB);
821 _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
822
823 return TEST_COMPLETED;
824}

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)

Definition at line 832 of file testautomation_rect.c.

833{
834 SDL_Rect refRectA = { 0, 0, 1, 1 };
835 SDL_Rect refRectB = { 0, 0, 1, 1 };
836 SDL_Rect rectA;
837 SDL_Rect rectB;
838 SDL_bool intersection;
839 int offsetX, offsetY;
840
841 /* intersecting pixels */
842 refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
843 refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
844 refRectB.x = refRectA.x;
845 refRectB.y = refRectA.y;
846 rectA = refRectA;
847 rectB = refRectB;
848 intersection = SDL_HasIntersection(&rectA, &rectB);
849 _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
850
851 /* non-intersecting pixels cases */
852 for (offsetX = -1; offsetX <= 1; offsetX++) {
853 for (offsetY = -1; offsetY <= 1; offsetY++) {
854 if (offsetX != 0 || offsetY != 0) {
855 refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
856 refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
857 refRectB.x = refRectA.x;
858 refRectB.y = refRectA.y;
859 refRectB.x += offsetX;
860 refRectB.y += offsetY;
861 rectA = refRectA;
862 rectB = refRectB;
863 intersection = SDL_HasIntersection(&rectA, &rectB);
864 _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
865 }
866 }
867 }
868
869 return TEST_COMPLETED;
870}

References _validateHasIntersectionResults(), SDL_FALSE, SDL_HasIntersection, SDL_TRUE, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::x, and SDL_Rect::y.

◆ rect_testIntersectRectAndLine()

int rect_testIntersectRectAndLine ( void arg)

Definition at line 49 of file testautomation_rect.c.

50{
51 SDL_Rect refRect = { 0, 0, 32, 32 };
53 int x1, y1;
54 int x2, y2;
55 SDL_bool intersected;
56
57 int xLeft = -SDLTest_RandomIntegerInRange(1, refRect.w);
58 int xRight = refRect.w + SDLTest_RandomIntegerInRange(1, refRect.w);
59 int yTop = -SDLTest_RandomIntegerInRange(1, refRect.h);
60 int yBottom = refRect.h + SDLTest_RandomIntegerInRange(1, refRect.h);
61
62 x1 = xLeft;
63 y1 = 15;
64 x2 = xRight;
65 y2 = 15;
66 rect = refRect;
67 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
68 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 15, 31, 15);
69
70 x1 = 15;
71 y1 = yTop;
72 x2 = 15;
73 y2 = yBottom;
74 rect = refRect;
75 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
76 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 15, 0, 15, 31);
77
78 x1 = -refRect.w;
79 y1 = -refRect.h;
80 x2 = 2*refRect.w;
81 y2 = 2*refRect.h;
82 rect = refRect;
83 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
84 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 0, 31, 31);
85
86 x1 = 2*refRect.w;
87 y1 = 2*refRect.h;
88 x2 = -refRect.w;
89 y2 = -refRect.h;
90 rect = refRect;
91 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
92 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 31, 0, 0);
93
94 x1 = -1;
95 y1 = 32;
96 x2 = 32;
97 y2 = -1;
98 rect = refRect;
99 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
100 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 31, 31, 0);
101
102 x1 = 32;
103 y1 = -1;
104 x2 = -1;
105 y2 = 32;
106 rect = refRect;
107 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
108 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 0, 0, 31);
109
110 return TEST_COMPLETED;
111}
#define SDL_IntersectRectAndLine
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)

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.

243{
244 SDL_Rect refRect;
246 int x1, y1, x1Ref, y1Ref;
247 int x2, y2, x2Ref, y2Ref;
248 SDL_bool intersected;
249
250 refRect.x = SDLTest_RandomIntegerInRange(1, 1024);
251 refRect.y = SDLTest_RandomIntegerInRange(1, 1024);
252 refRect.w = 0;
253 refRect.h = 0;
254 x1Ref = refRect.x;
255 y1Ref = refRect.y;
256 x2Ref = SDLTest_RandomIntegerInRange(1, 1024);
257 y2Ref = SDLTest_RandomIntegerInRange(1, 1024);
258
259 x1 = x1Ref;
260 y1 = y1Ref;
261 x2 = x2Ref;
262 y2 = y2Ref;
263 rect = refRect;
264 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
265 _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref);
266
267 return TEST_COMPLETED;
268}

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.

121{
122 SDL_Rect refRect = { 0, 0, 32, 32 };
124 int x1, y1;
125 int x2, y2;
126 SDL_bool intersected;
127
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;
132 int x1Ref = SDLTest_RandomIntegerInRange(xmin + 1, xmax - 1);
133 int y1Ref = SDLTest_RandomIntegerInRange(ymin + 1, ymax - 1);
134 int x2Ref = SDLTest_RandomIntegerInRange(xmin + 1, xmax - 1);
135 int y2Ref = SDLTest_RandomIntegerInRange(ymin + 1, ymax - 1);
136
137 x1 = x1Ref;
138 y1 = y1Ref;
139 x2 = x2Ref;
140 y2 = y2Ref;
141 rect = refRect;
142 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
143 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref);
144
145 x1 = x1Ref;
146 y1 = y1Ref;
147 x2 = xmax;
148 y2 = ymax;
149 rect = refRect;
150 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
151 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, xmax, ymax);
152
153 x1 = xmin;
154 y1 = ymin;
155 x2 = x2Ref;
156 y2 = y2Ref;
157 rect = refRect;
158 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
159 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, x2Ref, y2Ref);
160
161 x1 = xmin;
162 y1 = ymin;
163 x2 = xmax;
164 y2 = ymax;
165 rect = refRect;
166 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
167 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, xmax, ymax);
168
169 x1 = xmin;
170 y1 = ymax;
171 x2 = xmax;
172 y2 = ymin;
173 rect = refRect;
174 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
175 _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymax, xmax, ymin);
176
177 return TEST_COMPLETED;
178}

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.

188{
189 SDL_Rect refRect = { 0, 0, 32, 32 };
191 int x1, y1;
192 int x2, y2;
193 SDL_bool intersected;
194
195 int xLeft = -SDLTest_RandomIntegerInRange(1, refRect.w);
196 int xRight = refRect.w + SDLTest_RandomIntegerInRange(1, refRect.w);
197 int yTop = -SDLTest_RandomIntegerInRange(1, refRect.h);
198 int yBottom = refRect.h + SDLTest_RandomIntegerInRange(1, refRect.h);
199
200 x1 = xLeft;
201 y1 = 0;
202 x2 = xLeft;
203 y2 = 31;
204 rect = refRect;
205 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
206 _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xLeft, 0, xLeft, 31);
207
208 x1 = xRight;
209 y1 = 0;
210 x2 = xRight;
211 y2 = 31;
212 rect = refRect;
213 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
214 _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xRight, 0, xRight, 31);
215
216 x1 = 0;
217 y1 = yTop;
218 x2 = 31;
219 y2 = yTop;
220 rect = refRect;
221 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
222 _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yTop, 31, yTop);
223
224 x1 = 0;
225 y1 = yBottom;
226 x2 = 31;
227 y2 = yBottom;
228 rect = refRect;
229 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
230 _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yBottom, 31, yBottom);
231
232 return TEST_COMPLETED;
233}

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)

Definition at line 277 of file testautomation_rect.c.

278{
279 SDL_Rect rect = { 0, 0, 32, 32 };
280 int x1 = rect.w / 2;
281 int y1 = rect.h / 2;
282 int x2 = x1;
283 int y2 = 2 * rect.h;
284 SDL_bool intersected;
285
286 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
287 SDLTest_AssertCheck(intersected == SDL_TRUE, "Check that intersection result was SDL_TRUE");
288
289 intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, &x1, &y1, &x2, &y2);
290 SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
291 intersected = SDL_IntersectRectAndLine(&rect, (int *)NULL, &y1, &x2, &y2);
292 SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL");
293 intersected = SDL_IntersectRectAndLine(&rect, &x1, (int *)NULL, &x2, &y2);
294 SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 3rd parameter is NULL");
295 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, (int *)NULL, &y2);
296 SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 4th parameter is NULL");
297 intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, (int *)NULL);
298 SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 5th parameter is NULL");
299 intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, (int *)NULL, (int *)NULL, (int *)NULL, (int *)NULL);
300 SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
301
302 return TEST_COMPLETED;
303}

References SDL_Rect::h, NULL, rect, SDL_FALSE, SDL_IntersectRectAndLine, SDL_TRUE, SDLTest_AssertCheck(), TEST_COMPLETED, and SDL_Rect::w.

◆ rect_testIntersectRectEmpty()

int rect_testIntersectRectEmpty ( void arg)

Definition at line 609 of file testautomation_rect.c.

610{
611 SDL_Rect refRectA;
612 SDL_Rect refRectB;
613 SDL_Rect rectA;
614 SDL_Rect rectB;
616 SDL_bool intersection;
617 SDL_bool empty;
618
619 /* Rect A empty */
622 refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
623 refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
624 refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
625 refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
626 refRectB = refRectA;
627 refRectA.w = 0;
628 refRectA.h = 0;
629 rectA = refRectA;
630 rectB = refRectB;
631 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
632 _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
633 empty = (SDL_bool)SDL_RectEmpty(&result);
634 SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
635
636 /* Rect B empty */
639 refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
640 refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
641 refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
642 refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
643 refRectB = refRectA;
644 refRectB.w = 0;
645 refRectB.h = 0;
646 rectA = refRectA;
647 rectB = refRectB;
648 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
649 _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
650 empty = (SDL_bool)SDL_RectEmpty(&result);
651 SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
652
653 /* Rect A and B empty */
656 refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
657 refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
658 refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
659 refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
660 refRectB = refRectA;
661 refRectA.w = 0;
662 refRectA.h = 0;
663 refRectB.w = 0;
664 refRectB.h = 0;
665 rectA = refRectA;
666 rectB = refRectB;
667 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
668 _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
669 empty = (SDL_bool)SDL_RectEmpty(&result);
670 SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
671
672 return TEST_COMPLETED;
673}
#define SDL_IntersectRect
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
Returns true if the rectangle has no area.
Definition: SDL_rect.h:108
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)

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.

418{
419 SDL_Rect refRectA = { 0, 0, 32, 32 };
420 SDL_Rect refRectB;
421 SDL_Rect rectA;
422 SDL_Rect rectB;
424 SDL_bool intersection;
425
426 /* rectB fully contained in rectA */
427 refRectB.x = 0;
428 refRectB.y = 0;
429 refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
430 refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
431 rectA = refRectA;
432 rectB = refRectB;
433 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
434 _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectB);
435
436 return TEST_COMPLETED;
437}

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.

446{
447 SDL_Rect refRectA = { 0, 0, 32, 32 };
448 SDL_Rect refRectB;
449 SDL_Rect rectA;
450 SDL_Rect rectB;
452 SDL_bool intersection;
453
454 /* rectB fully outside of rectA */
455 refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
456 refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
457 refRectB.w = refRectA.w;
458 refRectB.h = refRectA.h;
459 rectA = refRectA;
460 rectB = refRectB;
461 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
462 _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
463
464 return TEST_COMPLETED;
465}

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)

Definition at line 681 of file testautomation_rect.c.

682{
683 SDL_Rect rectA;
684 SDL_Rect rectB;
686 SDL_bool intersection;
687
688 /* invalid parameter combinations */
689 intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, &result);
690 SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
691 intersection = SDL_IntersectRect(&rectA, (SDL_Rect *)NULL, &result);
692 SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL");
693 intersection = SDL_IntersectRect(&rectA, &rectB, (SDL_Rect *)NULL);
694 SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 3st parameter is NULL");
695 intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, &result);
696 SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameters are NULL");
697 intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL);
698 SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 3rd parameters are NULL ");
699 intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
700 SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
701
702 return TEST_COMPLETED;
703}

References NULL, SDL_FALSE, SDL_IntersectRect, SDLTest_AssertCheck(), and TEST_COMPLETED.

◆ rect_testIntersectRectPartial()

int rect_testIntersectRectPartial ( void arg)

Definition at line 473 of file testautomation_rect.c.

474{
475 SDL_Rect refRectA = { 0, 0, 32, 32 };
476 SDL_Rect refRectB;
477 SDL_Rect rectA;
478 SDL_Rect rectB;
480 SDL_Rect expectedResult;
481 SDL_bool intersection;
482
483 /* rectB partially contained in rectA */
484 refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
485 refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
486 refRectB.w = refRectA.w;
487 refRectB.h = refRectA.h;
488 rectA = refRectA;
489 rectB = refRectB;
490 expectedResult.x = refRectB.x;
491 expectedResult.y = refRectB.y;
492 expectedResult.w = refRectA.w - refRectB.x;
493 expectedResult.h = refRectA.h - refRectB.y;
494 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
495 _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
496
497 /* rectB right edge */
498 refRectB.x = rectA.w - 1;
499 refRectB.y = rectA.y;
500 refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
501 refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
502 rectA = refRectA;
503 rectB = refRectB;
504 expectedResult.x = refRectB.x;
505 expectedResult.y = refRectB.y;
506 expectedResult.w = 1;
507 expectedResult.h = refRectB.h;
508 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
509 _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
510
511 /* rectB left edge */
512 refRectB.x = 1 - rectA.w;
513 refRectB.y = rectA.y;
514 refRectB.w = refRectA.w;
515 refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
516 rectA = refRectA;
517 rectB = refRectB;
518 expectedResult.x = 0;
519 expectedResult.y = refRectB.y;
520 expectedResult.w = 1;
521 expectedResult.h = refRectB.h;
522 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
523 _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
524
525 /* rectB bottom edge */
526 refRectB.x = rectA.x;
527 refRectB.y = rectA.h - 1;
528 refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
529 refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
530 rectA = refRectA;
531 rectB = refRectB;
532 expectedResult.x = refRectB.x;
533 expectedResult.y = refRectB.y;
534 expectedResult.w = refRectB.w;
535 expectedResult.h = 1;
536 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
537 _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
538
539 /* rectB top edge */
540 refRectB.x = rectA.x;
541 refRectB.y = 1 - rectA.h;
542 refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
543 refRectB.h = rectA.h;
544 rectA = refRectA;
545 rectB = refRectB;
546 expectedResult.x = refRectB.x;
547 expectedResult.y = 0;
548 expectedResult.w = refRectB.w;
549 expectedResult.h = 1;
550 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
551 _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
552
553 return TEST_COMPLETED;
554}

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)

Definition at line 562 of file testautomation_rect.c.

563{
564 SDL_Rect refRectA = { 0, 0, 1, 1 };
565 SDL_Rect refRectB = { 0, 0, 1, 1 };
566 SDL_Rect rectA;
567 SDL_Rect rectB;
569 SDL_bool intersection;
570 int offsetX, offsetY;
571
572 /* intersecting pixels */
573 refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
574 refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
575 refRectB.x = refRectA.x;
576 refRectB.y = refRectA.y;
577 rectA = refRectA;
578 rectB = refRectB;
579 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
580 _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectA);
581
582 /* non-intersecting pixels cases */
583 for (offsetX = -1; offsetX <= 1; offsetX++) {
584 for (offsetY = -1; offsetY <= 1; offsetY++) {
585 if (offsetX != 0 || offsetY != 0) {
586 refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
587 refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
588 refRectB.x = refRectA.x;
589 refRectB.y = refRectA.y;
590 refRectB.x += offsetX;
591 refRectB.y += offsetY;
592 rectA = refRectA;
593 rectB = refRectB;
594 intersection = SDL_IntersectRect(&rectA, &rectB, &result);
595 _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
596 }
597 }
598 }
599
600 return TEST_COMPLETED;
601}

References _validateIntersectRectResults(), NULL, SDL_FALSE, SDL_IntersectRect, SDL_TRUE, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::x, and SDL_Rect::y.

◆ rect_testRectEmpty()

int rect_testRectEmpty ( void arg)

Definition at line 1460 of file testautomation_rect.c.

1461{
1462 SDL_Rect refRect;
1463 SDL_Rect rect;
1464 SDL_bool expectedResult;
1466 int w, h;
1467
1468 /* Non-empty case */
1469 refRect.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1470 refRect.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1471 refRect.w=SDLTest_RandomIntegerInRange(256, 1024);
1472 refRect.h=SDLTest_RandomIntegerInRange(256, 1024);
1473 expectedResult = SDL_FALSE;
1474 rect = refRect;
1476 _validateRectEmptyResults(result, expectedResult, &rect, &refRect);
1477
1478 /* Empty case */
1479 for (w=-1; w<2; w++) {
1480 for (h=-1; h<2; h++) {
1481 if ((w != 1) || (h != 1)) {
1482 refRect.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1483 refRect.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1484 refRect.w=w;
1485 refRect.h=h;
1486 expectedResult = SDL_TRUE;
1487 rect = refRect;
1489 _validateRectEmptyResults(result, expectedResult, &rect, &refRect);
1490 }
1491 }
1492 }
1493
1494 return TEST_COMPLETED;
1495}
GLfloat GLfloat GLfloat GLfloat h
GLubyte GLubyte GLubyte GLubyte w
void _validateRectEmptyResults(SDL_bool empty, SDL_bool expectedEmpty, SDL_Rect *rect, SDL_Rect *refRect)

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)

Definition at line 1503 of file testautomation_rect.c.

1504{
1506
1507 /* invalid parameter combinations */
1509 SDLTest_AssertCheck(result == SDL_TRUE, "Check that function returns TRUE when 1st parameter is NULL");
1510
1511 return TEST_COMPLETED;
1512}

References NULL, SDL_RectEmpty(), SDL_TRUE, SDLTest_AssertCheck(), and TEST_COMPLETED.

◆ rect_testRectEquals()

int rect_testRectEquals ( void arg)

Definition at line 1520 of file testautomation_rect.c.

1521{
1522 SDL_Rect refRectA;
1523 SDL_Rect refRectB;
1524 SDL_Rect rectA;
1525 SDL_Rect rectB;
1526 SDL_bool expectedResult;
1528
1529 /* Equals */
1530 refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1531 refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1532 refRectA.w=SDLTest_RandomIntegerInRange(1, 1024);
1533 refRectA.h=SDLTest_RandomIntegerInRange(1, 1024);
1534 refRectB = refRectA;
1535 expectedResult = SDL_TRUE;
1536 rectA = refRectA;
1537 rectB = refRectB;
1538 result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)&rectA, (const SDL_Rect *)&rectB);
1539 _validateRectEqualsResults(result, expectedResult, &rectA, &rectB, &refRectA, &refRectB);
1540
1541 return TEST_COMPLETED;
1542}
SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
Returns true if the two rectangles are equal.
Definition: SDL_rect.h:116
void _validateRectEqualsResults(SDL_bool equals, SDL_bool expectedEquals, SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)

References _validateRectEqualsResults(), SDL_Rect::h, SDL_RectEquals(), SDL_TRUE, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

◆ rect_testRectEqualsParam()

int rect_testRectEqualsParam ( void arg)

Definition at line 1550 of file testautomation_rect.c.

1551{
1552 SDL_Rect rectA;
1553 SDL_Rect rectB;
1555
1556 /* data setup */
1557 rectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1558 rectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1559 rectA.w=SDLTest_RandomIntegerInRange(1, 1024);
1560 rectA.h=SDLTest_RandomIntegerInRange(1, 1024);
1561 rectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1562 rectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1563 rectB.w=SDLTest_RandomIntegerInRange(1, 1024);
1564 rectB.h=SDLTest_RandomIntegerInRange(1, 1024);
1565
1566 /* invalid parameter combinations */
1567 result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)NULL, (const SDL_Rect *)&rectB);
1568 SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
1569 result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)&rectA, (const SDL_Rect *)NULL);
1570 SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL");
1571 result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)NULL, (const SDL_Rect *)NULL);
1572 SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameter are NULL");
1573
1574 return TEST_COMPLETED;
1575}

References SDL_Rect::h, NULL, SDL_FALSE, SDL_RectEquals(), SDLTest_AssertCheck(), SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

◆ rect_testUnionRectEmpty()

int rect_testUnionRectEmpty ( void arg)

Definition at line 1303 of file testautomation_rect.c.

1304{
1305 SDL_Rect refRectA, refRectB;
1306 SDL_Rect rectA, rectB;
1307 SDL_Rect expectedResult;
1309
1310 /* A empty */
1311 refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1312 refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1313 refRectA.w=0;
1314 refRectA.h=0;
1315 refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1316 refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1317 refRectB.w=SDLTest_RandomIntegerInRange(1, 1024);
1318 refRectB.h=SDLTest_RandomIntegerInRange(1, 1024);
1319 expectedResult = refRectB;
1320 rectA = refRectA;
1321 rectB = refRectB;
1322 SDL_UnionRect(&rectA, &rectB, &result);
1323 _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
1324
1325 /* B empty */
1326 refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1327 refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1328 refRectA.w=SDLTest_RandomIntegerInRange(1, 1024);
1329 refRectA.h=SDLTest_RandomIntegerInRange(1, 1024);
1330 refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1331 refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1332 refRectB.w=0;
1333 refRectB.h=0;
1334 expectedResult = refRectA;
1335 rectA = refRectA;
1336 rectB = refRectB;
1337 SDL_UnionRect(&rectA, &rectB, &result);
1338 _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
1339
1340 /* A and B empty */
1341 refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1342 refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1343 refRectA.w=0;
1344 refRectA.h=0;
1345 refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1346 refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1347 refRectB.w=0;
1348 refRectB.h=0;
1349 result.x=0;
1350 result.y=0;
1351 result.w=0;
1352 result.h=0;
1353 expectedResult = result;
1354 rectA = refRectA;
1355 rectB = refRectB;
1356 SDL_UnionRect(&rectA, &rectB, &result);
1357 _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
1358
1359 return TEST_COMPLETED;
1360}
#define SDL_UnionRect
void _validateUnionRectResults(SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, SDL_Rect *result, SDL_Rect *expectedResult)

References _validateUnionRectResults(), SDL_Rect::h, SDL_UnionRect, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

◆ rect_testUnionRectInside()

int rect_testUnionRectInside ( void arg)

Definition at line 1368 of file testautomation_rect.c.

1369{
1370 SDL_Rect refRectA, refRectB;
1371 SDL_Rect rectA, rectB;
1372 SDL_Rect expectedResult;
1374 int dx, dy;
1375
1376 /* Union 1x1 with itself */
1377 refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1378 refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1379 refRectA.w=1;
1380 refRectA.h=1;
1381 expectedResult = refRectA;
1382 rectA = refRectA;
1383 SDL_UnionRect(&rectA, &rectA, &result);
1384 _validateUnionRectResults(&rectA, &rectA, &refRectA, &refRectA, &result, &expectedResult);
1385
1386 /* Union 1x1 somewhere inside */
1387 refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1388 refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1389 refRectA.w=SDLTest_RandomIntegerInRange(256, 1024);
1390 refRectA.h=SDLTest_RandomIntegerInRange(256, 1024);
1391 refRectB.x=refRectA.x + 1 + SDLTest_RandomIntegerInRange(1, refRectA.w - 2);
1392 refRectB.y=refRectA.y + 1 + SDLTest_RandomIntegerInRange(1, refRectA.h - 2);
1393 refRectB.w=1;
1394 refRectB.h=1;
1395 expectedResult = refRectA;
1396 rectA = refRectA;
1397 rectB = refRectB;
1398 SDL_UnionRect(&rectA, &rectB, &result);
1399 _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
1400
1401 /* Union inside with edges modified */
1402 for (dx = -1; dx < 2; dx++) {
1403 for (dy = -1; dy < 2; dy++) {
1404 if ((dx != 0) || (dy != 0)) {
1405 refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1406 refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1407 refRectA.w=SDLTest_RandomIntegerInRange(256, 1024);
1408 refRectA.h=SDLTest_RandomIntegerInRange(256, 1024);
1409 refRectB = refRectA;
1410 if (dx == -1) refRectB.x++;
1411 if ((dx == 1) || (dx == -1)) refRectB.w--;
1412 if (dy == -1) refRectB.y++;
1413 if ((dy == 1) || (dy == -1)) refRectB.h--;
1414 expectedResult = refRectA;
1415 rectA = refRectA;
1416 rectB = refRectB;
1417 SDL_UnionRect(&rectA, &rectB, &result);
1418 _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
1419 }
1420 }
1421 }
1422
1423 return TEST_COMPLETED;
1424}

References _validateUnionRectResults(), SDL_Rect::h, SDL_UnionRect, SDLTest_RandomIntegerInRange(), TEST_COMPLETED, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

◆ rect_testUnionRectOutside()

int rect_testUnionRectOutside ( void arg)

Definition at line 1232 of file testautomation_rect.c.

1233{
1234 SDL_Rect refRectA, refRectB;
1235 SDL_Rect rectA, rectB;
1236 SDL_Rect expectedResult;
1238 int minx, maxx, miny, maxy;
1239 int dx, dy;
1240
1241 /* Union 1x1 outside */
1242 for (dx = -1; dx < 2; dx++) {
1243 for (dy = -1; dy < 2; dy++) {
1244 if ((dx != 0) || (dy != 0)) {
1245 refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1246 refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1247 refRectA.w=1;
1248 refRectA.h=1;
1249 refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024) + dx*2048;
1250 refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024) + dx*2048;
1251 refRectB.w=1;
1252 refRectB.h=1;
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;
1261 rectA = refRectA;
1262 rectB = refRectB;
1263 SDL_UnionRect(&rectA, &rectB, &result);
1264 _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
1265 }
1266 }
1267 }
1268
1269 /* Union outside overlap */
1270 for (dx = -1; dx < 2; dx++) {
1271 for (dy = -1; dy < 2; dy++) {
1272 if ((dx != 0) || (dy != 0)) {
1273 refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
1274 refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
1275 refRectA.w=SDLTest_RandomIntegerInRange(256, 512);
1276 refRectA.h=SDLTest_RandomIntegerInRange(256, 512);
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++;
1286 rectA = refRectA;
1287 rectB = refRectB;
1288 SDL_UnionRect(&rectA, &rectB, &result);
1289 _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
1290 }
1291 }
1292 }
1293
1294 return TEST_COMPLETED;
1295}

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)

Definition at line 1432 of file testautomation_rect.c.

1433{
1434 SDL_Rect rectA, rectB;
1436
1437 /* invalid parameter combinations */
1438 SDL_UnionRect((SDL_Rect *)NULL, &rectB, &result);
1439 SDLTest_AssertPass("Check that function returns when 1st parameter is NULL");
1440 SDL_UnionRect(&rectA, (SDL_Rect *)NULL, &result);
1441 SDLTest_AssertPass("Check that function returns when 2nd parameter is NULL");
1442 SDL_UnionRect(&rectA, &rectB, (SDL_Rect *)NULL);
1443 SDLTest_AssertPass("Check that function returns when 3rd parameter is NULL");
1444 SDL_UnionRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL);
1445 SDLTest_AssertPass("Check that function returns when 1st and 3rd parameter are NULL");
1446 SDL_UnionRect(&rectA, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
1447 SDLTest_AssertPass("Check that function returns when 2nd and 3rd parameter are NULL");
1449 SDLTest_AssertPass("Check that function returns when all parameters are NULL");
1450
1451 return TEST_COMPLETED;
1452}
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.

References NULL, SDL_UnionRect, SDLTest_AssertPass(), and TEST_COMPLETED.

Variable Documentation

◆ rectTest1

const SDLTest_TestCaseReference rectTest1
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLine,"rect_testIntersectRectAndLine", "Tests SDL_IntersectRectAndLine clipping cases", TEST_ENABLED }
#define TEST_ENABLED
int(* SDLTest_TestCaseFp)(void *arg)
int rect_testIntersectRectAndLine(void *arg)

Definition at line 1582 of file testautomation_rect.c.

◆ rectTest10

const SDLTest_TestCaseReference rectTest10
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectEmpty, "rect_testIntersectRectEmpty", "Tests SDL_IntersectRect with empty rectangles", TEST_ENABLED }
int rect_testIntersectRectEmpty(void *arg)

Definition at line 1610 of file testautomation_rect.c.

◆ rectTest11

const SDLTest_TestCaseReference rectTest11
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectParam, "rect_testIntersectRectParam", "Negative tests against SDL_IntersectRect with invalid parameters", TEST_ENABLED }
int rect_testIntersectRectParam(void *arg)

Definition at line 1613 of file testautomation_rect.c.

◆ rectTest12

const SDLTest_TestCaseReference rectTest12
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testHasIntersectionInside, "rect_testHasIntersectionInside", "Tests SDL_HasIntersection with B fully contained in A", TEST_ENABLED }
int rect_testHasIntersectionInside(void *arg)

Definition at line 1617 of file testautomation_rect.c.

◆ rectTest13

const SDLTest_TestCaseReference rectTest13
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testHasIntersectionOutside, "rect_testHasIntersectionOutside", "Tests SDL_HasIntersection with B fully outside of A", TEST_ENABLED }
int rect_testHasIntersectionOutside(void *arg)

Definition at line 1620 of file testautomation_rect.c.

◆ rectTest14

const SDLTest_TestCaseReference rectTest14
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testHasIntersectionPartial,"rect_testHasIntersectionPartial", "Tests SDL_HasIntersection with B partially intersecting A", TEST_ENABLED }
int rect_testHasIntersectionPartial(void *arg)

Definition at line 1623 of file testautomation_rect.c.

◆ rectTest15

const SDLTest_TestCaseReference rectTest15
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testHasIntersectionPoint, "rect_testHasIntersectionPoint", "Tests SDL_HasIntersection with 1x1 sized rectangles", TEST_ENABLED }
int rect_testHasIntersectionPoint(void *arg)

Definition at line 1626 of file testautomation_rect.c.

◆ rectTest16

const SDLTest_TestCaseReference rectTest16
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testHasIntersectionEmpty, "rect_testHasIntersectionEmpty", "Tests SDL_HasIntersection with empty rectangles", TEST_ENABLED }
int rect_testHasIntersectionEmpty(void *arg)

Definition at line 1629 of file testautomation_rect.c.

◆ rectTest17

const SDLTest_TestCaseReference rectTest17
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testHasIntersectionParam, "rect_testHasIntersectionParam", "Negative tests against SDL_HasIntersection with invalid parameters", TEST_ENABLED }
int rect_testHasIntersectionParam(void *arg)

Definition at line 1632 of file testautomation_rect.c.

◆ rectTest18

const SDLTest_TestCaseReference rectTest18
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testEnclosePoints, "rect_testEnclosePoints", "Tests SDL_EnclosePoints without clipping", TEST_ENABLED }
int rect_testEnclosePoints(void *arg)

Definition at line 1636 of file testautomation_rect.c.

◆ rectTest19

const SDLTest_TestCaseReference rectTest19
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testEnclosePointsWithClipping, "rect_testEnclosePointsWithClipping", "Tests SDL_EnclosePoints with clipping", TEST_ENABLED }
int rect_testEnclosePointsWithClipping(void *arg)

Definition at line 1639 of file testautomation_rect.c.

◆ rectTest2

const SDLTest_TestCaseReference rectTest2
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineInside, "rect_testIntersectRectAndLineInside", "Tests SDL_IntersectRectAndLine with line fully contained in rect", TEST_ENABLED }
int rect_testIntersectRectAndLineInside(void *arg)

Definition at line 1585 of file testautomation_rect.c.

◆ rectTest20

const SDLTest_TestCaseReference rectTest20
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testEnclosePointsRepeatedInput, "rect_testEnclosePointsRepeatedInput", "Tests SDL_EnclosePoints with repeated input", TEST_ENABLED }
int rect_testEnclosePointsRepeatedInput(void *arg)

Definition at line 1642 of file testautomation_rect.c.

◆ rectTest21

const SDLTest_TestCaseReference rectTest21
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testEnclosePointsParam, "rect_testEnclosePointsParam", "Negative tests against SDL_EnclosePoints with invalid parameters", TEST_ENABLED }
int rect_testEnclosePointsParam(void *arg)

Definition at line 1645 of file testautomation_rect.c.

◆ rectTest22

const SDLTest_TestCaseReference rectTest22
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testUnionRectInside, "rect_testUnionRectInside", "Tests SDL_UnionRect where rect B is inside rect A", TEST_ENABLED }
int rect_testUnionRectInside(void *arg)

Definition at line 1649 of file testautomation_rect.c.

◆ rectTest23

const SDLTest_TestCaseReference rectTest23
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testUnionRectOutside, "rect_testUnionRectOutside", "Tests SDL_UnionRect where rect B is outside rect A", TEST_ENABLED }
int rect_testUnionRectOutside(void *arg)

Definition at line 1652 of file testautomation_rect.c.

◆ rectTest24

const SDLTest_TestCaseReference rectTest24
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testUnionRectEmpty, "rect_testUnionRectEmpty", "Tests SDL_UnionRect where rect A or rect B are empty", TEST_ENABLED }
int rect_testUnionRectEmpty(void *arg)

Definition at line 1655 of file testautomation_rect.c.

◆ rectTest25

const SDLTest_TestCaseReference rectTest25
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testUnionRectParam, "rect_testUnionRectParam", "Negative tests against SDL_UnionRect with invalid parameters", TEST_ENABLED }
int rect_testUnionRectParam(void *arg)

Definition at line 1658 of file testautomation_rect.c.

◆ rectTest26

const SDLTest_TestCaseReference rectTest26
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testRectEmpty, "rect_testRectEmpty", "Tests SDL_RectEmpty with various inputs", TEST_ENABLED }
int rect_testRectEmpty(void *arg)

Definition at line 1662 of file testautomation_rect.c.

◆ rectTest27

const SDLTest_TestCaseReference rectTest27
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testRectEmptyParam, "rect_testRectEmptyParam", "Negative tests against SDL_RectEmpty with invalid parameters", TEST_ENABLED }
int rect_testRectEmptyParam(void *arg)

Definition at line 1665 of file testautomation_rect.c.

◆ rectTest28

const SDLTest_TestCaseReference rectTest28
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testRectEquals, "rect_testRectEquals", "Tests SDL_RectEquals with various inputs", TEST_ENABLED }
int rect_testRectEquals(void *arg)

Definition at line 1670 of file testautomation_rect.c.

◆ rectTest29

const SDLTest_TestCaseReference rectTest29
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testRectEqualsParam, "rect_testRectEqualsParam", "Negative tests against SDL_RectEquals with invalid parameters", TEST_ENABLED }
int rect_testRectEqualsParam(void *arg)

Definition at line 1673 of file testautomation_rect.c.

◆ rectTest3

const SDLTest_TestCaseReference rectTest3
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineOutside, "rect_testIntersectRectAndLineOutside", "Tests SDL_IntersectRectAndLine with line fully outside of rect", TEST_ENABLED }
int rect_testIntersectRectAndLineOutside(void *arg)

Definition at line 1588 of file testautomation_rect.c.

◆ rectTest4

const SDLTest_TestCaseReference rectTest4
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineEmpty, "rect_testIntersectRectAndLineEmpty", "Tests SDL_IntersectRectAndLine with empty rectangle ", TEST_ENABLED }
int rect_testIntersectRectAndLineEmpty(void *arg)

Definition at line 1591 of file testautomation_rect.c.

◆ rectTest5

const SDLTest_TestCaseReference rectTest5
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineParam, "rect_testIntersectRectAndLineParam", "Negative tests against SDL_IntersectRectAndLine with invalid parameters", TEST_ENABLED }
int rect_testIntersectRectAndLineParam(void *arg)

Definition at line 1594 of file testautomation_rect.c.

◆ rectTest6

const SDLTest_TestCaseReference rectTest6
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectInside, "rect_testIntersectRectInside", "Tests SDL_IntersectRect with B fully contained in A", TEST_ENABLED }
int rect_testIntersectRectInside(void *arg)

Definition at line 1598 of file testautomation_rect.c.

◆ rectTest7

const SDLTest_TestCaseReference rectTest7
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectOutside, "rect_testIntersectRectOutside", "Tests SDL_IntersectRect with B fully outside of A", TEST_ENABLED }
int rect_testIntersectRectOutside(void *arg)

Definition at line 1601 of file testautomation_rect.c.

◆ rectTest8

const SDLTest_TestCaseReference rectTest8
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectPartial, "rect_testIntersectRectPartial", "Tests SDL_IntersectRect with B partially intersecting A", TEST_ENABLED }
int rect_testIntersectRectPartial(void *arg)

Definition at line 1604 of file testautomation_rect.c.

◆ rectTest9

const SDLTest_TestCaseReference rectTest9
static
Initial value:
=
{ (SDLTest_TestCaseFp)rect_testIntersectRectPoint, "rect_testIntersectRectPoint", "Tests SDL_IntersectRect with 1x1 sized rectangles", TEST_ENABLED }
int rect_testIntersectRectPoint(void *arg)

Definition at line 1607 of file testautomation_rect.c.

◆ rectTests

const SDLTest_TestCaseReference* rectTests[]
static
Initial value:
= {
}
static const SDLTest_TestCaseReference rectTest24
static const SDLTest_TestCaseReference rectTest13
static const SDLTest_TestCaseReference rectTest8
static const SDLTest_TestCaseReference rectTest27
static const SDLTest_TestCaseReference rectTest4
static const SDLTest_TestCaseReference rectTest3
static const SDLTest_TestCaseReference rectTest6
static const SDLTest_TestCaseReference rectTest9
static const SDLTest_TestCaseReference rectTest21
static const SDLTest_TestCaseReference rectTest16
static const SDLTest_TestCaseReference rectTest14
static const SDLTest_TestCaseReference rectTest28
static const SDLTest_TestCaseReference rectTest10
static const SDLTest_TestCaseReference rectTest29
static const SDLTest_TestCaseReference rectTest19
static const SDLTest_TestCaseReference rectTest20
static const SDLTest_TestCaseReference rectTest26
static const SDLTest_TestCaseReference rectTest17
static const SDLTest_TestCaseReference rectTest1
static const SDLTest_TestCaseReference rectTest12
static const SDLTest_TestCaseReference rectTest7
static const SDLTest_TestCaseReference rectTest23
static const SDLTest_TestCaseReference rectTest25
static const SDLTest_TestCaseReference rectTest18
static const SDLTest_TestCaseReference rectTest15
static const SDLTest_TestCaseReference rectTest11
static const SDLTest_TestCaseReference rectTest22
static const SDLTest_TestCaseReference rectTest5
static const SDLTest_TestCaseReference rectTest2

Definition at line 1683 of file testautomation_rect.c.

◆ rectTestSuite

Initial value:
= {
"Rect",
}
static const SDLTest_TestCaseReference * rectTests[]

Definition at line 1691 of file testautomation_rect.c.