Update video_getSetWindowSize for windows

This commit is contained in:
Andreas Schiffler 2013-08-08 22:10:00 -07:00
parent 7067bff470
commit 84e0884077

View file

@ -1081,6 +1081,7 @@ video_getSetWindowSize(void *arg)
SDL_Window* window; SDL_Window* window;
int result; int result;
SDL_Rect display; SDL_Rect display;
int maxwVariation, maxhVariation;
int wVariation, hVariation; int wVariation, hVariation;
int referenceW, referenceH; int referenceW, referenceH;
int currentW, currentH; int currentW, currentH;
@ -1096,8 +1097,18 @@ video_getSetWindowSize(void *arg)
window = _createVideoSuiteTestWindow(title); window = _createVideoSuiteTestWindow(title);
if (window == NULL) return TEST_ABORTED; if (window == NULL) return TEST_ABORTED;
for (wVariation = 0; wVariation < 4; wVariation++) { #ifdef __WIN32__
for (hVariation = 0; hVariation < 4; hVariation++) { /* Platform clips window size to screen size */
maxwVariation = 4;
maxhVariation = 4;
#else
/* Platform allows window size >= screen size */
maxwVariation = 5;
maxhVariation = 5;
#endif
for (wVariation = 0; wVariation < maxwVariation; wVariation++) {
for (hVariation = 0; hVariation < maxhVariation; hVariation++) {
switch(wVariation) { switch(wVariation) {
case 0: case 0:
/* 1 Pixel Wide */ /* 1 Pixel Wide */
@ -1108,10 +1119,14 @@ video_getSetWindowSize(void *arg)
desiredW = SDLTest_RandomIntegerInRange(1, 100); desiredW = SDLTest_RandomIntegerInRange(1, 100);
break; break;
case 2: case 2:
/* Width 1 pixel smaller than screen */
desiredW = display.w - 1;
break;
case 3:
/* Width at screen size */ /* Width at screen size */
desiredW = display.w; desiredW = display.w;
break; break;
case 3: case 4:
/* Width 1 pixel larger than screen */ /* Width 1 pixel larger than screen */
desiredW = display.w + 1; desiredW = display.w + 1;
break; break;
@ -1127,10 +1142,14 @@ video_getSetWindowSize(void *arg)
desiredH = SDLTest_RandomIntegerInRange(1, 100); desiredH = SDLTest_RandomIntegerInRange(1, 100);
break; break;
case 2: case 2:
/* Height 1 pixel smaller than screen */
desiredH = display.h - 1;
break;
case 3:
/* Height at screen size */ /* Height at screen size */
desiredH = display.h; desiredH = display.h;
break; break;
case 3: case 4:
/* Height 1 pixel larger than screen */ /* Height 1 pixel larger than screen */
desiredH = display.h + 1; desiredH = display.h + 1;
break; break;
@ -1152,13 +1171,13 @@ video_getSetWindowSize(void *arg)
currentW = desiredW + 1; currentW = desiredW + 1;
SDL_GetWindowSize(window, &currentW, NULL); SDL_GetWindowSize(window, &currentW, NULL);
SDLTest_AssertPass("Call to SDL_GetWindowSize(&h=NULL)"); SDLTest_AssertPass("Call to SDL_GetWindowSize(&h=NULL)");
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentH); SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
/* Get just height */ /* Get just height */
currentH = desiredH + 1; currentH = desiredH + 1;
SDL_GetWindowSize(window, NULL, &currentH); SDL_GetWindowSize(window, NULL, &currentH);
SDLTest_AssertPass("Call to SDL_GetWindowSize(&w=NULL)"); SDLTest_AssertPass("Call to SDL_GetWindowSize(&w=NULL)");
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredW, currentH); SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
} }
} }