Browse Source

testautomation: use the correct return type for clipboard APIs

Sam Lantinga 2 weeks ago
parent
commit
c8f32b67ae
1 changed files with 28 additions and 30 deletions
  1. 28 30
      test/testautomation_clipboard.c

+ 28 - 30
test/testautomation_clipboard.c

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