From 1fb23a0647aee9b19953854001c70219f0881db0 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 1 Apr 2025 01:55:40 +0300
Subject: [PATCH] tests: add explicit notes about sdl2-compat changes
---
test/testautomation_hints.c | 11 +++++++++++
test/testautomation_video.c | 10 ++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/test/testautomation_hints.c b/test/testautomation_hints.c
index ffbd572..7bb400b 100644
--- a/test/testautomation_hints.c
+++ b/test/testautomation_hints.c
@@ -182,6 +182,17 @@ int hints_setHint(void *arg)
"testValue = %s, expected \"original\"",
testValue);
+#if 0 /* Disabled in SDL2-COMPAT. */
+ SDLTest_AssertPass("Call to SDL_SetHint(\"\", \"data\")");
+ result = SDL_SetHint("", "data");
+ SDLTest_AssertCheck(result, "SDL_SetHint(\"\", \"data\") should return true");
+ testValue = SDL_GetHint("");
+ SDLTest_AssertCheck(
+ testValue && SDL_strcmp(testValue, "data") == 0,
+ "testValue = %s, expected \"data\"",
+ testValue);
+#endif
+
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(\"temp\", SDL_HINT_OVERRIDE)");
result = SDL_SetHintWithPriority(testHint, "temp", SDL_HINT_OVERRIDE);
SDLTest_AssertCheck(result, "SDL_SetHintWithPriority(\"%s\", \"temp\", SDL_HINT_OVERRIDE) should return true", testHint);
diff --git a/test/testautomation_video.c b/test/testautomation_video.c
index b3fc25e..583f631 100644
--- a/test/testautomation_video.c
+++ b/test/testautomation_video.c
@@ -2024,14 +2024,14 @@ int video_setWindowCenteredOnDisplay(void *arg)
}
/* Get display bounds */
- result = SDL_GetDisplayUsableBounds(0 % displayNum, &display0);
+ result = SDL_GetDisplayUsableBounds(0 % displayNum, &display0); /* SDL2-COMPAT change -- was SDL_GetDisplayBounds() */
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
if (result != 0) {
return TEST_ABORTED;
}
- result = SDL_GetDisplayUsableBounds(1 % displayNum, &display1);
+ result = SDL_GetDisplayUsableBounds(1 % displayNum, &display1); /* SDL2-COMPAT change -- was SDL_GetDisplayBounds() */
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
if (result != 0) {
@@ -2045,7 +2045,8 @@ int video_setWindowCenteredOnDisplay(void *arg)
int expectedX = 0, expectedY = 0;
int currentDisplay;
int expectedDisplay;
- SDL_Rect expectedDisplayRect, expectedFullscreenRect;
+ SDL_Rect expectedFullscreenRect; /* Added for SDL2-COMPAT -- see below */
+ SDL_Rect expectedDisplayRect;
SDL_bool video_driver_is_wayland = SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0;
/* xVariation is the display we start on */
@@ -2108,7 +2109,7 @@ int video_setWindowCenteredOnDisplay(void *arg)
SDL_GetWindowSize(window, ¤tW, ¤tH);
SDL_GetWindowPosition(window, ¤tX, ¤tY);
- /* Get the expected fullscreen rect.
+ /* SDL2-COMPAT addition: Get the expected fullscreen rect.
* This needs to be queried after window creation and positioning as some drivers can alter the
* usable bounds based on the window scaling mode.
*/
@@ -2121,6 +2122,7 @@ int video_setWindowCenteredOnDisplay(void *arg)
} else {
SDLTest_Log("Skipping display index validation: Wayland driver does not support window positioning");
}
+ /* The following four checks changed from expectedDisplayRect to expectedFullscreenRect for SDL2-COMPAT: */
SDLTest_AssertCheck(currentW == expectedFullscreenRect.w, "Validate width (current: %d, expected: %d)", currentW, expectedFullscreenRect.w);
SDLTest_AssertCheck(currentH == expectedFullscreenRect.h, "Validate height (current: %d, expected: %d)", currentH, expectedFullscreenRect.h);
if (!video_driver_is_wayland) {