testautomation: use the correct return type for clipboard APIs

This commit is contained in:
Sam Lantinga
2025-09-21 23:02:42 -07:00
parent a5b070ba2d
commit c8f32b67ae

View File

@@ -412,7 +412,6 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
char *textRef = SDLTest_RandomAsciiString(); char *textRef = SDLTest_RandomAsciiString();
char *text = SDL_strdup(textRef); char *text = SDL_strdup(textRef);
bool boolResult; bool boolResult;
int intResult;
char *charResult; char *charResult;
int last_clipboard_update_count; int last_clipboard_update_count;
@@ -420,11 +419,11 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
/* Empty clipboard text */ /* Empty clipboard text */
last_clipboard_update_count = clipboard_update_count; last_clipboard_update_count = clipboard_update_count;
intResult = SDL_SetClipboardText(NULL); boolResult = SDL_SetClipboardText(NULL);
SDLTest_AssertCheck( SDLTest_AssertCheck(
intResult == true, boolResult == true,
"Verify result from SDL_SetClipboardText(NULL), expected true, got %i", "Verify result from SDL_SetClipboardText(NULL), expected true, got %s",
intResult); boolResult ? "true" : "false");
charResult = SDL_GetClipboardText(); charResult = SDL_GetClipboardText();
SDLTest_AssertCheck( SDLTest_AssertCheck(
charResult && SDL_strcmp(charResult, "") == 0, charResult && SDL_strcmp(charResult, "") == 0,
@@ -435,7 +434,7 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
SDLTest_AssertCheck( SDLTest_AssertCheck(
boolResult == false, boolResult == false,
"Verify SDL_HasClipboardText returned false, got %s", "Verify SDL_HasClipboardText returned false, got %s",
(boolResult) ? "true" : "false"); boolResult ? "true" : "false");
SDLTest_AssertCheck( SDLTest_AssertCheck(
clipboard_update_count == last_clipboard_update_count + 1, clipboard_update_count == last_clipboard_update_count + 1,
"Verify clipboard update count incremented by 1, got %d", "Verify clipboard update count incremented by 1, got %d",
@@ -444,11 +443,11 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
/* Set clipboard text */ /* Set clipboard text */
last_clipboard_update_count = clipboard_update_count; last_clipboard_update_count = clipboard_update_count;
intResult = SDL_SetClipboardText(text); boolResult = SDL_SetClipboardText(text);
SDLTest_AssertCheck( SDLTest_AssertCheck(
intResult == true, boolResult == true,
"Verify result from SDL_SetClipboardText(%s), expected true, got %i", text, "Verify result from SDL_SetClipboardText(%s), expected true, got %s", text,
intResult); boolResult ? "true" : "false");
SDLTest_AssertCheck( SDLTest_AssertCheck(
SDL_strcmp(textRef, text) == 0, SDL_strcmp(textRef, text) == 0,
"Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'", "Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'",
@@ -457,7 +456,7 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
SDLTest_AssertCheck( SDLTest_AssertCheck(
boolResult == true, boolResult == true,
"Verify SDL_HasClipboardText returned true, got %s", "Verify SDL_HasClipboardText returned true, got %s",
(boolResult) ? "true" : "false"); boolResult ? "true" : "false");
charResult = SDL_GetClipboardText(); charResult = SDL_GetClipboardText();
SDLTest_AssertCheck( SDLTest_AssertCheck(
charResult && SDL_strcmp(textRef, charResult) == 0, charResult && SDL_strcmp(textRef, charResult) == 0,
@@ -470,11 +469,11 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
clipboard_update_count - last_clipboard_update_count); clipboard_update_count - last_clipboard_update_count);
/* Reset clipboard text */ /* Reset clipboard text */
intResult = SDL_SetClipboardText(NULL); boolResult = SDL_SetClipboardText(NULL);
SDLTest_AssertCheck( SDLTest_AssertCheck(
intResult == true, boolResult == true,
"Verify result from SDL_SetClipboardText(NULL), expected true, got %i", "Verify result from SDL_SetClipboardText(NULL), expected true, got %s",
intResult); boolResult ? "true" : "false");
/* Cleanup */ /* Cleanup */
SDL_free(textRef); SDL_free(textRef);
@@ -496,7 +495,6 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
char *textRef = SDLTest_RandomAsciiString(); char *textRef = SDLTest_RandomAsciiString();
char *text = SDL_strdup(textRef); char *text = SDL_strdup(textRef);
bool boolResult; bool boolResult;
int intResult;
char *charResult; char *charResult;
int last_clipboard_update_count; int last_clipboard_update_count;
@@ -504,11 +502,11 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
/* Empty primary selection */ /* Empty primary selection */
last_clipboard_update_count = clipboard_update_count; last_clipboard_update_count = clipboard_update_count;
intResult = SDL_SetPrimarySelectionText(NULL); boolResult = SDL_SetPrimarySelectionText(NULL);
SDLTest_AssertCheck( SDLTest_AssertCheck(
intResult == true, boolResult == true,
"Verify result from SDL_SetPrimarySelectionText(NULL), expected true, got %i", "Verify result from SDL_SetPrimarySelectionText(NULL), expected true, got %s",
intResult); boolResult ? "true" : "false");
charResult = SDL_GetPrimarySelectionText(); charResult = SDL_GetPrimarySelectionText();
SDLTest_AssertCheck( SDLTest_AssertCheck(
charResult && SDL_strcmp(charResult, "") == 0, charResult && SDL_strcmp(charResult, "") == 0,
@@ -519,7 +517,7 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
SDLTest_AssertCheck( SDLTest_AssertCheck(
boolResult == false, boolResult == false,
"Verify SDL_HasPrimarySelectionText returned false, got %s", "Verify SDL_HasPrimarySelectionText returned false, got %s",
(boolResult) ? "true" : "false"); boolResult ? "true" : "false");
SDLTest_AssertCheck( SDLTest_AssertCheck(
clipboard_update_count == last_clipboard_update_count + 1, clipboard_update_count == last_clipboard_update_count + 1,
"Verify clipboard update count incremented by 1, got %d", "Verify clipboard update count incremented by 1, got %d",
@@ -527,11 +525,11 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
/* Set primary selection */ /* Set primary selection */
last_clipboard_update_count = clipboard_update_count; last_clipboard_update_count = clipboard_update_count;
intResult = SDL_SetPrimarySelectionText(text); boolResult = SDL_SetPrimarySelectionText(text);
SDLTest_AssertCheck( SDLTest_AssertCheck(
intResult == true, boolResult == true,
"Verify result from SDL_SetPrimarySelectionText(%s), expected true, got %i", text, "Verify result from SDL_SetPrimarySelectionText(%s), expected true, got %s", text,
intResult); boolResult ? "true" : "false");
SDLTest_AssertCheck( SDLTest_AssertCheck(
SDL_strcmp(textRef, text) == 0, SDL_strcmp(textRef, text) == 0,
"Verify SDL_SetPrimarySelectionText did not modify input string, expected '%s', got '%s'", "Verify SDL_SetPrimarySelectionText did not modify input string, expected '%s', got '%s'",
@@ -540,7 +538,7 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
SDLTest_AssertCheck( SDLTest_AssertCheck(
boolResult == true, boolResult == true,
"Verify SDL_HasPrimarySelectionText returned true, got %s", "Verify SDL_HasPrimarySelectionText returned true, got %s",
(boolResult) ? "true" : "false"); boolResult ? "true" : "false");
charResult = SDL_GetPrimarySelectionText(); charResult = SDL_GetPrimarySelectionText();
SDLTest_AssertCheck( SDLTest_AssertCheck(
charResult && SDL_strcmp(textRef, charResult) == 0, charResult && SDL_strcmp(textRef, charResult) == 0,
@@ -553,11 +551,11 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
clipboard_update_count - last_clipboard_update_count); clipboard_update_count - last_clipboard_update_count);
/* Reset primary selection */ /* Reset primary selection */
intResult = SDL_SetPrimarySelectionText(NULL); boolResult = SDL_SetPrimarySelectionText(NULL);
SDLTest_AssertCheck( SDLTest_AssertCheck(
intResult == true, boolResult == true,
"Verify result from SDL_SetPrimarySelectionText(NULL), expected true, got %i", "Verify result from SDL_SetPrimarySelectionText(NULL), expected true, got %s",
intResult); boolResult ? "true" : "false");
/* Cleanup */ /* Cleanup */
SDL_free(textRef); SDL_free(textRef);