mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
Removing a timer that isn't running is a success.
This commit is contained in:
@@ -381,11 +381,7 @@ int SDL_RemoveTimer(SDL_TimerID id)
|
|||||||
}
|
}
|
||||||
SDL_free(entry);
|
SDL_free(entry);
|
||||||
}
|
}
|
||||||
if (canceled) {
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
return SDL_SetError("Timer not found");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@@ -142,7 +142,7 @@ static int timer_addRemoveTimer(void *arg)
|
|||||||
/* Try to remove timer again (should be a NOOP) */
|
/* Try to remove timer again (should be a NOOP) */
|
||||||
result = SDL_RemoveTimer(id);
|
result = SDL_RemoveTimer(id);
|
||||||
SDLTest_AssertPass("Call to SDL_RemoveTimer()");
|
SDLTest_AssertPass("Call to SDL_RemoveTimer()");
|
||||||
SDLTest_AssertCheck(result < 0, "Check result value, expected: <0, got: %i", result);
|
SDLTest_AssertCheck(result == 0, "Check result value, expected: 0, got: %i", result);
|
||||||
|
|
||||||
/* Reset state */
|
/* Reset state */
|
||||||
param = SDLTest_RandomIntegerInRange(-1024, 1024);
|
param = SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||||
@@ -162,7 +162,7 @@ static int timer_addRemoveTimer(void *arg)
|
|||||||
/* Remove timer again and check that callback was called */
|
/* Remove timer again and check that callback was called */
|
||||||
result = SDL_RemoveTimer(id);
|
result = SDL_RemoveTimer(id);
|
||||||
SDLTest_AssertPass("Call to SDL_RemoveTimer()");
|
SDLTest_AssertPass("Call to SDL_RemoveTimer()");
|
||||||
SDLTest_AssertCheck(result < 0, "Check result value, expected: <0, got: %i", result);
|
SDLTest_AssertCheck(result == 0, "Check result value, expected: 0, got: %i", result);
|
||||||
SDLTest_AssertCheck(g_timerCallbackCalled == 1, "Check callback WAS called, expected: 1, got: %i", g_timerCallbackCalled);
|
SDLTest_AssertCheck(g_timerCallbackCalled == 1, "Check callback WAS called, expected: 1, got: %i", g_timerCallbackCalled);
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
Reference in New Issue
Block a user