From b537be3005100fe85ad23df96571f693cac47729 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sun, 16 Mar 2025 22:40:27 +0100
Subject: [PATCH] tests: port failing window test from pysdl2 to testautomation
---
test/testautomation_video.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/test/testautomation_video.c b/test/testautomation_video.c
index 06a61f46..b3fc25e4 100644
--- a/test/testautomation_video.c
+++ b/test/testautomation_video.c
@@ -2259,6 +2259,33 @@ static int video_getWindowSurface(void *arg)
return TEST_COMPLETED;
}
+/**
+ * Tests SDL_SetWindowInputFocus
+ */
+static int video_setWindowInputFocus(void *arg)
+{
+ int result;
+ SDL_Window *window;
+
+ SDLTest_AssertPass("SDL_SetWindowInputFocus is not supported on dummy and SDL2 wayland driver");
+ if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "dummy") == 0 || SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
+ return TEST_SKIPPED;
+ }
+
+ window = _createVideoSuiteTestWindow("video_setWindowInputFocus");
+ if (!window) {
+ return TEST_ABORTED;
+ }
+
+ SDLTest_AssertPass("About to call SDL_SetWindowInputFocus(window)");
+ result = SDL_SetWindowInputFocus(window);
+ SDLTest_AssertCheck(result == 0, "Result is %d, expected 0", result);
+
+ _destroyVideoSuiteTestWindow(window);
+
+ return TEST_COMPLETED;
+}
+
/* ================= Test References ================== */
/* Video test cases */
@@ -2346,6 +2373,9 @@ static const SDLTest_TestCaseReference videoTest24 =
static const SDLTest_TestCaseReference videoTest25 = {
(SDLTest_TestCaseFp)video_getWindowSurface, "video_getWindowSurface", "Checks window surface functionality", TEST_ENABLED
};
+static const SDLTest_TestCaseReference videoTest26 = {
+ (SDLTest_TestCaseFp)video_setWindowInputFocus, "video_setWindowInputFocus", "Checks window input focus", TEST_ENABLED
+};
/* Sequence of Video test cases */
static const SDLTest_TestCaseReference *videoTests[] = {
@@ -2353,7 +2383,7 @@ static const SDLTest_TestCaseReference *videoTests[] = {
&videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12,
&videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17,
&videoTest18, &videoTest19, &videoTest20, &videoTest21, &videoTest22,
- &videoTest23, &videoTest24, &videoTest25, NULL
+ &videoTest23, &videoTest24, &videoTest25, &videoTest26, NULL
};
/* Video test suite (global) */