mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 06:34:35 +00:00
clipboard: Ensure SDL_ClearClipboardData clears data even when no data has been set
This commit is contained in:
parent
f8f8d87bfa
commit
c6b5c21aaf
2 changed files with 11 additions and 9 deletions
|
|
@ -108,6 +108,13 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
|
|||
result == true,
|
||||
"Validate SDL_ClearClipboardData result, expected true, got %i",
|
||||
result);
|
||||
expected_text = "";
|
||||
text = SDL_GetClipboardText();
|
||||
SDLTest_AssertCheck(
|
||||
text && SDL_strcmp(text, expected_text) == 0,
|
||||
"Verify clipboard text, expected \"%s\", got \"%s\"",
|
||||
expected_text, text);
|
||||
SDL_free(text);
|
||||
|
||||
/* Test clearing clipboard data when it's already clear */
|
||||
last_clipboard_update_count = clipboard_update_count;
|
||||
|
|
@ -117,8 +124,8 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
|
|||
"Validate SDL_ClearClipboardData result, expected true, got %i",
|
||||
result);
|
||||
SDLTest_AssertCheck(
|
||||
clipboard_update_count == last_clipboard_update_count,
|
||||
"Verify clipboard update unchanged, got %d",
|
||||
clipboard_update_count != last_clipboard_update_count,
|
||||
"Verify clipboard update count changed, got %d",
|
||||
clipboard_update_count - last_clipboard_update_count);
|
||||
|
||||
/* Validate error handling */
|
||||
|
|
@ -430,8 +437,8 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
|
|||
"Verify SDL_HasClipboardText returned false, got %s",
|
||||
(boolResult) ? "true" : "false");
|
||||
SDLTest_AssertCheck(
|
||||
clipboard_update_count == last_clipboard_update_count,
|
||||
"Verify clipboard update unchanged, got %d",
|
||||
clipboard_update_count == last_clipboard_update_count + 1,
|
||||
"Verify clipboard update count incremented by 1, got %d",
|
||||
clipboard_update_count - last_clipboard_update_count);
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue