Skip to content

Commit 4f488b9

Browse files
madebrslouken
authored andcommitted
tests: port failing window test from pysdl2 to testautomation
1 parent f48a96a commit 4f488b9

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

test/testautomation_video.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2251,6 +2251,33 @@ static int video_getWindowSurface(void *arg)
22512251
return TEST_COMPLETED;
22522252
}
22532253

2254+
/**
2255+
* Tests SDL_SetWindowInputFocus
2256+
*/
2257+
static int video_setWindowInputFocus(void *arg)
2258+
{
2259+
int result;
2260+
SDL_Window *window;
2261+
2262+
SDLTest_AssertPass("SDL_SetWindowInputFocus is not supported on dummy and SDL2 wayland driver");
2263+
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "dummy") == 0 || SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
2264+
return TEST_SKIPPED;
2265+
}
2266+
2267+
window = _createVideoSuiteTestWindow("video_setWindowInputFocus");
2268+
if (!window) {
2269+
return TEST_ABORTED;
2270+
}
2271+
2272+
SDLTest_AssertPass("About to call SDL_SetWindowInputFocus(window)");
2273+
result = SDL_SetWindowInputFocus(window);
2274+
SDLTest_AssertCheck(result == 0, "Result is %d, expected 0", result);
2275+
2276+
_destroyVideoSuiteTestWindow(window);
2277+
2278+
return TEST_COMPLETED;
2279+
}
2280+
22542281
/* ================= Test References ================== */
22552282

22562283
/* Video test cases */
@@ -2338,14 +2365,17 @@ static const SDLTest_TestCaseReference videoTest24 =
23382365
static const SDLTest_TestCaseReference videoTest25 = {
23392366
(SDLTest_TestCaseFp)video_getWindowSurface, "video_getWindowSurface", "Checks window surface functionality", TEST_ENABLED
23402367
};
2368+
static const SDLTest_TestCaseReference videoTest26 = {
2369+
(SDLTest_TestCaseFp)video_setWindowInputFocus, "video_setWindowInputFocus", "Checks window input focus", TEST_ENABLED
2370+
};
23412371

23422372
/* Sequence of Video test cases */
23432373
static const SDLTest_TestCaseReference *videoTests[] = {
23442374
&videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, &videoTest6,
23452375
&videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12,
23462376
&videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17,
23472377
&videoTest18, &videoTest19, &videoTest20, &videoTest21, &videoTest22,
2348-
&videoTest23, &videoTest24, &videoTest25, NULL
2378+
&videoTest23, &videoTest24, &videoTest25, &videoTest26, NULL
23492379
};
23502380

23512381
/* Video test suite (global) */

0 commit comments

Comments
 (0)