Merged Ryan's SDL-gui-backend branch.

Adds three APIs, and implements them on X11, Cocoa, and Windows:

- SDL_CaptureMouse()
- SDL_GetGlobalMouseState()
- SDL_SetWindowHitTest()
This commit is contained in:
Ryan C. Gordon
2014-06-25 17:06:12 -04:00
282 changed files with 30394 additions and 26689 deletions

View File

@@ -44,9 +44,9 @@ static Uint32 SDLTest_AssertsPassed = 0;
/*
* Assert that logs and break execution flow on failures (i.e. for harness errors).
*/
void SDLTest_Assert(int assertCondition, const char *assertDescription, ...)
void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...)
{
va_list list;
va_list list;
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
/* Print assert description into a buffer */
@@ -56,13 +56,13 @@ void SDLTest_Assert(int assertCondition, const char *assertDescription, ...)
va_end(list);
/* Log, then assert and break on failure */
SDL_assert((SDLTest_AssertCheck(assertCondition, logMessage)));
SDL_assert((SDLTest_AssertCheck(assertCondition, "%s", logMessage)));
}
/*
* Assert that logs but does not break execution flow on failures (i.e. for test cases).
*/
int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...)
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...)
{
va_list list;
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
@@ -91,7 +91,7 @@ int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...)
/*
* Explicitly passing Assert that logs (i.e. for test cases).
*/
void SDLTest_AssertPass(const char *assertDescription, ...)
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...)
{
va_list list;
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];

View File

@@ -999,12 +999,10 @@ default: return "???";
static void
SDLTest_PrintEvent(SDL_Event * event)
{
#if 0
if ((event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION)) {
/* Mouse and finger motion are really spammy */
return;
}
#endif
switch (event->type) {
case SDL_WINDOWEVENT:

View File

@@ -564,7 +564,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter);
}
SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, execKey);
SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey);
testResult = SDLTest_RunTest(testSuite, testCase, execKey);
if (testResult == TEST_RESULT_PASSED) {

View File

@@ -68,7 +68,7 @@ char *SDLTest_TimestampToString(const time_t timestamp)
/*
* Prints given message with a timestamp in the TEST category and INFO priority.
*/
void SDLTest_Log(const char *fmt, ...)
void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
va_list list;
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
@@ -86,7 +86,7 @@ void SDLTest_Log(const char *fmt, ...)
/*
* Prints given message with a timestamp in the TEST category and the ERROR priority.
*/
void SDLTest_LogError(const char *fmt, ...)
void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
va_list list;
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];