From ffbd434a11d5bb10eafe1d11cf7c7651a5a08d30 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
(cherry picked from commit 4f488b9be2a814947711fd955ab87bbf8a3e3d9f)
---
test/testautomation_video.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/test/testautomation_video.c b/test/testautomation_video.c
index 09c55e7850b6f..b2bddaa71d95b 100644
--- a/test/testautomation_video.c
+++ b/test/testautomation_video.c
@@ -2444,6 +2444,33 @@ static int SDLCALL video_getWindowSurface(void *arg)
return TEST_COMPLETED;
}
+/**
+ * Tests SDL_RaiseWindow
+ */
+static int SDLCALL video_raiseWindow(void *arg)
+{
+ bool 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_raiseWindow");
+ if (!window) {
+ return TEST_ABORTED;
+ }
+
+ SDLTest_AssertPass("About to call SDL_RaiseWindow(window)");
+ result = SDL_RaiseWindow(window);
+ SDLTest_AssertCheck(result, "Result is %d, expected 1 (%s)", result, SDL_GetError());
+
+ destroyVideoSuiteTestWindow(window);
+
+ return TEST_COMPLETED;
+}
+
/* ================= Test References ================== */
/* Video test cases */
@@ -2534,6 +2561,9 @@ static const SDLTest_TestCaseReference videoTestCreateMaximized = {
static const SDLTest_TestCaseReference videoTestGetWindowSurface = {
video_getWindowSurface, "video_getWindowSurface", "Checks window surface functionality", TEST_ENABLED
};
+static const SDLTest_TestCaseReference videoTestRaiseWindow = {
+ video_raiseWindow, "video_raiseWindow", "Checks window focus", TEST_ENABLED
+};
/* Sequence of Video test cases */
static const SDLTest_TestCaseReference *videoTests[] = {
@@ -2559,6 +2589,7 @@ static const SDLTest_TestCaseReference *videoTests[] = {
&videoTestCreateMinimized,
&videoTestCreateMaximized,
&videoTestGetWindowSurface,
+ &videoTestRaiseWindow,
NULL
};