Fix video_getSetWindowGrab(): need to raise the window, and wait for focus gained
This commit is contained in:
parent
d4d26e0ddb
commit
f30a182de2
1 changed files with 18 additions and 0 deletions
|
@ -501,6 +501,7 @@ static int video_getSetWindowGrab(void *arg)
|
||||||
const char *title = "video_getSetWindowGrab Test Window";
|
const char *title = "video_getSetWindowGrab Test Window";
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
SDL_bool originalMouseState, originalKeyboardState;
|
SDL_bool originalMouseState, originalKeyboardState;
|
||||||
|
SDL_bool hasFocusGained = SDL_FALSE;
|
||||||
|
|
||||||
/* Call against new test window */
|
/* Call against new test window */
|
||||||
window = createVideoSuiteTestWindow(title);
|
window = createVideoSuiteTestWindow(title);
|
||||||
|
@ -508,6 +509,23 @@ static int video_getSetWindowGrab(void *arg)
|
||||||
return TEST_ABORTED;
|
return TEST_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Need to raise the window to have and SDL_EVENT_WINDOW_FOCUS_GAINED,
|
||||||
|
* so that the window gets the flags SDL_WINDOW_INPUT_FOCUS,
|
||||||
|
* so that it can be "grabbed" */
|
||||||
|
SDL_RaiseWindow(window);
|
||||||
|
|
||||||
|
{
|
||||||
|
SDL_Event evt;
|
||||||
|
SDL_zero(evt);
|
||||||
|
while (SDL_PollEvent(&evt)) {
|
||||||
|
if (evt.type == SDL_EVENT_WINDOW_FOCUS_GAINED) {
|
||||||
|
hasFocusGained = SDL_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDLTest_AssertCheck(hasFocusGained == SDL_TRUE, "Expectded window with focus");
|
||||||
|
|
||||||
/* Get state */
|
/* Get state */
|
||||||
originalMouseState = SDL_GetWindowMouseGrab(window);
|
originalMouseState = SDL_GetWindowMouseGrab(window);
|
||||||
SDLTest_AssertPass("Call to SDL_GetWindowMouseGrab()");
|
SDLTest_AssertPass("Call to SDL_GetWindowMouseGrab()");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue