mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 00:25:27 +00:00
Only test error message when using specific video drivers
The dummy driver does not sen an error message when passing a NULL rect argument to SDL_SetTextInputRect.
This commit is contained in:
parent
5368f45567
commit
811adaa342
|
@ -463,21 +463,23 @@ int keyboard_setTextInputRect(void *arg)
|
||||||
*/
|
*/
|
||||||
int keyboard_setTextInputRectNegative(void *arg)
|
int keyboard_setTextInputRectNegative(void *arg)
|
||||||
{
|
{
|
||||||
|
int platform_sets_error_message = SDL_strcmp(SDL_GetCurrentVideoDriver(), "windows") == 0 ||
|
||||||
|
SDL_strcmp(SDL_GetCurrentVideoDriver(), "android") == 0 ||
|
||||||
|
SDL_strcmp(SDL_GetCurrentVideoDriver(), "cococa") == 0;
|
||||||
/* Some platforms set also an error message; prepare for checking it */
|
/* Some platforms set also an error message; prepare for checking it */
|
||||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_ANDROID) || defined(SDL_VIDEO_DRIVER_COCOA)
|
|
||||||
const char *expectedError = "Parameter 'rect' is invalid";
|
const char *expectedError = "Parameter 'rect' is invalid";
|
||||||
const char *error;
|
const char *error;
|
||||||
|
|
||||||
SDL_ClearError();
|
SDL_ClearError();
|
||||||
SDLTest_AssertPass("Call to SDL_ClearError()");
|
SDLTest_AssertPass("Call to SDL_ClearError()");
|
||||||
#endif
|
|
||||||
|
|
||||||
/* NULL refRect */
|
/* NULL refRect */
|
||||||
SDL_SetTextInputRect(NULL);
|
SDL_SetTextInputRect(NULL);
|
||||||
SDLTest_AssertPass("Call to SDL_SetTextInputRect(NULL)");
|
SDLTest_AssertPass("Call to SDL_SetTextInputRect(NULL)");
|
||||||
|
|
||||||
/* Some platforms set also an error message; so check it */
|
/* Some platforms set also an error message; so check it */
|
||||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_ANDROID) || defined(SDL_VIDEO_DRIVER_COCOA)
|
|
||||||
|
if (platform_sets_error_message) {
|
||||||
error = SDL_GetError();
|
error = SDL_GetError();
|
||||||
SDLTest_AssertPass("Call to SDL_GetError()");
|
SDLTest_AssertPass("Call to SDL_GetError()");
|
||||||
SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
|
SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
|
||||||
|
@ -485,10 +487,10 @@ int keyboard_setTextInputRectNegative(void *arg)
|
||||||
SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0,
|
SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0,
|
||||||
"Validate error message, expected: '%s', got: '%s'", expectedError, error);
|
"Validate error message, expected: '%s', got: '%s'", expectedError, error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SDL_ClearError();
|
SDL_ClearError();
|
||||||
SDLTest_AssertPass("Call to SDL_ClearError()");
|
SDLTest_AssertPass("Call to SDL_ClearError()");
|
||||||
#endif
|
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue