test/testautomation_clipboard.c
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 20 Jul 2013 21:39:54 +0200
changeset 7477 a73210626b97
parent 7191 75360622e65f
child 7719 31b5f9ff36ca
permissions -rw-r--r--
Replaced use of strcmp() with SDL_strcmp() in tests.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     1
/**
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     2
 * New/updated tests: aschiffler at ferzkopp dot net
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     3
 */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     4
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     5
#include <stdio.h>
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     6
#include <string.h>
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     7
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     8
#include "SDL.h"
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     9
#include "SDL_test.h"
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    10
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    11
/* ================= Test Case Implementation ================== */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    12
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    13
/* Test case functions */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    14
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    15
/**
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    16
 * \brief Check call to SDL_HasClipboardText
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    17
 *
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    18
 * \sa
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    19
 * http://wiki.libsdl.org/moin.cgi/SDL_HasClipboardText
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    20
 */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    21
int
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    22
clipboard_testHasClipboardText(void *arg)
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    23
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    24
    SDL_bool result;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    25
    result = SDL_HasClipboardText();
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    26
    SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    27
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    28
    return TEST_COMPLETED;
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    29
}
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    30
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    31
/**
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    32
 * \brief Check call to SDL_GetClipboardText
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    33
 *
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    34
 * \sa
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    35
 * http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    36
 */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    37
int
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    38
clipboard_testGetClipboardText(void *arg)
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    39
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    40
    char *charResult;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    41
    charResult = SDL_GetClipboardText();
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    42
    SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    43
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    44
    if (charResult) SDL_free(charResult);
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    45
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    46
    return TEST_COMPLETED;
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    47
}
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    48
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    49
/**
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    50
 * \brief Check call to SDL_SetClipboardText
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    51
 * \sa
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    52
 * http://wiki.libsdl.org/moin.cgi/SDL_SetClipboardText
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    53
 */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    54
int
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    55
clipboard_testSetClipboardText(void *arg)
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    56
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    57
    char *textRef = SDLTest_RandomAsciiString();
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    58
    char *text = SDL_strdup(textRef);
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    59
    int result;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    60
    result = SDL_SetClipboardText((const char *)text);
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    61
    SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    62
    SDLTest_AssertCheck(
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    63
        result == 0,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    64
        "Validate SDL_SetClipboardText result, expected 0, got %i",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    65
        result);
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    66
    SDLTest_AssertCheck(
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    67
        SDL_strcmp(textRef, text) == 0,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    68
        "Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    69
        textRef, text);
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    70
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    71
    /* Cleanup */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    72
    if (textRef) SDL_free(textRef);
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    73
    if (text) SDL_free(text);
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    74
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    75
   return TEST_COMPLETED;
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    76
}
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    77
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    78
/**
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    79
 * \brief End-to-end test of SDL_xyzClipboardText functions
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    80
 * \sa
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    81
 * http://wiki.libsdl.org/moin.cgi/SDL_HasClipboardText
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    82
 * http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    83
 * http://wiki.libsdl.org/moin.cgi/SDL_SetClipboardText
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    84
 */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    85
int
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    86
clipboard_testClipboardTextFunctions(void *arg)
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    87
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    88
    char *textRef = SDLTest_RandomAsciiString();
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    89
    char *text = SDL_strdup(textRef);
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    90
    SDL_bool boolResult;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    91
    int intResult;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    92
    char *charResult;
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    93
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    94
    /* Clear clipboard text state */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    95
    boolResult = SDL_HasClipboardText();
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    96
    SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
    97
    if (boolResult == SDL_TRUE) {
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    98
        intResult = SDL_SetClipboardText((const char *)NULL);
7144
c700de9c8ed4 Corrected spelling in C source files of test suites.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 6822
diff changeset
    99
        SDLTest_AssertPass("Call to SDL_SetClipboardText(NULL) succeeded");
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   100
        SDLTest_AssertCheck(
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   101
            intResult == 0,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   102
            "Verify result from SDL_SetClipboardText(NULL), expected 0, got %i",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   103
            intResult);
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   104
        charResult = SDL_GetClipboardText();
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   105
        SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   106
        boolResult = SDL_HasClipboardText();
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   107
        SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   108
        SDLTest_AssertCheck(
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   109
            boolResult == SDL_FALSE,
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   110
            "Verify SDL_HasClipboardText returned SDL_FALSE, got %s",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   111
            (boolResult) ? "SDL_TRUE" : "SDL_FALSE");
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   112
    }
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   113
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   114
    /* Empty clipboard  */
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   115
    charResult = SDL_GetClipboardText();
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   116
    SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   117
    SDLTest_AssertCheck(
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   118
        charResult != NULL,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   119
        "Verify SDL_GetClipboardText did not return NULL");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   120
    SDLTest_AssertCheck(
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   121
        SDL_strlen(charResult) == 0,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   122
        "Verify SDL_GetClipboardText returned string with length 0, got length %i",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   123
        SDL_strlen(charResult));
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   124
    intResult = SDL_SetClipboardText((const char *)text);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   125
    SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   126
    SDLTest_AssertCheck(
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   127
        intResult == 0,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   128
        "Verify result from SDL_SetClipboardText(NULL), expected 0, got %i",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   129
        intResult);
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   130
    SDLTest_AssertCheck(
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   131
        SDL_strcmp(textRef, text) == 0,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   132
        "Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   133
        textRef, text);
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   134
    boolResult = SDL_HasClipboardText();
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   135
    SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   136
    SDLTest_AssertCheck(
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   137
        boolResult == SDL_TRUE,
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   138
        "Verify SDL_HasClipboardText returned SDL_TRUE, got %s",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   139
        (boolResult) ? "SDL_TRUE" : "SDL_FALSE");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   140
    charResult = SDL_GetClipboardText();
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   141
    SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   142
    SDLTest_AssertCheck(
7477
a73210626b97 Replaced use of strcmp() with SDL_strcmp() in tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7191
diff changeset
   143
        SDL_strcmp(textRef, charResult) == 0,
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   144
        "Verify SDL_GetClipboardText returned correct string, expected '%s', got '%s'",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   145
        textRef, charResult);
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   146
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   147
    /* Cleanup */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   148
    if (textRef) SDL_free(textRef);
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   149
    if (text) SDL_free(text);
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   150
    if (charResult) SDL_free(charResult);
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   151
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   152
   return TEST_COMPLETED;
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   153
}
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   154
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   155
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   156
/* ================= Test References ================== */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   157
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   158
/* Clipboard test cases */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   159
static const SDLTest_TestCaseReference clipboardTest1 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   160
        { (SDLTest_TestCaseFp)clipboard_testHasClipboardText, "clipboard_testHasClipboardText", "Check call to SDL_HasClipboardText", TEST_ENABLED };
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   161
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   162
static const SDLTest_TestCaseReference clipboardTest2 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   163
        { (SDLTest_TestCaseFp)clipboard_testGetClipboardText, "clipboard_testGetClipboardText", "Check call to SDL_GetClipboardText", TEST_ENABLED };
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   164
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   165
static const SDLTest_TestCaseReference clipboardTest3 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   166
        { (SDLTest_TestCaseFp)clipboard_testSetClipboardText, "clipboard_testSetClipboardText", "Check call to SDL_SetClipboardText", TEST_ENABLED };
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   167
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   168
static const SDLTest_TestCaseReference clipboardTest4 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   169
        { (SDLTest_TestCaseFp)clipboard_testClipboardTextFunctions, "clipboard_testClipboardTextFunctions", "End-to-end test of SDL_xyzClipboardText functions", TEST_ENABLED };
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   170
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   171
/* Sequence of Clipboard test cases */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   172
static const SDLTest_TestCaseReference *clipboardTests[] =  {
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   173
    &clipboardTest1, &clipboardTest2, &clipboardTest3, &clipboardTest4, NULL
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   174
};
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   175
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   176
/* Clipboard test suite (global) */
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   177
SDLTest_TestSuiteReference clipboardTestSuite = {
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   178
    "Clipboard",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   179
    NULL,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   180
    clipboardTests,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7144
diff changeset
   181
    NULL
6760
04dcce3081e6 Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   182
};