Removed SDL_bool in favor of plain bool

We require stdbool.h in the build environment, so we might as well use the plain bool type.

If your environment doesn't have stdbool.h, this simple replacement will suffice:
typedef signed char bool;
This commit is contained in:
Sam Lantinga
2024-09-18 07:52:28 -07:00
parent 9dd8859240
commit a90ad3b0e2
258 changed files with 4052 additions and 4057 deletions

View File

@@ -18,8 +18,8 @@ static SDL_Window *createVideoSuiteTestWindow(const char *title)
int w, h;
int count;
SDL_WindowFlags flags;
SDL_bool needs_renderer = SDL_FALSE;
SDL_bool needs_events_pumped = SDL_FALSE;
bool needs_renderer = false;
bool needs_events_pumped = false;
/* Standard window */
w = SDLTest_RandomIntegerInRange(320, 1024);
@@ -40,16 +40,16 @@ static SDL_Window *createVideoSuiteTestWindow(const char *title)
* This is required for the mouse/keyboard grab tests to pass.
*/
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
needs_renderer = SDL_TRUE;
needs_renderer = true;
} else if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) {
/* Try to detect if the x11 driver is running under XWayland */
const char *session_type = SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "XDG_SESSION_TYPE");
if (session_type && SDL_strcasecmp(session_type, "wayland") == 0) {
needs_renderer = SDL_TRUE;
needs_renderer = true;
}
/* X11 needs the initial events pumped, or it can erroneously deliver old configuration events at a later time. */
needs_events_pumped = SDL_TRUE;
needs_events_pumped = true;
}
if (needs_renderer) {
@@ -100,13 +100,13 @@ static void destroyVideoSuiteTestWindow(SDL_Window *window)
*/
static int SDLCALL video_enableDisableScreensaver(void *arg)
{
SDL_bool initialResult;
SDL_bool result;
bool initialResult;
bool result;
/* Get current state and proceed according to current state */
initialResult = SDL_ScreenSaverEnabled();
SDLTest_AssertPass("Call to SDL_ScreenSaverEnabled()");
if (initialResult == SDL_TRUE) {
if (initialResult == true) {
/* Currently enabled: disable first, then enable again */
@@ -115,14 +115,14 @@ static int SDLCALL video_enableDisableScreensaver(void *arg)
SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");
result = SDL_ScreenSaverEnabled();
SDLTest_AssertPass("Call to SDL_ScreenSaverEnabled()");
SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);
SDLTest_AssertCheck(result == false, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", false, result);
/* Enable screensaver and check */
SDL_EnableScreenSaver();
SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
result = SDL_ScreenSaverEnabled();
SDLTest_AssertPass("Call to SDL_ScreenSaverEnabled()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
SDLTest_AssertCheck(result == true, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", true, result);
} else {
@@ -133,14 +133,14 @@ static int SDLCALL video_enableDisableScreensaver(void *arg)
SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
result = SDL_ScreenSaverEnabled();
SDLTest_AssertPass("Call to SDL_ScreenSaverEnabled()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
SDLTest_AssertCheck(result == true, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", true, result);
/* Disable screensaver and check */
SDL_DisableScreenSaver();
SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");
result = SDL_ScreenSaverEnabled();
SDLTest_AssertPass("Call to SDL_ScreenSaverEnabled()");
SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);
SDLTest_AssertCheck(result == false, "Verify result from SDL_ScreenSaverEnabled, expected: %i, got: %i", false, result);
}
return TEST_COMPLETED;
@@ -358,9 +358,9 @@ static int SDLCALL video_getClosestDisplayModeCurrentResolution(void *arg)
SDL_memcpy(&current, modes[0], sizeof(current));
/* Make call */
result = SDL_GetClosestFullscreenDisplayMode(displays[i], current.w, current.h, current.refresh_rate, SDL_FALSE, &closest);
result = SDL_GetClosestFullscreenDisplayMode(displays[i], current.w, current.h, current.refresh_rate, false, &closest);
SDLTest_AssertPass("Call to SDL_GetClosestFullscreenDisplayMode(target=current)");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
/* Check that one gets the current resolution back again */
if (result == 0) {
@@ -409,7 +409,7 @@ static int SDLCALL video_getClosestDisplayModeRandomResolution(void *arg)
target.refresh_rate = (variation & 8) ? (float)SDLTest_RandomIntegerInRange(25, 120) : 0.0f;
/* Make call; may or may not find anything, so don't validate any further */
SDL_GetClosestFullscreenDisplayMode(displays[i], target.w, target.h, target.refresh_rate, SDL_FALSE, &closest);
SDL_GetClosestFullscreenDisplayMode(displays[i], target.w, target.h, target.refresh_rate, false, &closest);
SDLTest_AssertPass("Call to SDL_GetClosestFullscreenDisplayMode(target=random/variation%d)", variation);
}
}
@@ -482,13 +482,13 @@ static int SDLCALL video_getWindowDisplayModeNegative(void *arg)
}
/* Helper for setting and checking the window mouse grab state */
static void setAndCheckWindowMouseGrabState(SDL_Window *window, SDL_bool desiredState)
static void setAndCheckWindowMouseGrabState(SDL_Window *window, bool desiredState)
{
SDL_bool currentState;
bool currentState;
/* Set state */
SDL_SetWindowMouseGrab(window, desiredState);
SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(%s)", (desiredState == false) ? "false" : "true");
/* Get and check state */
currentState = SDL_GetWindowMouseGrab(window);
@@ -496,8 +496,8 @@ static void setAndCheckWindowMouseGrabState(SDL_Window *window, SDL_bool desired
SDLTest_AssertCheck(
currentState == desiredState,
"Validate returned state; expected: %s, got: %s",
(desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
(currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
(desiredState == false) ? "false" : "true",
(currentState == false) ? "false" : "true");
if (desiredState) {
SDLTest_AssertCheck(
@@ -514,13 +514,13 @@ static void setAndCheckWindowMouseGrabState(SDL_Window *window, SDL_bool desired
}
/* Helper for setting and checking the window keyboard grab state */
static void setAndCheckWindowKeyboardGrabState(SDL_Window *window, SDL_bool desiredState)
static void setAndCheckWindowKeyboardGrabState(SDL_Window *window, bool desiredState)
{
SDL_bool currentState;
bool currentState;
/* Set state */
SDL_SetWindowKeyboardGrab(window, desiredState);
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(%s)", (desiredState == false) ? "false" : "true");
/* Get and check state */
currentState = SDL_GetWindowKeyboardGrab(window);
@@ -528,8 +528,8 @@ static void setAndCheckWindowKeyboardGrabState(SDL_Window *window, SDL_bool desi
SDLTest_AssertCheck(
currentState == desiredState,
"Validate returned state; expected: %s, got: %s",
(desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
(currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
(desiredState == false) ? "false" : "true",
(currentState == false) ? "false" : "true");
if (desiredState) {
SDLTest_AssertCheck(
@@ -557,8 +557,8 @@ static int SDLCALL video_getSetWindowGrab(void *arg)
{
const char *title = "video_getSetWindowGrab Test Window";
SDL_Window *window;
SDL_bool originalMouseState, originalKeyboardState;
SDL_bool hasFocusGained = SDL_FALSE;
bool originalMouseState, originalKeyboardState;
bool hasFocusGained = false;
/* Call against new test window */
window = createVideoSuiteTestWindow(title);
@@ -578,15 +578,15 @@ static int SDLCALL video_getSetWindowGrab(void *arg)
while (!hasFocusGained && count++ < 3) {
while (SDL_PollEvent(&evt)) {
if (evt.type == SDL_EVENT_WINDOW_FOCUS_GAINED) {
hasFocusGained = SDL_TRUE;
hasFocusGained = true;
}
}
}
} else {
hasFocusGained = SDL_TRUE;
hasFocusGained = true;
}
SDLTest_AssertCheck(hasFocusGained == SDL_TRUE, "Expectded window with focus");
SDLTest_AssertCheck(hasFocusGained == true, "Expectded window with focus");
/* Get state */
originalMouseState = SDL_GetWindowMouseGrab(window);
@@ -595,39 +595,39 @@ static int SDLCALL video_getSetWindowGrab(void *arg)
SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab()");
/* F */
setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
setAndCheckWindowMouseGrabState(window, SDL_FALSE);
setAndCheckWindowKeyboardGrabState(window, false);
setAndCheckWindowMouseGrabState(window, false);
SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
"Expected NULL grabbed window");
/* F --> F */
setAndCheckWindowMouseGrabState(window, SDL_FALSE);
setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
setAndCheckWindowMouseGrabState(window, false);
setAndCheckWindowKeyboardGrabState(window, false);
SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
"Expected NULL grabbed window");
/* F --> T */
setAndCheckWindowMouseGrabState(window, SDL_TRUE);
setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
setAndCheckWindowMouseGrabState(window, true);
setAndCheckWindowKeyboardGrabState(window, true);
/* T --> T */
setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
setAndCheckWindowMouseGrabState(window, SDL_TRUE);
setAndCheckWindowKeyboardGrabState(window, true);
setAndCheckWindowMouseGrabState(window, true);
/* M: T --> F */
/* K: T --> T */
setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
setAndCheckWindowMouseGrabState(window, SDL_FALSE);
setAndCheckWindowKeyboardGrabState(window, true);
setAndCheckWindowMouseGrabState(window, false);
/* M: F --> T */
/* K: T --> F */
setAndCheckWindowMouseGrabState(window, SDL_TRUE);
setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
setAndCheckWindowMouseGrabState(window, true);
setAndCheckWindowKeyboardGrabState(window, false);
/* M: T --> F */
/* K: F --> F */
setAndCheckWindowMouseGrabState(window, SDL_FALSE);
setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
setAndCheckWindowMouseGrabState(window, false);
setAndCheckWindowKeyboardGrabState(window, false);
SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
"Expected NULL grabbed window");
@@ -640,20 +640,20 @@ static int SDLCALL video_getSetWindowGrab(void *arg)
SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab(window=NULL)");
checkInvalidWindowError();
SDL_SetWindowMouseGrab(NULL, SDL_FALSE);
SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(window=NULL,SDL_FALSE)");
SDL_SetWindowMouseGrab(NULL, false);
SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(window=NULL,false)");
checkInvalidWindowError();
SDL_SetWindowKeyboardGrab(NULL, SDL_FALSE);
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(window=NULL,SDL_FALSE)");
SDL_SetWindowKeyboardGrab(NULL, false);
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(window=NULL,false)");
checkInvalidWindowError();
SDL_SetWindowMouseGrab(NULL, SDL_TRUE);
SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(window=NULL,SDL_TRUE)");
SDL_SetWindowMouseGrab(NULL, true);
SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(window=NULL,true)");
checkInvalidWindowError();
SDL_SetWindowKeyboardGrab(NULL, SDL_TRUE);
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(window=NULL,SDL_TRUE)");
SDL_SetWindowKeyboardGrab(NULL, true);
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(window=NULL,true)");
checkInvalidWindowError();
/* Restore state */
@@ -759,31 +759,31 @@ static int SDLCALL video_getWindowPixelFormat(void *arg)
}
static SDL_bool getPositionFromEvent(int *x, int *y)
static bool getPositionFromEvent(int *x, int *y)
{
SDL_bool ret = SDL_FALSE;
bool ret = false;
SDL_Event evt;
SDL_zero(evt);
while (SDL_PollEvent(&evt)) {
if (evt.type == SDL_EVENT_WINDOW_MOVED) {
*x = evt.window.data1;
*y = evt.window.data2;
ret = SDL_TRUE;
ret = true;
}
}
return ret;
}
static SDL_bool getSizeFromEvent(int *w, int *h)
static bool getSizeFromEvent(int *w, int *h)
{
SDL_bool ret = SDL_FALSE;
bool ret = false;
SDL_Event evt;
SDL_zero(evt);
while (SDL_PollEvent(&evt)) {
if (evt.type == SDL_EVENT_WINDOW_RESIZED) {
*w = evt.window.data1;
*h = evt.window.data2;
ret = SDL_TRUE;
ret = true;
}
}
return ret;
@@ -891,7 +891,7 @@ static int SDLCALL video_getSetWindowPosition(void *arg)
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
/* Get position */
currentX = desiredX + 1;
@@ -903,13 +903,13 @@ static int SDLCALL video_getSetWindowPosition(void *arg)
SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position; expected: %d, got: %d", desiredX, currentX);
SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position; expected: %d, got: %d", desiredY, currentY);
} else {
SDL_bool hasEvent;
bool hasEvent;
/* SDL_SetWindowPosition() and SDL_SetWindowSize() will make requests of the window manager and set the internal position and size,
* and then we get events signaling what actually happened, and they get passed on to the application if they're not what we expect. */
currentX = desiredX + 1;
currentY = desiredY + 1;
hasEvent = getPositionFromEvent(&currentX, &currentY);
SDLTest_AssertCheck(hasEvent == SDL_TRUE, "Changing position was not honored by WM, checking present of SDL_EVENT_WINDOW_MOVED");
SDLTest_AssertCheck(hasEvent == true, "Changing position was not honored by WM, checking present of SDL_EVENT_WINDOW_MOVED");
if (hasEvent) {
SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position is the position from SDL event; expected: %d, got: %d", desiredX, currentX);
SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position is the position from SDL event; expected: %d, got: %d", desiredY, currentY);
@@ -1006,7 +1006,7 @@ static int SDLCALL video_getSetWindowSize(void *arg)
int referenceW, referenceH;
int currentW, currentH;
int desiredW, desiredH;
const SDL_bool restoreHint = SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", SDL_TRUE);
const bool restoreHint = SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", true);
/* Win32 borderless windows are not resizable by default and need this undocumented hint */
SDL_SetHint("SDL_BORDERLESS_RESIZABLE_STYLE", "1");
@@ -1014,7 +1014,7 @@ static int SDLCALL video_getSetWindowSize(void *arg)
/* Get display bounds for size range */
result = SDL_GetDisplayUsableBounds(SDL_GetPrimaryDisplay(), &display);
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
if (!result) {
return TEST_ABORTED;
}
@@ -1098,7 +1098,7 @@ static int SDLCALL video_getSetWindowSize(void *arg)
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
/* Get size */
currentW = desiredW + 1;
@@ -1110,13 +1110,13 @@ static int SDLCALL video_getSetWindowSize(void *arg)
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
} else {
SDL_bool hasEvent;
bool hasEvent;
/* SDL_SetWindowPosition() and SDL_SetWindowSize() will make requests of the window manager and set the internal position and size,
* and then we get events signaling what actually happened, and they get passed on to the application if they're not what we expect. */
currentW = desiredW + 1;
currentH = desiredH + 1;
hasEvent = getSizeFromEvent(&currentW, &currentH);
SDLTest_AssertCheck(hasEvent == SDL_TRUE, "Changing size was not honored by WM, checking presence of SDL_EVENT_WINDOW_RESIZED");
SDLTest_AssertCheck(hasEvent == true, "Changing size was not honored by WM, checking presence of SDL_EVENT_WINDOW_RESIZED");
if (hasEvent) {
SDLTest_AssertCheck(desiredW == currentW, "Verify returned width is the one from SDL event; expected: %d, got: %d", desiredW, currentW);
SDLTest_AssertCheck(desiredH == currentH, "Verify returned height is the one from SDL event; expected: %d, got: %d", desiredH, currentH);
@@ -1213,7 +1213,7 @@ static int SDLCALL video_getSetWindowMinimumSize(void *arg)
/* Get display bounds for size range */
result = SDL_GetDisplayBounds(SDL_GetPrimaryDisplay(), &display);
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
if (!result) {
return TEST_ABORTED;
}
@@ -1355,7 +1355,7 @@ static int SDLCALL video_getSetWindowMaximumSize(void *arg)
/* Get display bounds for size range */
result = SDL_GetDisplayBounds(SDL_GetPrimaryDisplay(), &display);
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
if (!result) {
return TEST_ABORTED;
}
@@ -1684,8 +1684,8 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
int result;
SDL_Rect display0, display1;
const char *video_driver = SDL_GetCurrentVideoDriver();
SDL_bool video_driver_is_wayland = SDL_strcmp(video_driver, "wayland") == 0;
SDL_bool video_driver_is_emscripten = SDL_strcmp(video_driver, "emscripten") == 0;
bool video_driver_is_wayland = SDL_strcmp(video_driver, "wayland") == 0;
bool video_driver_is_emscripten = SDL_strcmp(video_driver, "emscripten") == 0;
displays = SDL_GetDisplays(&displayNum);
if (displays) {
@@ -1693,14 +1693,14 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
/* Get display bounds */
result = SDL_GetDisplayUsableBounds(displays[0 % displayNum], &display0);
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
if (!result) {
return TEST_ABORTED;
}
result = SDL_GetDisplayUsableBounds(displays[1 % displayNum], &display1);
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
if (!result) {
return TEST_ABORTED;
}
@@ -1731,7 +1731,7 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, y);
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, w);
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, h);
SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN, SDL_TRUE);
SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN, true);
window = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props);
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
@@ -1780,12 +1780,12 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
/* Enter fullscreen desktop */
SDL_SetWindowPosition(window, x, y);
result = SDL_SetWindowFullscreen(window, SDL_TRUE);
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
result = SDL_SetWindowFullscreen(window, true);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
/* Check we are filling the full display */
currentDisplay = SDL_GetDisplayForWindow(window);
@@ -1798,7 +1798,7 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
*/
result = SDL_GetDisplayBounds(expectedDisplay, &expectedFullscreenRect);
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
if (video_driver_is_wayland) {
SDLTest_Log("Skipping display ID validation: Wayland driver does not support window positioning");
@@ -1820,12 +1820,12 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
}
/* Leave fullscreen desktop */
result = SDL_SetWindowFullscreen(window, SDL_FALSE);
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
result = SDL_SetWindowFullscreen(window, false);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
/* Check window was restored correctly */
currentDisplay = SDL_GetDisplayForWindow(window);
@@ -1862,7 +1862,7 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
currentDisplay = SDL_GetDisplayForWindow(window);
SDL_GetWindowSize(window, &currentW, &currentH);
@@ -1919,8 +1919,8 @@ static int SDLCALL video_getSetWindowState(void *arg)
int currentW, currentH;
int desiredW = 0, desiredH = 0;
SDL_WindowFlags skipFlags = 0;
const SDL_bool restoreHint = SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", SDL_TRUE);
const SDL_bool skipPos = SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0;
const bool restoreHint = SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", true);
const bool skipPos = SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0;
/* This test is known to be good only on GNOME and KDE. At the time of writing, Weston seems to have maximize related bugs
* that prevent it from running correctly (no configure events are received when unsetting maximize), and tiling window
@@ -1966,7 +1966,7 @@ static int SDLCALL video_getSetWindowState(void *arg)
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
flags = SDL_GetWindowFlags(window);
SDLTest_AssertPass("SDL_GetWindowFlags()");
@@ -1979,7 +1979,7 @@ static int SDLCALL video_getSetWindowState(void *arg)
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "windows") != 0) {
result = SDL_GetDisplayUsableBounds(SDL_GetDisplayForWindow(window), &display);
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
desiredW = display.w;
desiredH = display.h;
@@ -1996,11 +1996,11 @@ static int SDLCALL video_getSetWindowState(void *arg)
/* Restore and check the dimensions */
result = SDL_RestoreWindow(window);
SDLTest_AssertPass("SDL_RestoreWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
flags = SDL_GetWindowFlags(window);
SDLTest_AssertPass("SDL_GetWindowFlags()");
@@ -2025,15 +2025,15 @@ static int SDLCALL video_getSetWindowState(void *arg)
/* Maximize, then immediately restore */
result = SDL_MaximizeWindow(window);
SDLTest_AssertPass("SDL_MaximizeWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_RestoreWindow(window);
SDLTest_AssertPass("SDL_RestoreWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
flags = SDL_GetWindowFlags(window);
SDLTest_AssertPass("SDL_GetWindowFlags()");
@@ -2059,15 +2059,15 @@ static int SDLCALL video_getSetWindowState(void *arg)
/* Maximize, then enter fullscreen */
result = SDL_MaximizeWindow(window);
SDLTest_AssertPass("SDL_MaximizeWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_SetWindowFullscreen(window, SDL_TRUE);
SDLTest_AssertPass("SDL_SetWindowFullscreen(SDL_TRUE)");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
result = SDL_SetWindowFullscreen(window, true);
SDLTest_AssertPass("SDL_SetWindowFullscreen(true)");
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
flags = SDL_GetWindowFlags(window);
SDLTest_AssertPass("SDL_GetWindowFlags()");
@@ -2077,7 +2077,7 @@ static int SDLCALL video_getSetWindowState(void *arg)
/* Verify the fullscreen size and position */
result = SDL_GetDisplayBounds(SDL_GetDisplayForWindow(window), &display);
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
if (!skipPos) {
desiredX = display.x;
@@ -2100,17 +2100,17 @@ static int SDLCALL video_getSetWindowState(void *arg)
SDLTest_AssertCheck(currentH == desiredH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
/* Leave fullscreen and restore the window */
result = SDL_SetWindowFullscreen(window, SDL_FALSE);
SDLTest_AssertPass("SDL_SetWindowFullscreen(SDL_FALSE)");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
result = SDL_SetWindowFullscreen(window, false);
SDLTest_AssertPass("SDL_SetWindowFullscreen(false)");
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_RestoreWindow(window);
SDLTest_AssertPass("SDL_RestoreWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
flags = SDL_GetWindowFlags(window);
SDLTest_AssertPass("SDL_GetWindowFlags()");
@@ -2136,29 +2136,29 @@ static int SDLCALL video_getSetWindowState(void *arg)
/* Maximize, change size, and restore */
result = SDL_MaximizeWindow(window);
SDLTest_AssertPass("SDL_MaximizeWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
desiredW = windowedW + 10;
desiredH = windowedH + 10;
result = SDL_SetWindowSize(window, desiredW, desiredH);
SDLTest_AssertPass("SDL_SetWindowSize()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
if (!skipPos) {
desiredX = windowedX + 10;
desiredY = windowedY + 10;
result = SDL_SetWindowPosition(window, desiredX, desiredY);
SDLTest_AssertPass("SDL_SetWindowPosition()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
}
result = SDL_RestoreWindow(window);
SDLTest_AssertPass("SDL_RestoreWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
flags = SDL_GetWindowFlags(window);
SDLTest_AssertPass("SDL_GetWindowFlags()");
@@ -2185,27 +2185,27 @@ static int SDLCALL video_getSetWindowState(void *arg)
desiredH = windowedH - 5;
result = SDL_SetWindowSize(window, desiredW, desiredH);
SDLTest_AssertPass("SDL_SetWindowSize()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
if (!skipPos) {
desiredX = windowedX + 5;
desiredY = windowedY + 5;
result = SDL_SetWindowPosition(window, desiredX, desiredY);
SDLTest_AssertPass("SDL_SetWindowPosition()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
}
result = SDL_MaximizeWindow(window);
SDLTest_AssertPass("SDL_MaximizeWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_RestoreWindow(window);
SDLTest_AssertPass("SDL_RestoreWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
flags = SDL_GetWindowFlags(window);
SDLTest_AssertPass("SDL_GetWindowFlags()");
@@ -2233,11 +2233,11 @@ minimize_test:
result = SDL_MinimizeWindow(window);
if (result) {
SDLTest_AssertPass("SDL_MinimizeWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
flags = SDL_GetWindowFlags(window);
SDLTest_AssertPass("SDL_GetWindowFlags()");
@@ -2285,7 +2285,7 @@ static int SDLCALL video_createMinimized(void *arg)
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED) {
result = SDL_RestoreWindow(window);
SDLTest_AssertPass("SDL_RestoreWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
} else {
SDLTest_Log("Requested minimized window on creation, but that isn't supported on this platform.");
}
@@ -2324,7 +2324,7 @@ static int SDLCALL video_createMaximized(void *arg)
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MAXIMIZED) {
result = SDL_RestoreWindow(window);
SDLTest_AssertPass("SDL_RestoreWindow()");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
} else {
SDLTest_Log("Requested maximized window on creation, but that isn't supported on this platform.");
}
@@ -2364,7 +2364,7 @@ static int SDLCALL video_getWindowSurface(void *arg)
result = SDL_UpdateWindowSurface(window);
SDLTest_AssertPass("Call to SDL_UpdateWindowSurface(window)");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
/* We shouldn't be able to create a renderer on a window with a surface */
renderer = SDL_CreateRenderer(window, renderer_name);
@@ -2373,7 +2373,7 @@ static int SDLCALL video_getWindowSurface(void *arg)
result = SDL_DestroyWindowSurface(window);
SDLTest_AssertPass("Call to SDL_DestroyWindowSurface(window)");
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
SDLTest_AssertCheck(!SDL_WindowHasSurface(window), "Validate that window does not have a surface");
/* We should be able to create a renderer on the window now */