5
#include <SDL3/SDL_test.h>
6
#include "testautomation_suites.h"
13
static SDL_Window *createVideoSuiteTestWindow(const char *title)
20
SDL_WindowFlags flags;
21
SDL_bool needs_renderer = SDL_FALSE;
22
SDL_bool needs_events_pumped = SDL_FALSE;
25
w = SDLTest_RandomIntegerInRange(320, 1024);
26
h = SDLTest_RandomIntegerInRange(320, 768);
27
flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_BORDERLESS;
29
window = SDL_CreateWindow(title, w, h, flags);
30
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%" SDL_PRIu64 ")", w, h, flags);
31
SDLTest_AssertCheck(window != NULL, "Validate that returned window is not NULL");
34
windows = SDL_GetWindows(&count);
35
SDLTest_AssertCheck(windows != NULL, "Validate that returned window list is not NULL");
36
SDLTest_AssertCheck(windows[0] == window, "Validate that the window is first in the window list");
42
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
43
needs_renderer = SDL_TRUE;
44
} else if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) {
46
const char *session_type = SDL_getenv("XDG_SESSION_TYPE");
47
if (session_type && SDL_strcasecmp(session_type, "wayland") == 0) {
48
needs_renderer = SDL_TRUE;
52
needs_events_pumped = SDL_TRUE;
56
SDL_Renderer *renderer = SDL_CreateRenderer(window, NULL);
58
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF);
59
SDL_RenderClear(renderer);
60
SDL_RenderPresent(renderer);
67
SDLTest_Log("Unable to create a renderer, some tests may fail on Wayland/XWayland");
71
if (needs_events_pumped) {
73
while (SDL_PollEvent(&event)) {
83
static void destroyVideoSuiteTestWindow(SDL_Window *window)
86
SDL_Renderer *renderer = SDL_GetRenderer(window);
88
SDL_DestroyRenderer(renderer);
90
SDL_DestroyWindow(window);
92
SDLTest_AssertPass("Call to SDL_DestroyWindow()");
101
static int video_enableDisableScreensaver(void *arg)
103
SDL_bool initialResult;
107
initialResult = SDL_ScreenSaverEnabled();
108
SDLTest_AssertPass("Call to SDL_ScreenSaverEnabled()");
109
if (initialResult == SDL_TRUE) {
114
SDL_DisableScreenSaver();
115
SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");
116
result = SDL_ScreenSaverEnabled();
117
SDLTest_AssertPass("Call to SDL_ScreenSaverEnabled()");
118
SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);
121
SDL_EnableScreenSaver();
122
SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
123
result = SDL_ScreenSaverEnabled();
124
SDLTest_AssertPass("Call to SDL_ScreenSaverEnabled()");
125
SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
132
SDL_EnableScreenSaver();
133
SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
134
result = SDL_ScreenSaverEnabled();
135
SDLTest_AssertPass("Call to SDL_ScreenSaverEnabled()");
136
SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
139
SDL_DisableScreenSaver();
140
SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");
141
result = SDL_ScreenSaverEnabled();
142
SDLTest_AssertPass("Call to SDL_ScreenSaverEnabled()");
143
SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);
146
return TEST_COMPLETED;
152
static int video_createWindowVariousSizes(void *arg)
155
const char *title = "video_createWindowVariousSizes Test Window";
157
int wVariation, hVariation;
159
for (wVariation = 0; wVariation < 3; wVariation++) {
160
for (hVariation = 0; hVariation < 3; hVariation++) {
161
switch (wVariation) {
168
w = SDLTest_RandomIntegerInRange(320, 1920);
172
w = SDLTest_RandomIntegerInRange(2048, 4095);
176
switch (hVariation) {
183
h = SDLTest_RandomIntegerInRange(320, 1080);
187
h = SDLTest_RandomIntegerInRange(2048, 4095);
191
window = SDL_CreateWindow(title, w, h, 0);
192
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,SHOWN)", w, h);
193
SDLTest_AssertCheck(window != NULL, "Validate that returned window is not NULL");
196
destroyVideoSuiteTestWindow(window);
200
return TEST_COMPLETED;
206
static int video_createWindowVariousFlags(void *arg)
209
const char *title = "video_createWindowVariousFlags Test Window";
212
SDL_WindowFlags flags;
215
w = SDLTest_RandomIntegerInRange(320, 1024);
216
h = SDLTest_RandomIntegerInRange(320, 768);
218
for (fVariation = 1; fVariation < 14; fVariation++) {
219
switch (fVariation) {
222
flags = SDL_WINDOW_FULLSCREEN;
227
flags = SDL_WINDOW_OPENGL;
235
flags = SDL_WINDOW_HIDDEN;
238
flags = SDL_WINDOW_BORDERLESS;
241
flags = SDL_WINDOW_RESIZABLE;
244
flags = SDL_WINDOW_MINIMIZED;
247
flags = SDL_WINDOW_MAXIMIZED;
250
flags = SDL_WINDOW_MOUSE_GRABBED;
253
flags = SDL_WINDOW_INPUT_FOCUS;
256
flags = SDL_WINDOW_MOUSE_FOCUS;
259
flags = SDL_WINDOW_EXTERNAL;
262
flags = SDL_WINDOW_KEYBOARD_GRABBED;
266
window = SDL_CreateWindow(title, w, h, flags);
267
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%" SDL_PRIu64 ")", w, h, flags);
268
SDLTest_AssertCheck(window != NULL, "Validate that returned window is not NULL");
271
destroyVideoSuiteTestWindow(window);
274
return TEST_COMPLETED;
280
static int video_getWindowFlags(void *arg)
283
const char *title = "video_getWindowFlags Test Window";
284
SDL_WindowFlags flags;
285
SDL_WindowFlags actualFlags;
291
window = createVideoSuiteTestWindow(title);
292
if (window != NULL) {
293
actualFlags = SDL_GetWindowFlags(window);
294
SDLTest_AssertPass("Call to SDL_GetWindowFlags()");
295
SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %" SDL_PRIu64 " set, got: %" SDL_PRIu64, flags, actualFlags);
299
destroyVideoSuiteTestWindow(window);
301
return TEST_COMPLETED;
307
static int video_getFullscreenDisplayModes(void *arg)
309
SDL_DisplayID *displays;
310
SDL_DisplayMode **modes;
315
displays = SDL_GetDisplays(NULL);
317
SDLTest_AssertPass("Call to SDL_GetDisplays()");
320
for (i = 0; displays[i]; ++i) {
321
modes = SDL_GetFullscreenDisplayModes(displays[i], &count);
322
SDLTest_AssertPass("Call to SDL_GetFullscreenDisplayModes(%" SDL_PRIu32 ")", displays[i]);
323
SDLTest_AssertCheck(modes != NULL, "Validate returned value from function; expected != NULL; got: %p", modes);
324
SDLTest_AssertCheck(count >= 0, "Validate number of modes; expected: >= 0; got: %d", count);
330
return TEST_COMPLETED;
336
static int video_getClosestDisplayModeCurrentResolution(void *arg)
338
SDL_DisplayID *displays;
339
SDL_DisplayMode **modes;
340
SDL_DisplayMode current;
341
SDL_DisplayMode closest;
342
int i, result, num_modes;
345
displays = SDL_GetDisplays(NULL);
347
SDLTest_AssertPass("Call to SDL_GetDisplays()");
350
for (i = 0; displays[i]; ++i) {
351
SDLTest_Log("Testing against display: %" SDL_PRIu32, displays[i]);
354
modes = SDL_GetFullscreenDisplayModes(displays[i], &num_modes);
355
SDLTest_AssertPass("Call to SDL_GetDisplayModes()");
356
SDLTest_Assert(modes != NULL, "Verify returned value is not NULL");
358
SDL_memcpy(¤t, modes[0], sizeof(current));
361
result = SDL_GetClosestFullscreenDisplayMode(displays[i], current.w, current.h, current.refresh_rate, SDL_FALSE, &closest);
362
SDLTest_AssertPass("Call to SDL_GetClosestFullscreenDisplayMode(target=current)");
363
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
367
SDLTest_AssertCheck(closest.w == current.w,
368
"Verify returned width matches current width; expected: %d, got: %d",
369
current.w, closest.w);
370
SDLTest_AssertCheck(closest.h == current.h,
371
"Verify returned height matches current height; expected: %d, got: %d",
372
current.h, closest.h);
380
return TEST_COMPLETED;
386
static int video_getClosestDisplayModeRandomResolution(void *arg)
388
SDL_DisplayID *displays;
389
SDL_DisplayMode target;
390
SDL_DisplayMode closest;
395
displays = SDL_GetDisplays(NULL);
397
SDLTest_AssertPass("Call to SDL_GetDisplays()");
400
for (i = 0; displays[i]; ++i) {
401
SDLTest_Log("Testing against display: %" SDL_PRIu32, displays[i]);
403
for (variation = 0; variation < 16; variation++) {
407
target.w = (variation & 1) ? SDLTest_RandomIntegerInRange(1, 4096) : 0;
408
target.h = (variation & 2) ? SDLTest_RandomIntegerInRange(1, 4096) : 0;
409
target.refresh_rate = (variation & 8) ? (float)SDLTest_RandomIntegerInRange(25, 120) : 0.0f;
412
SDL_GetClosestFullscreenDisplayMode(displays[i], target.w, target.h, target.refresh_rate, SDL_FALSE, &closest);
413
SDLTest_AssertPass("Call to SDL_GetClosestFullscreenDisplayMode(target=random/variation%d)", variation);
419
return TEST_COMPLETED;
427
static int video_getWindowDisplayMode(void *arg)
430
const char *title = "video_getWindowDisplayMode Test Window";
431
const SDL_DisplayMode *mode;
434
window = createVideoSuiteTestWindow(title);
435
if (window != NULL) {
436
mode = SDL_GetWindowFullscreenMode(window);
437
SDLTest_AssertPass("Call to SDL_GetWindowFullscreenMode()");
438
SDLTest_AssertCheck(mode == NULL, "Validate result value; expected: NULL, got: %p", mode);
442
destroyVideoSuiteTestWindow(window);
444
return TEST_COMPLETED;
448
static void checkInvalidWindowError(void)
450
const char *invalidWindowError = "Invalid window";
451
const char *lastError;
453
lastError = SDL_GetError();
454
SDLTest_AssertPass("SDL_GetError()");
455
SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
456
if (lastError != NULL) {
457
SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
458
"SDL_GetError(): expected message '%s', was message: '%s'",
462
SDLTest_AssertPass("Call to SDL_ClearError()");
471
static int video_getWindowDisplayModeNegative(void *arg)
473
const SDL_DisplayMode *mode;
476
mode = SDL_GetWindowFullscreenMode(NULL);
477
SDLTest_AssertPass("Call to SDL_GetWindowFullscreenMode(window=NULL)");
478
SDLTest_AssertCheck(mode == NULL, "Validate result value; expected: NULL, got: %p", mode);
479
checkInvalidWindowError();
481
return TEST_COMPLETED;
485
static void setAndCheckWindowMouseGrabState(SDL_Window *window, SDL_bool desiredState)
487
SDL_bool currentState;
490
SDL_SetWindowMouseGrab(window, desiredState);
491
SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
494
currentState = SDL_GetWindowMouseGrab(window);
495
SDLTest_AssertPass("Call to SDL_GetWindowMouseGrab()");
497
currentState == desiredState,
498
"Validate returned state; expected: %s, got: %s",
499
(desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
500
(currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
504
SDL_GetGrabbedWindow() == window,
505
"Grabbed window should be to our window");
507
SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_GRABBED,
508
"SDL_WINDOW_MOUSE_GRABBED should be set");
511
!(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_GRABBED),
512
"SDL_WINDOW_MOUSE_GRABBED should be unset");
517
static void setAndCheckWindowKeyboardGrabState(SDL_Window *window, SDL_bool desiredState)
519
SDL_bool currentState;
522
SDL_SetWindowKeyboardGrab(window, desiredState);
523
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
526
currentState = SDL_GetWindowKeyboardGrab(window);
527
SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab()");
529
currentState == desiredState,
530
"Validate returned state; expected: %s, got: %s",
531
(desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
532
(currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
536
SDL_GetGrabbedWindow() == window,
537
"Grabbed window should be set to our window");
539
SDL_GetWindowFlags(window) & SDL_WINDOW_KEYBOARD_GRABBED,
540
"SDL_WINDOW_KEYBOARD_GRABBED should be set");
543
!(SDL_GetWindowFlags(window) & SDL_WINDOW_KEYBOARD_GRABBED),
544
"SDL_WINDOW_KEYBOARD_GRABBED should be unset");
556
static int video_getSetWindowGrab(void *arg)
558
const char *title = "video_getSetWindowGrab Test Window";
560
SDL_bool originalMouseState, originalKeyboardState;
561
SDL_bool hasFocusGained = SDL_FALSE;
564
window = createVideoSuiteTestWindow(title);
572
SDL_RaiseWindow(window);
574
if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_INPUT_FOCUS)) {
578
while (!hasFocusGained && count++ < 3) {
579
while (SDL_PollEvent(&evt)) {
580
if (evt.type == SDL_EVENT_WINDOW_FOCUS_GAINED) {
581
hasFocusGained = SDL_TRUE;
586
hasFocusGained = SDL_TRUE;
589
SDLTest_AssertCheck(hasFocusGained == SDL_TRUE, "Expectded window with focus");
592
originalMouseState = SDL_GetWindowMouseGrab(window);
593
SDLTest_AssertPass("Call to SDL_GetWindowMouseGrab()");
594
originalKeyboardState = SDL_GetWindowKeyboardGrab(window);
595
SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab()");
598
setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
599
setAndCheckWindowMouseGrabState(window, SDL_FALSE);
600
SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
601
"Expected NULL grabbed window");
604
setAndCheckWindowMouseGrabState(window, SDL_FALSE);
605
setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
606
SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
607
"Expected NULL grabbed window");
610
setAndCheckWindowMouseGrabState(window, SDL_TRUE);
611
setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
614
setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
615
setAndCheckWindowMouseGrabState(window, SDL_TRUE);
619
setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
620
setAndCheckWindowMouseGrabState(window, SDL_FALSE);
624
setAndCheckWindowMouseGrabState(window, SDL_TRUE);
625
setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
629
setAndCheckWindowMouseGrabState(window, SDL_FALSE);
630
setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
631
SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
632
"Expected NULL grabbed window");
635
SDL_GetWindowMouseGrab(NULL);
636
SDLTest_AssertPass("Call to SDL_GetWindowMouseGrab(window=NULL)");
637
checkInvalidWindowError();
639
SDL_GetWindowKeyboardGrab(NULL);
640
SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab(window=NULL)");
641
checkInvalidWindowError();
643
SDL_SetWindowMouseGrab(NULL, SDL_FALSE);
644
SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(window=NULL,SDL_FALSE)");
645
checkInvalidWindowError();
647
SDL_SetWindowKeyboardGrab(NULL, SDL_FALSE);
648
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(window=NULL,SDL_FALSE)");
649
checkInvalidWindowError();
651
SDL_SetWindowMouseGrab(NULL, SDL_TRUE);
652
SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(window=NULL,SDL_TRUE)");
653
checkInvalidWindowError();
655
SDL_SetWindowKeyboardGrab(NULL, SDL_TRUE);
656
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(window=NULL,SDL_TRUE)");
657
checkInvalidWindowError();
660
setAndCheckWindowMouseGrabState(window, originalMouseState);
661
setAndCheckWindowKeyboardGrabState(window, originalKeyboardState);
664
destroyVideoSuiteTestWindow(window);
666
return TEST_COMPLETED;
675
static int video_getWindowId(void *arg)
677
const char *title = "video_getWindowId Test Window";
683
window = createVideoSuiteTestWindow(title);
689
id = SDL_GetWindowID(window);
690
SDLTest_AssertPass("Call to SDL_GetWindowID()");
693
result = SDL_GetWindowFromID(id);
694
SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 ")", id);
695
SDLTest_AssertCheck(result == window, "Verify result matches window pointer");
698
randomId = SDLTest_RandomIntegerInRange(UINT8_MAX, UINT16_MAX);
699
result = SDL_GetWindowFromID(randomId);
700
SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 "/random_large)", randomId);
703
result = SDL_GetWindowFromID(0);
704
SDLTest_AssertPass("Call to SDL_GetWindowID(0)");
705
result = SDL_GetWindowFromID(UINT32_MAX);
706
SDLTest_AssertPass("Call to SDL_GetWindowID(UINT32_MAX)");
709
destroyVideoSuiteTestWindow(window);
712
result = SDL_GetWindowFromID(id);
713
SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 "/closed_window)", id);
714
SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
718
SDLTest_AssertPass("Call to SDL_ClearError()");
719
id = SDL_GetWindowID(NULL);
720
SDLTest_AssertPass("Call to SDL_GetWindowID(window=NULL)");
721
checkInvalidWindowError();
723
return TEST_COMPLETED;
731
static int video_getWindowPixelFormat(void *arg)
733
const char *title = "video_getWindowPixelFormat Test Window";
735
SDL_PixelFormat format;
738
window = createVideoSuiteTestWindow(title);
744
format = SDL_GetWindowPixelFormat(window);
745
SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat()");
746
SDLTest_AssertCheck(format != SDL_PIXELFORMAT_UNKNOWN, "Verify that returned format is valid; expected: != SDL_PIXELFORMAT_UNKNOWN, got: SDL_PIXELFORMAT_UNKNOWN");
749
destroyVideoSuiteTestWindow(window);
753
SDLTest_AssertPass("Call to SDL_ClearError()");
754
format = SDL_GetWindowPixelFormat(NULL);
755
SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat(window=NULL)");
756
checkInvalidWindowError();
758
return TEST_COMPLETED;
762
static SDL_bool getPositionFromEvent(int *x, int *y)
764
SDL_bool ret = SDL_FALSE;
767
while (SDL_PollEvent(&evt)) {
768
if (evt.type == SDL_EVENT_WINDOW_MOVED) {
769
*x = evt.window.data1;
770
*y = evt.window.data2;
777
static SDL_bool getSizeFromEvent(int *w, int *h)
779
SDL_bool ret = SDL_FALSE;
782
while (SDL_PollEvent(&evt)) {
783
if (evt.type == SDL_EVENT_WINDOW_RESIZED) {
784
*w = evt.window.data1;
785
*h = evt.window.data2;
798
static int video_getSetWindowPosition(void *arg)
800
const char *title = "video_getSetWindowPosition Test Window";
803
int maxxVariation, maxyVariation;
804
int xVariation, yVariation;
805
int referenceX, referenceY;
806
int currentX, currentY;
807
int desiredX, desiredY;
808
SDL_Rect display_bounds;
811
window = createVideoSuiteTestWindow(title);
817
SDL_GetWindowPosition(window, ¤tX, ¤tY);
818
if (SDL_SetWindowPosition(window, currentX, currentY) < 0) {
819
SDLTest_Log("Skipping window positioning tests: %s reports window positioning as unsupported", SDL_GetCurrentVideoDriver());
823
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) {
831
SDL_GetDisplayUsableBounds(SDL_GetPrimaryDisplay(), &display_bounds);
832
} else if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "cocoa") == 0) {
837
SDL_GetDisplayUsableBounds(SDL_GetPrimaryDisplay(), &display_bounds);
843
SDL_GetDisplayBounds(SDL_GetPrimaryDisplay(), &display_bounds);
846
for (xVariation = 0; xVariation < maxxVariation; xVariation++) {
847
for (yVariation = 0; yVariation < maxyVariation; yVariation++) {
848
switch (xVariation) {
852
desiredX = display_bounds.x > 0 ? display_bounds.x : 0;
856
desiredX = SDLTest_RandomIntegerInRange(display_bounds.x + 1, display_bounds.x + 100);
860
desiredX = SDLTest_RandomIntegerInRange(10000, 11000);
864
desiredX = SDLTest_RandomIntegerInRange(-1000, -100);
868
switch (yVariation) {
872
desiredY = display_bounds.y > 0 ? display_bounds.y : 0;
876
desiredY = SDLTest_RandomIntegerInRange(display_bounds.y + 1, display_bounds.y + 100);
880
desiredY = SDLTest_RandomIntegerInRange(10000, 11000);
884
desiredY = SDLTest_RandomIntegerInRange(-1000, -100);
889
SDL_SetWindowPosition(window, desiredX, desiredY);
890
SDLTest_AssertPass("Call to SDL_SetWindowPosition(...,%d,%d)", desiredX, desiredY);
892
result = SDL_SyncWindow(window);
893
SDLTest_AssertPass("SDL_SyncWindow()");
894
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
897
currentX = desiredX + 1;
898
currentY = desiredY + 1;
899
SDL_GetWindowPosition(window, ¤tX, ¤tY);
900
SDLTest_AssertPass("Call to SDL_GetWindowPosition()");
902
if (desiredX == currentX && desiredY == currentY) {
903
SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position; expected: %d, got: %d", desiredX, currentX);
904
SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position; expected: %d, got: %d", desiredY, currentY);
909
currentX = desiredX + 1;
910
currentY = desiredY + 1;
911
hasEvent = getPositionFromEvent(¤tX, ¤tY);
912
SDLTest_AssertCheck(hasEvent == SDL_TRUE, "Changing position was not honored by WM, checking present of SDL_EVENT_WINDOW_MOVED");
914
SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position is the position from SDL event; expected: %d, got: %d", desiredX, currentX);
915
SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position is the position from SDL event; expected: %d, got: %d", desiredY, currentY);
920
currentX = desiredX + 1;
921
SDL_GetWindowPosition(window, ¤tX, NULL);
922
SDLTest_AssertPass("Call to SDL_GetWindowPosition(&y=NULL)");
923
SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position; expected: %d, got: %d", desiredX, currentX);
926
currentY = desiredY + 1;
927
SDL_GetWindowPosition(window, NULL, ¤tY);
928
SDLTest_AssertPass("Call to SDL_GetWindowPosition(&x=NULL)");
929
SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position; expected: %d, got: %d", desiredY, currentY);
936
SDL_GetWindowPosition(window, NULL, NULL);
937
SDLTest_AssertPass("Call to SDL_GetWindowPosition(&x=NULL,&y=NULL)");
940
destroyVideoSuiteTestWindow(window);
943
referenceX = SDLTest_RandomSint32();
944
referenceY = SDLTest_RandomSint32();
945
currentX = referenceX;
946
currentY = referenceY;
947
desiredX = SDLTest_RandomSint32();
948
desiredY = SDLTest_RandomSint32();
952
SDLTest_AssertPass("Call to SDL_ClearError()");
953
SDL_GetWindowPosition(NULL, ¤tX, ¤tY);
954
SDLTest_AssertPass("Call to SDL_GetWindowPosition(window=NULL)");
956
currentX == referenceX && currentY == referenceY,
957
"Verify that content of X and Y pointers has not been modified; expected: %d,%d; got: %d,%d",
958
referenceX, referenceY,
960
checkInvalidWindowError();
962
SDL_GetWindowPosition(NULL, NULL, NULL);
963
SDLTest_AssertPass("Call to SDL_GetWindowPosition(NULL, NULL, NULL)");
964
checkInvalidWindowError();
966
SDL_SetWindowPosition(NULL, desiredX, desiredY);
967
SDLTest_AssertPass("Call to SDL_SetWindowPosition(window=NULL)");
968
checkInvalidWindowError();
970
return TEST_COMPLETED;
974
static void checkInvalidParameterError(void)
976
const char *invalidParameterError = "Parameter";
977
const char *lastError;
979
lastError = SDL_GetError();
980
SDLTest_AssertPass("SDL_GetError()");
981
SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
982
if (lastError != NULL) {
983
SDLTest_AssertCheck(SDL_strncmp(lastError, invalidParameterError, SDL_strlen(invalidParameterError)) == 0,
984
"SDL_GetError(): expected message starts with '%s', was message: '%s'",
985
invalidParameterError,
988
SDLTest_AssertPass("Call to SDL_ClearError()");
998
static int video_getSetWindowSize(void *arg)
1000
const char *title = "video_getSetWindowSize Test Window";
1004
int maxwVariation, maxhVariation;
1005
int wVariation, hVariation;
1006
int referenceW, referenceH;
1007
int currentW, currentH;
1008
int desiredW, desiredH;
1009
const SDL_bool restoreHint = SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", SDL_TRUE);
1012
SDL_SetHint("SDL_BORDERLESS_RESIZABLE_STYLE", "1");
1015
result = SDL_GetDisplayUsableBounds(SDL_GetPrimaryDisplay(), &display);
1016
SDLTest_AssertPass("SDL_GetDisplayBounds()");
1017
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1019
return TEST_ABORTED;
1023
window = createVideoSuiteTestWindow(title);
1025
return TEST_ABORTED;
1028
SDL_GetWindowSize(window, ¤tW, ¤tH);
1029
if (SDL_SetWindowSize(window, currentW, currentH)) {
1030
SDLTest_Log("Skipping window resize tests: %s reports window resizing as unsupported", SDL_GetCurrentVideoDriver());
1034
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "windows") == 0 ||
1035
SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) {
1045
for (wVariation = 0; wVariation < maxwVariation; wVariation++) {
1046
for (hVariation = 0; hVariation < maxhVariation; hVariation++) {
1047
switch (wVariation) {
1055
desiredW = SDLTest_RandomIntegerInRange(1, 100);
1059
desiredW = display.w - 1;
1063
desiredW = display.w;
1067
desiredW = display.w + 1;
1071
switch (hVariation) {
1079
desiredH = SDLTest_RandomIntegerInRange(1, 100);
1083
desiredH = display.h - 1;
1087
desiredH = display.h;
1091
desiredH = display.h + 1;
1096
SDL_SetWindowSize(window, desiredW, desiredH);
1097
SDLTest_AssertPass("Call to SDL_SetWindowSize(...,%d,%d)", desiredW, desiredH);
1099
result = SDL_SyncWindow(window);
1100
SDLTest_AssertPass("SDL_SyncWindow()");
1101
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1104
currentW = desiredW + 1;
1105
currentH = desiredH + 1;
1106
SDL_GetWindowSize(window, ¤tW, ¤tH);
1107
SDLTest_AssertPass("Call to SDL_GetWindowSize()");
1109
if (desiredW == currentW && desiredH == currentH) {
1110
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
1111
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
1116
currentW = desiredW + 1;
1117
currentH = desiredH + 1;
1118
hasEvent = getSizeFromEvent(¤tW, ¤tH);
1119
SDLTest_AssertCheck(hasEvent == SDL_TRUE, "Changing size was not honored by WM, checking presence of SDL_EVENT_WINDOW_RESIZED");
1121
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width is the one from SDL event; expected: %d, got: %d", desiredW, currentW);
1122
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height is the one from SDL event; expected: %d, got: %d", desiredH, currentH);
1128
currentW = desiredW + 1;
1129
SDL_GetWindowSize(window, ¤tW, NULL);
1130
SDLTest_AssertPass("Call to SDL_GetWindowSize(&h=NULL)");
1131
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
1134
currentH = desiredH + 1;
1135
SDL_GetWindowSize(window, NULL, ¤tH);
1136
SDLTest_AssertPass("Call to SDL_GetWindowSize(&w=NULL)");
1137
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
1144
SDL_GetWindowSize(window, NULL, NULL);
1145
SDLTest_AssertPass("Call to SDL_GetWindowSize(&w=NULL,&h=NULL)");
1149
SDLTest_AssertPass("Call to SDL_ClearError()");
1150
for (desiredH = -2; desiredH < 2; desiredH++) {
1151
for (desiredW = -2; desiredW < 2; desiredW++) {
1152
if (desiredW <= 0 || desiredH <= 0) {
1153
SDL_SetWindowSize(window, desiredW, desiredH);
1154
SDLTest_AssertPass("Call to SDL_SetWindowSize(...,%d,%d)", desiredW, desiredH);
1155
checkInvalidParameterError();
1161
destroyVideoSuiteTestWindow(window);
1164
referenceW = SDLTest_RandomSint32();
1165
referenceH = SDLTest_RandomSint32();
1166
currentW = referenceW;
1167
currentH = referenceH;
1168
desiredW = SDLTest_RandomSint32();
1169
desiredH = SDLTest_RandomSint32();
1173
SDLTest_AssertPass("Call to SDL_ClearError()");
1174
SDL_GetWindowSize(NULL, ¤tW, ¤tH);
1175
SDLTest_AssertPass("Call to SDL_GetWindowSize(window=NULL)");
1176
SDLTest_AssertCheck(
1177
currentW == referenceW && currentH == referenceH,
1178
"Verify that content of W and H pointers has not been modified; expected: %d,%d; got: %d,%d",
1179
referenceW, referenceH,
1180
currentW, currentH);
1181
checkInvalidWindowError();
1183
SDL_GetWindowSize(NULL, NULL, NULL);
1184
SDLTest_AssertPass("Call to SDL_GetWindowSize(NULL, NULL, NULL)");
1185
checkInvalidWindowError();
1187
SDL_SetWindowSize(NULL, desiredW, desiredH);
1188
SDLTest_AssertPass("Call to SDL_SetWindowSize(window=NULL)");
1189
checkInvalidWindowError();
1192
SDL_SetHint("SDL_BORDERLESS_RESIZABLE_STYLE", restoreHint ? "1" : "0");
1194
return TEST_COMPLETED;
1201
static int video_getSetWindowMinimumSize(void *arg)
1203
const char *title = "video_getSetWindowMinimumSize Test Window";
1207
int wVariation, hVariation;
1208
int referenceW, referenceH;
1209
int currentW, currentH;
1214
result = SDL_GetDisplayBounds(SDL_GetPrimaryDisplay(), &display);
1215
SDLTest_AssertPass("SDL_GetDisplayBounds()");
1216
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1218
return TEST_ABORTED;
1222
window = createVideoSuiteTestWindow(title);
1224
return TEST_ABORTED;
1227
for (wVariation = 0; wVariation < 5; wVariation++) {
1228
for (hVariation = 0; hVariation < 5; hVariation++) {
1229
switch (wVariation) {
1236
desiredW = SDLTest_RandomIntegerInRange(2, display.w - 1);
1240
desiredW = display.w;
1244
switch (hVariation) {
1251
desiredH = SDLTest_RandomIntegerInRange(2, display.h - 1);
1255
desiredH = display.h;
1259
desiredH = display.h + 1;
1264
SDL_SetWindowMinimumSize(window, desiredW, desiredH);
1265
SDLTest_AssertPass("Call to SDL_SetWindowMinimumSize(...,%d,%d)", desiredW, desiredH);
1268
currentW = desiredW + 1;
1269
currentH = desiredH + 1;
1270
SDL_GetWindowMinimumSize(window, ¤tW, ¤tH);
1271
SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize()");
1272
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
1273
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
1276
currentW = desiredW + 1;
1277
SDL_GetWindowMinimumSize(window, ¤tW, NULL);
1278
SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize(&h=NULL)");
1279
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentH);
1282
currentH = desiredH + 1;
1283
SDL_GetWindowMinimumSize(window, NULL, ¤tH);
1284
SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize(&w=NULL)");
1285
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredW, currentH);
1290
SDL_GetWindowMinimumSize(window, NULL, NULL);
1291
SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize(&w=NULL,&h=NULL)");
1295
SDLTest_AssertPass("Call to SDL_ClearError()");
1296
for (desiredH = -2; desiredH < 2; desiredH++) {
1297
for (desiredW = -2; desiredW < 2; desiredW++) {
1298
if (desiredW < 0 || desiredH < 0) {
1299
SDL_SetWindowMinimumSize(window, desiredW, desiredH);
1300
SDLTest_AssertPass("Call to SDL_SetWindowMinimumSize(...,%d,%d)", desiredW, desiredH);
1301
checkInvalidParameterError();
1307
destroyVideoSuiteTestWindow(window);
1310
referenceW = SDLTest_RandomSint32();
1311
referenceH = SDLTest_RandomSint32();
1312
currentW = referenceW;
1313
currentH = referenceH;
1314
desiredW = SDLTest_RandomSint32();
1315
desiredH = SDLTest_RandomSint32();
1319
SDLTest_AssertPass("Call to SDL_ClearError()");
1320
SDL_GetWindowMinimumSize(NULL, ¤tW, ¤tH);
1321
SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize(window=NULL)");
1322
SDLTest_AssertCheck(
1323
currentW == referenceW && currentH == referenceH,
1324
"Verify that content of W and H pointers has not been modified; expected: %d,%d; got: %d,%d",
1325
referenceW, referenceH,
1326
currentW, currentH);
1327
checkInvalidWindowError();
1329
SDL_GetWindowMinimumSize(NULL, NULL, NULL);
1330
SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize(NULL, NULL, NULL)");
1331
checkInvalidWindowError();
1333
SDL_SetWindowMinimumSize(NULL, desiredW, desiredH);
1334
SDLTest_AssertPass("Call to SDL_SetWindowMinimumSize(window=NULL)");
1335
checkInvalidWindowError();
1337
return TEST_COMPLETED;
1344
static int video_getSetWindowMaximumSize(void *arg)
1346
const char *title = "video_getSetWindowMaximumSize Test Window";
1350
int wVariation, hVariation;
1351
int referenceW, referenceH;
1352
int currentW, currentH;
1353
int desiredW = 0, desiredH = 0;
1356
result = SDL_GetDisplayBounds(SDL_GetPrimaryDisplay(), &display);
1357
SDLTest_AssertPass("SDL_GetDisplayBounds()");
1358
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1360
return TEST_ABORTED;
1364
window = createVideoSuiteTestWindow(title);
1366
return TEST_ABORTED;
1369
for (wVariation = 0; wVariation < 3; wVariation++) {
1370
for (hVariation = 0; hVariation < 3; hVariation++) {
1371
switch (wVariation) {
1378
desiredW = SDLTest_RandomIntegerInRange(2, display.w - 1);
1382
desiredW = display.w;
1386
switch (hVariation) {
1393
desiredH = SDLTest_RandomIntegerInRange(2, display.h - 1);
1397
desiredH = display.h;
1402
SDL_SetWindowMaximumSize(window, desiredW, desiredH);
1403
SDLTest_AssertPass("Call to SDL_SetWindowMaximumSize(...,%d,%d)", desiredW, desiredH);
1406
currentW = desiredW + 1;
1407
currentH = desiredH + 1;
1408
SDL_GetWindowMaximumSize(window, ¤tW, ¤tH);
1409
SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize()");
1410
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
1411
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
1414
currentW = desiredW + 1;
1415
SDL_GetWindowMaximumSize(window, ¤tW, NULL);
1416
SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize(&h=NULL)");
1417
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentH);
1420
currentH = desiredH + 1;
1421
SDL_GetWindowMaximumSize(window, NULL, ¤tH);
1422
SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize(&w=NULL)");
1423
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredW, currentH);
1428
SDL_GetWindowMaximumSize(window, NULL, NULL);
1429
SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize(&w=NULL,&h=NULL)");
1433
SDLTest_AssertPass("Call to SDL_ClearError()");
1434
for (desiredH = -2; desiredH < 2; desiredH++) {
1435
for (desiredW = -2; desiredW < 2; desiredW++) {
1436
if (desiredW < 0 || desiredH < 0) {
1437
SDL_SetWindowMaximumSize(window, desiredW, desiredH);
1438
SDLTest_AssertPass("Call to SDL_SetWindowMaximumSize(...,%d,%d)", desiredW, desiredH);
1439
checkInvalidParameterError();
1445
destroyVideoSuiteTestWindow(window);
1448
referenceW = SDLTest_RandomSint32();
1449
referenceH = SDLTest_RandomSint32();
1450
currentW = referenceW;
1451
currentH = referenceH;
1452
desiredW = SDLTest_RandomSint32();
1453
desiredH = SDLTest_RandomSint32();
1457
SDLTest_AssertPass("Call to SDL_ClearError()");
1458
SDL_GetWindowMaximumSize(NULL, ¤tW, ¤tH);
1459
SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize(window=NULL)");
1460
SDLTest_AssertCheck(
1461
currentW == referenceW && currentH == referenceH,
1462
"Verify that content of W and H pointers has not been modified; expected: %d,%d; got: %d,%d",
1463
referenceW, referenceH,
1464
currentW, currentH);
1465
checkInvalidWindowError();
1467
SDL_GetWindowMaximumSize(NULL, NULL, NULL);
1468
SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize(NULL, NULL, NULL)");
1469
checkInvalidWindowError();
1471
SDL_SetWindowMaximumSize(NULL, desiredW, desiredH);
1472
SDLTest_AssertPass("Call to SDL_SetWindowMaximumSize(window=NULL)");
1473
checkInvalidWindowError();
1475
return TEST_COMPLETED;
1484
static int video_getSetWindowData(void *arg)
1486
int returnValue = TEST_COMPLETED;
1487
const char *title = "video_setGetWindowData Test Window";
1489
const char *referenceName = "TestName";
1490
const char *name = "TestName";
1491
const char *referenceName2 = "TestName2";
1492
const char *name2 = "TestName2";
1494
char *referenceUserdata = NULL;
1495
char *userdata = NULL;
1496
char *referenceUserdata2 = NULL;
1497
char *userdata2 = NULL;
1502
window = createVideoSuiteTestWindow(title);
1504
return TEST_ABORTED;
1508
datasize = SDLTest_RandomIntegerInRange(1, 32);
1509
referenceUserdata = SDLTest_RandomAsciiStringOfSize(datasize);
1510
if (!referenceUserdata) {
1511
returnValue = TEST_ABORTED;
1514
userdata = SDL_strdup(referenceUserdata);
1516
returnValue = TEST_ABORTED;
1519
datasize = SDLTest_RandomIntegerInRange(1, 32);
1520
referenceUserdata2 = SDLTest_RandomAsciiStringOfSize(datasize);
1521
if (!referenceUserdata2) {
1522
returnValue = TEST_ABORTED;
1525
userdata2 = SDL_strdup(referenceUserdata2);
1527
returnValue = TEST_ABORTED;
1532
result = (char *)SDL_GetPointerProperty(SDL_GetWindowProperties(window), name, NULL);
1533
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name);
1534
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
1535
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1538
SDL_SetPointerProperty(SDL_GetWindowProperties(window), name, userdata);
1539
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s)", name, userdata);
1540
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1541
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
1544
for (iteration = 1; iteration <= 2; iteration++) {
1545
result = (char *)SDL_GetPointerProperty(SDL_GetWindowProperties(window), name, NULL);
1546
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s) [iteration %d]", name, iteration);
1547
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
1548
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1552
for (iteration = 1; iteration <= 2; iteration++) {
1553
SDL_SetPointerProperty(SDL_GetWindowProperties(window), name, userdata);
1554
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [iteration %d]", name, userdata, iteration);
1555
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1556
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
1560
result = (char *)SDL_GetPointerProperty(SDL_GetWindowProperties(window), name, NULL);
1561
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s) [again]", name);
1562
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
1563
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1566
SDL_SetPointerProperty(SDL_GetWindowProperties(window), name, userdata2);
1567
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [new userdata]", name, userdata2);
1568
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1569
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
1570
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
1573
SDL_SetPointerProperty(SDL_GetWindowProperties(window), name, userdata2);
1574
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [new userdata again]", name, userdata2);
1575
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1576
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
1577
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
1580
result = (char *)SDL_GetPointerProperty(SDL_GetWindowProperties(window), name, NULL);
1581
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name);
1582
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
1583
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1586
SDL_SetPointerProperty(SDL_GetWindowProperties(window), name, NULL);
1587
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,NULL)", name);
1588
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1589
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
1590
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
1593
SDL_SetPointerProperty(SDL_GetWindowProperties(window), name, NULL);
1594
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,NULL) [again]", name);
1595
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1596
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
1597
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
1600
result = (char *)SDL_GetPointerProperty(SDL_GetWindowProperties(window), name, NULL);
1601
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name);
1602
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
1603
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1606
result = (char *)SDL_GetPointerProperty(SDL_GetWindowProperties(window), name2, NULL);
1607
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name2);
1608
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
1609
SDLTest_AssertCheck(SDL_strcmp(referenceName2, name2) == 0, "Validate that name2 was not changed, expected: %s, got: %s", referenceName2, name2);
1612
SDL_SetPointerProperty(SDL_GetWindowProperties(window), name, userdata);
1613
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [again, after clear]", name, userdata);
1614
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1615
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
1618
result = (char *)SDL_GetPointerProperty(SDL_GetWindowProperties(window), name, NULL);
1619
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s) [again, after clear]", name);
1620
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
1621
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
1624
SDL_SetPointerProperty(SDL_GetWindowProperties(window), NULL, userdata);
1625
SDLTest_AssertPass("Call to SDL_SetWindowData(name=NULL)");
1626
checkInvalidParameterError();
1629
SDL_SetPointerProperty(SDL_GetWindowProperties(window), "", userdata);
1630
SDLTest_AssertPass("Call to SDL_SetWindowData(name='')");
1631
checkInvalidParameterError();
1634
SDL_SetPointerProperty(SDL_GetWindowProperties(window), NULL, NULL);
1635
SDLTest_AssertPass("Call to SDL_SetWindowData(name=NULL,userdata=NULL)");
1636
checkInvalidParameterError();
1639
SDL_SetPointerProperty(SDL_GetWindowProperties(window), "", NULL);
1640
SDLTest_AssertPass("Call to SDL_SetWindowData(name='',userdata=NULL)");
1641
checkInvalidParameterError();
1644
result = (char *)SDL_GetPointerProperty(SDL_GetWindowProperties(window), NULL, NULL);
1645
SDLTest_AssertPass("Call to SDL_GetWindowData(name=NULL)");
1646
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
1649
result = (char *)SDL_GetPointerProperty(SDL_GetWindowProperties(window), "", NULL);
1650
SDLTest_AssertPass("Call to SDL_GetWindowData(name='')");
1651
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
1654
destroyVideoSuiteTestWindow(window);
1657
SDL_free(referenceUserdata);
1658
SDL_free(referenceUserdata2);
1660
SDL_free(userdata2);
1676
static int video_setWindowCenteredOnDisplay(void *arg)
1678
SDL_DisplayID *displays;
1680
const char *title = "video_setWindowCenteredOnDisplay Test Window";
1682
int xVariation, yVariation;
1685
SDL_Rect display0, display1;
1686
const char *video_driver = SDL_GetCurrentVideoDriver();
1687
SDL_bool video_driver_is_wayland = SDL_strcmp(video_driver, "wayland") == 0;
1688
SDL_bool video_driver_is_emscripten = SDL_strcmp(video_driver, "emscripten") == 0;
1690
displays = SDL_GetDisplays(&displayNum);
1694
result = SDL_GetDisplayUsableBounds(displays[0 % displayNum], &display0);
1695
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
1696
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1698
return TEST_ABORTED;
1701
result = SDL_GetDisplayUsableBounds(displays[1 % displayNum], &display1);
1702
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
1703
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1705
return TEST_ABORTED;
1708
for (xVariation = 0; xVariation < 2; xVariation++) {
1709
for (yVariation = 0; yVariation < 2; yVariation++) {
1710
int currentX = 0, currentY = 0;
1711
int currentW = 0, currentH = 0;
1712
int expectedX = 0, expectedY = 0;
1714
int expectedDisplay;
1715
SDL_Rect expectedDisplayRect, expectedFullscreenRect;
1716
SDL_PropertiesID props;
1719
expectedDisplay = displays[xVariation % displayNum];
1720
x = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
1721
y = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
1722
w = SDLTest_RandomIntegerInRange(640, 800);
1723
h = SDLTest_RandomIntegerInRange(400, 600);
1724
expectedDisplayRect = (xVariation == 0) ? display0 : display1;
1725
expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2));
1726
expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2));
1728
props = SDL_CreateProperties();
1729
SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, title);
1730
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, x);
1731
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, y);
1732
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, w);
1733
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, h);
1734
SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN, SDL_TRUE);
1735
window = SDL_CreateWindowWithProperties(props);
1736
SDL_DestroyProperties(props);
1737
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
1738
SDLTest_AssertCheck(window != NULL, "Validate that returned window is not NULL");
1741
if (video_driver_is_wayland) {
1742
SDL_Renderer *renderer = SDL_CreateRenderer(window, NULL);
1745
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF);
1746
SDL_RenderClear(renderer);
1747
SDL_RenderPresent(renderer);
1754
SDLTest_Log("Unable to create a renderer, tests may fail under Wayland");
1759
currentDisplay = SDL_GetDisplayForWindow(window);
1760
SDL_GetWindowSize(window, ¤tW, ¤tH);
1761
SDL_GetWindowPosition(window, ¤tX, ¤tY);
1763
if (video_driver_is_wayland) {
1764
SDLTest_Log("Skipping display ID validation: %s driver does not support window positioning", video_driver);
1766
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay);
1768
if (video_driver_is_emscripten) {
1769
SDLTest_Log("Skipping window size validation: %s driver does not support window resizing", video_driver);
1771
SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w);
1772
SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h);
1774
if (video_driver_is_emscripten || video_driver_is_wayland) {
1775
SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver);
1777
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
1778
SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
1782
SDL_SetWindowPosition(window, x, y);
1783
result = SDL_SetWindowFullscreen(window, SDL_TRUE);
1784
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1786
result = SDL_SyncWindow(window);
1787
SDLTest_AssertPass("SDL_SyncWindow()");
1788
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1791
currentDisplay = SDL_GetDisplayForWindow(window);
1792
SDL_GetWindowSize(window, ¤tW, ¤tH);
1793
SDL_GetWindowPosition(window, ¤tX, ¤tY);
1799
result = SDL_GetDisplayBounds(expectedDisplay, &expectedFullscreenRect);
1800
SDLTest_AssertPass("SDL_GetDisplayBounds()");
1801
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1803
if (video_driver_is_wayland) {
1804
SDLTest_Log("Skipping display ID validation: Wayland driver does not support window positioning");
1806
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay);
1809
if (video_driver_is_emscripten) {
1810
SDLTest_Log("Skipping window position validation: %s driver does not support window resizing", video_driver);
1812
SDLTest_AssertCheck(currentW == expectedFullscreenRect.w, "Validate width (current: %d, expected: %d)", currentW, expectedFullscreenRect.w);
1813
SDLTest_AssertCheck(currentH == expectedFullscreenRect.h, "Validate height (current: %d, expected: %d)", currentH, expectedFullscreenRect.h);
1815
if (video_driver_is_emscripten || video_driver_is_wayland) {
1816
SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver);
1818
SDLTest_AssertCheck(currentX == expectedFullscreenRect.x, "Validate x (current: %d, expected: %d)", currentX, expectedFullscreenRect.x);
1819
SDLTest_AssertCheck(currentY == expectedFullscreenRect.y, "Validate y (current: %d, expected: %d)", currentY, expectedFullscreenRect.y);
1823
result = SDL_SetWindowFullscreen(window, SDL_FALSE);
1824
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1826
result = SDL_SyncWindow(window);
1827
SDLTest_AssertPass("SDL_SyncWindow()");
1828
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1831
currentDisplay = SDL_GetDisplayForWindow(window);
1832
SDL_GetWindowSize(window, ¤tW, ¤tH);
1833
SDL_GetWindowPosition(window, ¤tX, ¤tY);
1835
if (video_driver_is_wayland) {
1836
SDLTest_Log("Skipping display ID validation: %s driver does not support window positioning", video_driver);
1838
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay);
1840
if (video_driver_is_emscripten) {
1841
SDLTest_Log("Skipping window position validation: %s driver does not support window resizing", video_driver);
1843
SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w);
1844
SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h);
1846
if (video_driver_is_wayland) {
1847
SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver);
1849
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
1850
SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
1855
expectedDisplay = displays[yVariation % displayNum];
1856
x = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
1857
y = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
1858
expectedDisplayRect = (yVariation == 0) ? display0 : display1;
1859
expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2));
1860
expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2));
1861
SDL_SetWindowPosition(window, x, y);
1863
result = SDL_SyncWindow(window);
1864
SDLTest_AssertPass("SDL_SyncWindow()");
1865
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1867
currentDisplay = SDL_GetDisplayForWindow(window);
1868
SDL_GetWindowSize(window, ¤tW, ¤tH);
1869
SDL_GetWindowPosition(window, ¤tX, ¤tY);
1871
if (video_driver_is_wayland) {
1872
SDLTest_Log("Skipping display ID validation: %s driver does not support window positioning", video_driver);
1874
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay);
1876
if (video_driver_is_emscripten) {
1877
SDLTest_Log("Skipping window position validation: %s driver does not support window resizing", video_driver);
1879
SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w);
1880
SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h);
1882
if (video_driver_is_wayland) {
1883
SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver);
1885
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
1886
SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
1890
destroyVideoSuiteTestWindow(window);
1896
return TEST_COMPLETED;
1908
static int video_getSetWindowState(void *arg)
1910
const char *title = "video_getSetWindowState Test Window";
1914
SDL_WindowFlags flags;
1915
int windowedX, windowedY;
1916
int currentX, currentY;
1917
int desiredX = 0, desiredY = 0;
1918
int windowedW, windowedH;
1919
int currentW, currentH;
1920
int desiredW = 0, desiredH = 0;
1921
SDL_WindowFlags skipFlags = 0;
1922
const SDL_bool restoreHint = SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", SDL_TRUE);
1923
const SDL_bool skipPos = SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0;
1931
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0 || SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) {
1932
const char *desktop = SDL_getenv("XDG_CURRENT_DESKTOP");
1933
if (SDL_strcmp(desktop, "GNOME") != 0 && SDL_strcmp(desktop, "KDE") != 0) {
1934
SDLTest_Log("Skipping test video_getSetWindowState: desktop environment %s not supported", desktop);
1935
return TEST_SKIPPED;
1940
SDL_SetHint("SDL_BORDERLESS_RESIZABLE_STYLE", "1");
1943
window = createVideoSuiteTestWindow(title);
1945
return TEST_ABORTED;
1948
SDL_GetWindowSize(window, &windowedW, &windowedH);
1949
SDLTest_AssertPass("SDL_GetWindowSize()");
1951
SDL_GetWindowPosition(window, &windowedX, &windowedY);
1952
SDLTest_AssertPass("SDL_GetWindowPosition()");
1955
SDLTest_Log("Skipping positioning tests: %s reports window positioning as unsupported", SDL_GetCurrentVideoDriver());
1959
result = SDL_MaximizeWindow(window);
1960
SDLTest_AssertPass("SDL_MaximizeWindow()");
1962
SDLTest_Log("Skipping state transition tests: %s reports window maximizing as unsupported", SDL_GetCurrentVideoDriver());
1963
skipFlags |= SDL_WINDOW_MAXIMIZED;
1966
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1968
result = SDL_SyncWindow(window);
1969
SDLTest_AssertPass("SDL_SyncWindow()");
1970
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1972
flags = SDL_GetWindowFlags(window);
1973
SDLTest_AssertPass("SDL_GetWindowFlags()");
1974
SDLTest_AssertCheck(flags & SDL_WINDOW_MAXIMIZED, "Verify the `SDL_WINDOW_MAXIMIZED` flag is set: %s", (flags & SDL_WINDOW_MAXIMIZED) ? "true" : "false");
1980
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "windows") != 0) {
1981
result = SDL_GetDisplayUsableBounds(SDL_GetDisplayForWindow(window), &display);
1982
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
1983
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
1985
desiredW = display.w;
1986
desiredH = display.h;
1987
currentW = windowedW + 1;
1988
currentH = windowedH + 1;
1989
SDL_GetWindowSize(window, ¤tW, ¤tH);
1990
SDLTest_AssertPass("Call to SDL_GetWindowSize()");
1991
SDLTest_AssertCheck(currentW <= desiredW, "Verify returned width; expected: <= %d, got: %d", desiredW,
1993
SDLTest_AssertCheck(currentH <= desiredH, "Verify returned height; expected: <= %d, got: %d", desiredH,
1998
result = SDL_RestoreWindow(window);
1999
SDLTest_AssertPass("SDL_RestoreWindow()");
2000
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2002
result = SDL_SyncWindow(window);
2003
SDLTest_AssertPass("SDL_SyncWindow()");
2004
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2006
flags = SDL_GetWindowFlags(window);
2007
SDLTest_AssertPass("SDL_GetWindowFlags()");
2008
SDLTest_AssertCheck(!(flags & SDL_WINDOW_MAXIMIZED), "Verify that the `SDL_WINDOW_MAXIMIZED` flag is cleared: %s", !(flags & SDL_WINDOW_MAXIMIZED) ? "true" : "false");
2011
currentX = windowedX + 1;
2012
currentY = windowedY + 1;
2013
SDL_GetWindowPosition(window, ¤tX, ¤tY);
2014
SDLTest_AssertPass("Call to SDL_GetWindowPosition()");
2015
SDLTest_AssertCheck(windowedX == currentX, "Verify returned X coordinate; expected: %d, got: %d", windowedX, currentX);
2016
SDLTest_AssertCheck(windowedY == currentY, "Verify returned Y coordinate; expected: %d, got: %d", windowedY, currentY);
2019
currentW = windowedW + 1;
2020
currentH = windowedH + 1;
2021
SDL_GetWindowSize(window, ¤tW, ¤tH);
2022
SDLTest_AssertPass("Call to SDL_GetWindowSize()");
2023
SDLTest_AssertCheck(windowedW == currentW, "Verify returned width; expected: %d, got: %d", windowedW, currentW);
2024
SDLTest_AssertCheck(windowedH == currentH, "Verify returned height; expected: %d, got: %d", windowedH, currentH);
2027
result = SDL_MaximizeWindow(window);
2028
SDLTest_AssertPass("SDL_MaximizeWindow()");
2029
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2031
result = SDL_RestoreWindow(window);
2032
SDLTest_AssertPass("SDL_RestoreWindow()");
2033
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2035
result = SDL_SyncWindow(window);
2036
SDLTest_AssertPass("SDL_SyncWindow()");
2037
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2039
flags = SDL_GetWindowFlags(window);
2040
SDLTest_AssertPass("SDL_GetWindowFlags()");
2041
SDLTest_AssertCheck(!(flags & SDL_WINDOW_MAXIMIZED), "Verify that the `SDL_WINDOW_MAXIMIZED` flag is cleared: %s", !(flags & SDL_WINDOW_MAXIMIZED) ? "true" : "false");
2045
currentX = windowedX + 1;
2046
currentY = windowedY + 1;
2047
SDL_GetWindowPosition(window, ¤tX, ¤tY);
2048
SDLTest_AssertPass("Call to SDL_GetWindowPosition()");
2049
SDLTest_AssertCheck(windowedX == currentX, "Verify returned X coordinate; expected: %d, got: %d", windowedX, currentX);
2050
SDLTest_AssertCheck(windowedY == currentY, "Verify returned Y coordinate; expected: %d, got: %d", windowedY, currentY);
2053
currentW = windowedW + 1;
2054
currentH = windowedH + 1;
2055
SDL_GetWindowSize(window, ¤tW, ¤tH);
2056
SDLTest_AssertPass("Call to SDL_GetWindowSize()");
2057
SDLTest_AssertCheck(windowedW == currentW, "Verify returned width; expected: %d, got: %d", windowedW, currentW);
2058
SDLTest_AssertCheck(windowedH == currentH, "Verify returned height; expected: %d, got: %d", windowedH, currentH);
2061
result = SDL_MaximizeWindow(window);
2062
SDLTest_AssertPass("SDL_MaximizeWindow()");
2063
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2065
result = SDL_SetWindowFullscreen(window, SDL_TRUE);
2066
SDLTest_AssertPass("SDL_SetWindowFullscreen(SDL_TRUE)");
2067
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2069
result = SDL_SyncWindow(window);
2070
SDLTest_AssertPass("SDL_SyncWindow()");
2071
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2073
flags = SDL_GetWindowFlags(window);
2074
SDLTest_AssertPass("SDL_GetWindowFlags()");
2075
SDLTest_AssertCheck(flags & SDL_WINDOW_FULLSCREEN, "Verify the `SDL_WINDOW_FULLSCREEN` flag is set: %s", (flags & SDL_WINDOW_FULLSCREEN) ? "true" : "false");
2076
SDLTest_AssertCheck(!(flags & SDL_WINDOW_MAXIMIZED), "Verify the `SDL_WINDOW_MAXIMIZED` flag is cleared: %s", !(flags & SDL_WINDOW_MAXIMIZED) ? "true" : "false");
2079
result = SDL_GetDisplayBounds(SDL_GetDisplayForWindow(window), &display);
2080
SDLTest_AssertPass("SDL_GetDisplayBounds()");
2081
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2084
desiredX = display.x;
2085
desiredY = display.y;
2086
currentX = windowedX + 1;
2087
currentY = windowedY + 1;
2088
SDL_GetWindowPosition(window, ¤tX, ¤tY);
2089
SDLTest_AssertPass("Call to SDL_GetWindowPosition()");
2090
SDLTest_AssertCheck(desiredX == currentX, "Verify returned X coordinate; expected: %d, got: %d", desiredX, currentX);
2091
SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y coordinate; expected: %d, got: %d", desiredY, currentY);
2094
desiredW = display.w;
2095
desiredH = display.h;
2096
currentW = windowedW + 1;
2097
currentH = windowedH + 1;
2098
SDL_GetWindowSize(window, ¤tW, ¤tH);
2099
SDLTest_AssertPass("Call to SDL_GetWindowSize()");
2100
SDLTest_AssertCheck(currentW == desiredW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
2101
SDLTest_AssertCheck(currentH == desiredH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
2104
result = SDL_SetWindowFullscreen(window, SDL_FALSE);
2105
SDLTest_AssertPass("SDL_SetWindowFullscreen(SDL_FALSE)");
2106
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2108
result = SDL_RestoreWindow(window);
2109
SDLTest_AssertPass("SDL_RestoreWindow()");
2110
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2112
result = SDL_SyncWindow(window);
2113
SDLTest_AssertPass("SDL_SyncWindow()");
2114
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2116
flags = SDL_GetWindowFlags(window);
2117
SDLTest_AssertPass("SDL_GetWindowFlags()");
2118
SDLTest_AssertCheck(!(flags & SDL_WINDOW_MAXIMIZED), "Verify that the `SDL_WINDOW_MAXIMIZED` flag is cleared: %s", !(flags & SDL_WINDOW_MAXIMIZED) ? "true" : "false");
2122
currentX = windowedX + 1;
2123
currentY = windowedY + 1;
2124
SDL_GetWindowPosition(window, ¤tX, ¤tY);
2125
SDLTest_AssertPass("Call to SDL_GetWindowPosition()");
2126
SDLTest_AssertCheck(windowedX == currentX, "Verify returned X coordinate; expected: %d, got: %d", windowedX, currentX);
2127
SDLTest_AssertCheck(windowedY == currentY, "Verify returned Y coordinate; expected: %d, got: %d", windowedY, currentY);
2130
currentW = windowedW + 1;
2131
currentH = windowedH + 1;
2132
SDL_GetWindowSize(window, ¤tW, ¤tH);
2133
SDLTest_AssertPass("Call to SDL_GetWindowSize()");
2134
SDLTest_AssertCheck(windowedW == currentW, "Verify returned width; expected: %d, got: %d", windowedW, currentW);
2135
SDLTest_AssertCheck(windowedH == currentH, "Verify returned height; expected: %d, got: %d", windowedH, currentH);
2138
result = SDL_MaximizeWindow(window);
2139
SDLTest_AssertPass("SDL_MaximizeWindow()");
2140
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2142
desiredW = windowedW + 10;
2143
desiredH = windowedH + 10;
2144
result = SDL_SetWindowSize(window, desiredW, desiredH);
2145
SDLTest_AssertPass("SDL_SetWindowSize()");
2146
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2149
desiredX = windowedX + 10;
2150
desiredY = windowedY + 10;
2151
result = SDL_SetWindowPosition(window, desiredX, desiredY);
2152
SDLTest_AssertPass("SDL_SetWindowPosition()");
2153
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2156
result = SDL_RestoreWindow(window);
2157
SDLTest_AssertPass("SDL_RestoreWindow()");
2158
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2160
result = SDL_SyncWindow(window);
2161
SDLTest_AssertPass("SDL_SyncWindow()");
2162
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2164
flags = SDL_GetWindowFlags(window);
2165
SDLTest_AssertPass("SDL_GetWindowFlags()");
2166
SDLTest_AssertCheck(!(flags & SDL_WINDOW_MAXIMIZED), "Verify that the `SDL_WINDOW_MAXIMIZED` flag is cleared: %s", !(flags & SDL_WINDOW_MAXIMIZED) ? "true" : "false");
2169
currentX = desiredX + 1;
2170
currentY = desiredY + 1;
2171
SDL_GetWindowPosition(window, ¤tX, ¤tY);
2172
SDLTest_AssertPass("Call to SDL_GetWindowPosition()");
2173
SDLTest_AssertCheck(desiredX == currentX, "Verify returned X coordinate; expected: %d, got: %d", desiredX, currentX);
2174
SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y coordinate; expected: %d, got: %d", desiredY, currentY);
2177
currentW = desiredW + 1;
2178
currentH = desiredH + 1;
2179
SDL_GetWindowSize(window, ¤tW, ¤tH);
2180
SDLTest_AssertPass("Call to SDL_GetWindowSize()");
2181
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
2182
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
2185
desiredW = windowedW - 5;
2186
desiredH = windowedH - 5;
2187
result = SDL_SetWindowSize(window, desiredW, desiredH);
2188
SDLTest_AssertPass("SDL_SetWindowSize()");
2189
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2192
desiredX = windowedX + 5;
2193
desiredY = windowedY + 5;
2194
result = SDL_SetWindowPosition(window, desiredX, desiredY);
2195
SDLTest_AssertPass("SDL_SetWindowPosition()");
2196
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2199
result = SDL_MaximizeWindow(window);
2200
SDLTest_AssertPass("SDL_MaximizeWindow()");
2201
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2203
result = SDL_RestoreWindow(window);
2204
SDLTest_AssertPass("SDL_RestoreWindow()");
2205
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2207
result = SDL_SyncWindow(window);
2208
SDLTest_AssertPass("SDL_SyncWindow()");
2209
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2211
flags = SDL_GetWindowFlags(window);
2212
SDLTest_AssertPass("SDL_GetWindowFlags()");
2213
SDLTest_AssertCheck(!(flags & SDL_WINDOW_MAXIMIZED), "Verify that the `SDL_WINDOW_MAXIMIZED` flag is cleared: %s", !(flags & SDL_WINDOW_MAXIMIZED) ? "true" : "false");
2216
currentX = desiredX + 1;
2217
currentY = desiredY + 1;
2218
SDL_GetWindowPosition(window, ¤tX, ¤tY);
2219
SDLTest_AssertPass("Call to SDL_GetWindowPosition()");
2220
SDLTest_AssertCheck(desiredX == currentX, "Verify returned X coordinate; expected: %d, got: %d", desiredX, currentX);
2221
SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y coordinate; expected: %d, got: %d", desiredY, currentY);
2224
currentW = desiredW + 1;
2225
currentH = desiredH + 1;
2226
SDL_GetWindowSize(window, ¤tW, ¤tH);
2227
SDLTest_AssertPass("Call to SDL_GetWindowSize()");
2228
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
2229
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
2234
result = SDL_MinimizeWindow(window);
2236
SDLTest_AssertPass("SDL_MinimizeWindow()");
2237
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2239
result = SDL_SyncWindow(window);
2240
SDLTest_AssertPass("SDL_SyncWindow()");
2241
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2243
flags = SDL_GetWindowFlags(window);
2244
SDLTest_AssertPass("SDL_GetWindowFlags()");
2245
SDLTest_AssertCheck(flags & SDL_WINDOW_MINIMIZED, "Verify that the `SDL_WINDOW_MINIMIZED` flag is set: %s", (flags & SDL_WINDOW_MINIMIZED) ? "true" : "false");
2247
SDLTest_Log("Skipping minimize test: %s reports window minimizing as unsupported", SDL_GetCurrentVideoDriver());
2248
skipFlags |= SDL_WINDOW_MINIMIZED;
2252
destroyVideoSuiteTestWindow(window);
2255
SDL_SetHint("SDL_BORDERLESS_RESIZABLE_STYLE", restoreHint ? "1" : "0");
2257
return skipFlags != (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED) ? TEST_COMPLETED : TEST_SKIPPED;
2260
static int video_createMinimized(void *arg)
2262
const char *title = "video_createMinimized Test Window";
2265
int windowedX, windowedY;
2266
int windowedW, windowedH;
2269
window = SDL_CreateWindow(title, 320, 200, SDL_WINDOW_MINIMIZED);
2271
return TEST_ABORTED;
2274
SDL_GetWindowSize(window, &windowedW, &windowedH);
2275
SDLTest_AssertPass("SDL_GetWindowSize()");
2276
SDLTest_AssertCheck(windowedW > 0 && windowedH > 0, "Verify return value; expected: 320x200, got: %dx%d", windowedW, windowedH);
2278
SDL_GetWindowSizeInPixels(window, &windowedW, &windowedH);
2279
SDLTest_AssertPass("SDL_GetWindowSizeInPixels()");
2280
SDLTest_AssertCheck(windowedW > 0 && windowedH > 0, "Verify return value; expected: > 0, got: %dx%d", windowedW, windowedH);
2282
SDL_GetWindowPosition(window, &windowedX, &windowedY);
2283
SDLTest_AssertPass("SDL_GetWindowPosition()");
2284
SDLTest_AssertCheck(windowedX >= 0 && windowedY >= 0, "Verify return value; expected: >= 0, got: %d,%d", windowedX, windowedY);
2286
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED) {
2287
result = SDL_RestoreWindow(window);
2288
SDLTest_AssertPass("SDL_RestoreWindow()");
2289
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2291
SDLTest_Log("Requested minimized window on creation, but that isn't supported on this platform.");
2294
SDL_DestroyWindow(window);
2296
return TEST_COMPLETED;
2299
static int video_createMaximized(void *arg)
2301
const char *title = "video_createMaximized Test Window";
2304
int windowedX, windowedY;
2305
int windowedW, windowedH;
2308
window = SDL_CreateWindow(title, 320, 200, SDL_WINDOW_MAXIMIZED);
2310
return TEST_ABORTED;
2313
SDL_GetWindowSize(window, &windowedW, &windowedH);
2314
SDLTest_AssertPass("SDL_GetWindowSize()");
2315
SDLTest_AssertCheck(windowedW > 0 && windowedH > 0, "Verify return value; expected: 320x200, got: %dx%d", windowedW, windowedH);
2317
SDL_GetWindowSizeInPixels(window, &windowedW, &windowedH);
2318
SDLTest_AssertPass("SDL_GetWindowSizeInPixels()");
2319
SDLTest_AssertCheck(windowedW > 0 && windowedH > 0, "Verify return value; expected: > 0, got: %dx%d", windowedW, windowedH);
2321
SDL_GetWindowPosition(window, &windowedX, &windowedY);
2322
SDLTest_AssertPass("SDL_GetWindowPosition()");
2323
SDLTest_AssertCheck(windowedX >= 0 && windowedY >= 0, "Verify return value; expected: >= 0, got: %d,%d", windowedX, windowedY);
2325
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MAXIMIZED) {
2326
result = SDL_RestoreWindow(window);
2327
SDLTest_AssertPass("SDL_RestoreWindow()");
2328
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2330
SDLTest_Log("Requested maximized window on creation, but that isn't supported on this platform.");
2333
SDL_DestroyWindow(window);
2335
return TEST_COMPLETED;
2341
static int video_getWindowSurface(void *arg)
2343
const char *title = "video_getWindowSurface Test Window";
2345
SDL_Surface *surface;
2346
SDL_Renderer *renderer;
2347
const char *renderer_name = NULL;
2350
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "dummy") == 0) {
2351
renderer_name = SDL_SOFTWARE_RENDERER;
2355
SDL_SetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION, "1");
2357
window = SDL_CreateWindow(title, 320, 320, 0);
2358
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',320,320,0)");
2359
SDLTest_AssertCheck(window != NULL, "Validate that returned window is not NULL");
2361
surface = SDL_GetWindowSurface(window);
2362
SDLTest_AssertPass("Call to SDL_GetWindowSurface(window)");
2363
SDLTest_AssertCheck(surface != NULL, "Validate that returned surface is not NULL");
2364
SDLTest_AssertCheck(SDL_WindowHasSurface(window), "Validate that window has a surface");
2366
result = SDL_UpdateWindowSurface(window);
2367
SDLTest_AssertPass("Call to SDL_UpdateWindowSurface(window)");
2368
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2371
renderer = SDL_CreateRenderer(window, renderer_name);
2372
SDLTest_AssertPass("Call to SDL_CreateRenderer(window, %s)", renderer_name);
2373
SDLTest_AssertCheck(renderer == NULL, "Validate that returned renderer is NULL");
2375
result = SDL_DestroyWindowSurface(window);
2376
SDLTest_AssertPass("Call to SDL_DestroyWindowSurface(window)");
2377
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
2378
SDLTest_AssertCheck(!SDL_WindowHasSurface(window), "Validate that window does not have a surface");
2381
renderer = SDL_CreateRenderer(window, renderer_name);
2382
SDLTest_AssertPass("Call to SDL_CreateRenderer(window, %s)", renderer_name);
2383
SDLTest_AssertCheck(renderer != NULL, "Validate that returned renderer is not NULL");
2386
if (!SDL_WindowHasSurface(window)) {
2387
surface = SDL_GetWindowSurface(window);
2388
SDLTest_AssertPass("Call to SDL_GetWindowSurface(window)");
2389
SDLTest_AssertCheck(surface == NULL, "Validate that returned surface is NULL");
2392
SDL_DestroyRenderer(renderer);
2393
SDLTest_AssertPass("Call to SDL_DestroyRenderer(renderer)");
2394
SDLTest_AssertCheck(!SDL_WindowHasSurface(window), "Validate that window does not have a surface");
2397
surface = SDL_GetWindowSurface(window);
2398
SDLTest_AssertPass("Call to SDL_GetWindowSurface(window)");
2399
SDLTest_AssertCheck(surface != NULL, "Validate that returned surface is not NULL");
2400
SDLTest_AssertCheck(SDL_WindowHasSurface(window), "Validate that window has a surface");
2403
SDL_DestroyWindow(window);
2405
return TEST_COMPLETED;
2411
static const SDLTest_TestCaseReference videoTestEnableDisableScreensaver = {
2412
video_enableDisableScreensaver, "video_enableDisableScreensaver", "Enable and disable screenaver while checking state", TEST_ENABLED
2415
static const SDLTest_TestCaseReference videoTestCreateWindowVariousSizes = {
2416
video_createWindowVariousSizes, "video_createWindowVariousSizes", "Create windows with various sizes", TEST_ENABLED
2419
static const SDLTest_TestCaseReference videoTestCreateWindowVariousFlags = {
2420
video_createWindowVariousFlags, "video_createWindowVariousFlags", "Create windows using various flags", TEST_ENABLED
2423
static const SDLTest_TestCaseReference videoTestGetWindowFlags = {
2424
video_getWindowFlags, "video_getWindowFlags", "Get window flags set during SDL_CreateWindow", TEST_ENABLED
2427
static const SDLTest_TestCaseReference videoTestGetFullscreenDisplayModes = {
2428
video_getFullscreenDisplayModes, "video_getFullscreenDisplayModes", "Use SDL_GetFullscreenDisplayModes function to get number of display modes", TEST_ENABLED
2431
static const SDLTest_TestCaseReference videoTestGetClosestDisplayModeCurrentResolution = {
2432
video_getClosestDisplayModeCurrentResolution, "video_getClosestDisplayModeCurrentResolution", "Use function to get closes match to requested display mode for current resolution", TEST_ENABLED
2435
static const SDLTest_TestCaseReference videoTestGetClosestDisplayModeRandomResolution = {
2436
video_getClosestDisplayModeRandomResolution, "video_getClosestDisplayModeRandomResolution", "Use function to get closes match to requested display mode for random resolution", TEST_ENABLED
2439
static const SDLTest_TestCaseReference videoTestGetWindowDisplayMode = {
2440
video_getWindowDisplayMode, "video_getWindowDisplayMode", "Get window display mode", TEST_ENABLED
2443
static const SDLTest_TestCaseReference videoTestGetWindowDisplayModeNegative = {
2444
video_getWindowDisplayModeNegative, "video_getWindowDisplayModeNegative", "Get window display mode with invalid input", TEST_ENABLED
2447
static const SDLTest_TestCaseReference videoTestGetSetWindowGrab = {
2448
video_getSetWindowGrab, "video_getSetWindowGrab", "Checks input grab positive and negative cases", TEST_ENABLED
2451
static const SDLTest_TestCaseReference videoTestGetWindowID = {
2452
video_getWindowId, "video_getWindowId", "Checks SDL_GetWindowID and SDL_GetWindowFromID", TEST_ENABLED
2455
static const SDLTest_TestCaseReference videoTestGetWindowPixelFormat = {
2456
video_getWindowPixelFormat, "video_getWindowPixelFormat", "Checks SDL_GetWindowPixelFormat", TEST_ENABLED
2459
static const SDLTest_TestCaseReference videoTestGetSetWindowPosition = {
2460
video_getSetWindowPosition, "video_getSetWindowPosition", "Checks SDL_GetWindowPosition and SDL_SetWindowPosition positive and negative cases", TEST_ENABLED
2463
static const SDLTest_TestCaseReference videoTestGetSetWindowSize = {
2464
video_getSetWindowSize, "video_getSetWindowSize", "Checks SDL_GetWindowSize and SDL_SetWindowSize positive and negative cases", TEST_ENABLED
2467
static const SDLTest_TestCaseReference videoTestGetSetWindowMinimumSize = {
2468
video_getSetWindowMinimumSize, "video_getSetWindowMinimumSize", "Checks SDL_GetWindowMinimumSize and SDL_SetWindowMinimumSize positive and negative cases", TEST_ENABLED
2471
static const SDLTest_TestCaseReference videoTestGetSetWindowMaximumSize = {
2472
video_getSetWindowMaximumSize, "video_getSetWindowMaximumSize", "Checks SDL_GetWindowMaximumSize and SDL_SetWindowMaximumSize positive and negative cases", TEST_ENABLED
2475
static const SDLTest_TestCaseReference videoTestGetSetWindowData = {
2476
video_getSetWindowData, "video_getSetWindowData", "Checks SDL_SetWindowData and SDL_GetWindowData positive and negative cases", TEST_ENABLED
2479
static const SDLTest_TestCaseReference videoTestSetWindowCenteredOnDisplay = {
2480
video_setWindowCenteredOnDisplay, "video_setWindowCenteredOnDisplay", "Checks using SDL_WINDOWPOS_CENTERED_DISPLAY centers the window on a display", TEST_ENABLED
2483
static const SDLTest_TestCaseReference videoTestGetSetWindowState = {
2484
video_getSetWindowState, "video_getSetWindowState", "Checks transitioning between windowed, minimized, maximized, and fullscreen states", TEST_ENABLED
2487
static const SDLTest_TestCaseReference videoTestCreateMinimized = {
2488
video_createMinimized, "video_createMinimized", "Checks window state for windows created minimized", TEST_ENABLED
2491
static const SDLTest_TestCaseReference videoTestCreateMaximized = {
2492
video_createMaximized, "video_createMaximized", "Checks window state for windows created maximized", TEST_ENABLED
2495
static const SDLTest_TestCaseReference videoTestGetWindowSurface = {
2496
video_getWindowSurface, "video_getWindowSurface", "Checks window surface functionality", TEST_ENABLED
2500
static const SDLTest_TestCaseReference *videoTests[] = {
2501
&videoTestEnableDisableScreensaver,
2502
&videoTestCreateWindowVariousSizes,
2503
&videoTestCreateWindowVariousFlags,
2504
&videoTestGetWindowFlags,
2505
&videoTestGetFullscreenDisplayModes,
2506
&videoTestGetClosestDisplayModeCurrentResolution,
2507
&videoTestGetClosestDisplayModeRandomResolution,
2508
&videoTestGetWindowDisplayMode,
2509
&videoTestGetWindowDisplayModeNegative,
2510
&videoTestGetSetWindowGrab,
2511
&videoTestGetWindowID,
2512
&videoTestGetWindowPixelFormat,
2513
&videoTestGetSetWindowPosition,
2514
&videoTestGetSetWindowSize,
2515
&videoTestGetSetWindowMinimumSize,
2516
&videoTestGetSetWindowMaximumSize,
2517
&videoTestGetSetWindowData,
2518
&videoTestSetWindowCenteredOnDisplay,
2519
&videoTestGetSetWindowState,
2520
&videoTestCreateMinimized,
2521
&videoTestCreateMaximized,
2522
&videoTestGetWindowSurface,
2527
SDLTest_TestSuiteReference videoTestSuite = {