Remove SDL_SetWindowBrightness and SDL_SetWindowGammaRamp.

This commit is contained in:
slime
2022-11-24 22:42:57 -04:00
committed by Sam Lantinga
parent d14530ea82
commit 52f4cc843d
23 changed files with 16 additions and 629 deletions

View File

@@ -510,61 +510,6 @@ video_getClosestDisplayModeRandomResolution(void *arg)
return TEST_COMPLETED;
}
/**
* @brief Tests call to SDL_GetWindowBrightness
*
* @sa http://wiki.libsdl.org/SDL_GetWindowBrightness
*/
int
video_getWindowBrightness(void *arg)
{
SDL_Window* window;
const char* title = "video_getWindowBrightness Test Window";
float result;
/* Call against new test window */
window = _createVideoSuiteTestWindow(title);
if (window != NULL) {
result = SDL_GetWindowBrightness(window);
SDLTest_AssertPass("Call to SDL_GetWindowBrightness()");
SDLTest_AssertCheck(result >= 0.0 && result <= 1.0, "Validate range of result value; expected: [0.0, 1.0], got: %f", result);
}
/* Clean up */
_destroyVideoSuiteTestWindow(window);
return TEST_COMPLETED;
}
/**
* @brief Tests call to SDL_GetWindowBrightness with invalid input
*
* @sa http://wiki.libsdl.org/SDL_GetWindowBrightness
*/
int
video_getWindowBrightnessNegative(void *arg)
{
const char *invalidWindowError = "Invalid window";
char *lastError;
float result;
/* Call against invalid window */
result = SDL_GetWindowBrightness(NULL);
SDLTest_AssertPass("Call to SDL_GetWindowBrightness(window=NULL)");
SDLTest_AssertCheck(result == 1.0, "Validate result value; expected: 1.0, got: %f", result);
lastError = (char *)SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
if (lastError != NULL) {
SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",
invalidWindowError,
lastError);
}
return TEST_COMPLETED;
}
/**
* @brief Tests call to SDL_GetWindowDisplayMode
*
@@ -663,92 +608,6 @@ video_getWindowDisplayModeNegative(void *arg)
return TEST_COMPLETED;
}
/**
* @brief Tests call to SDL_GetWindowGammaRamp
*
* @sa http://wiki.libsdl.org/SDL_GetWindowGammaRamp
*/
int
video_getWindowGammaRamp(void *arg)
{
SDL_Window* window;
const char* title = "video_getWindowGammaRamp Test Window";
Uint16 red[256];
Uint16 green[256];
Uint16 blue[256];
int result;
/* Call against new test window */
window = _createVideoSuiteTestWindow(title);
if (window == NULL) return TEST_ABORTED;
/* Retrieve no channel */
result = SDL_GetWindowGammaRamp(window, NULL, NULL, NULL);
SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(all NULL)");
SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
/* Retrieve single channel */
result = SDL_GetWindowGammaRamp(window, red, NULL, NULL);
SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r)");
SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
result = SDL_GetWindowGammaRamp(window, NULL, green, NULL);
SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(g)");
SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
result = SDL_GetWindowGammaRamp(window, NULL, NULL, blue);
SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(b)");
SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
/* Retrieve two channels */
result = SDL_GetWindowGammaRamp(window, red, green, NULL);
SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r, g)");
SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
result = SDL_GetWindowGammaRamp(window, NULL, green, blue);
SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(g,b)");
SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
result = SDL_GetWindowGammaRamp(window, red, NULL, blue);
SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r,b)");
SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
/* Retrieve all channels */
result = SDL_GetWindowGammaRamp(window, red, green, blue);
SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r,g,b)");
SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
/* Clean up */
_destroyVideoSuiteTestWindow(window);
return TEST_COMPLETED;
}
/**
* @brief Tests call to SDL_GetWindowGammaRamp with invalid input
*
* @sa http://wiki.libsdl.org/SDL_GetWindowGammaRamp
*/
int
video_getWindowGammaRampNegative(void *arg)
{
Uint16 red[256];
Uint16 green[256];
Uint16 blue[256];
int result;
SDL_ClearError();
SDLTest_AssertPass("Call to SDL_ClearError()");
/* Call against invalid window */
result = SDL_GetWindowGammaRamp(NULL, red, green, blue);
SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(window=NULL,r,g,b)");
SDLTest_AssertCheck(result == -1, "Validate result value; expected: -1, got: %i", result);
_checkInvalidWindowError();
return TEST_COMPLETED;
}
/* Helper for setting and checking the window mouse grab state */
void
_setAndCheckWindowMouseGrabState(SDL_Window* window, SDL_bool desiredState)
@@ -2011,48 +1870,36 @@ static const SDLTest_TestCaseReference videoTest9 =
{ (SDLTest_TestCaseFp)video_getClosestDisplayModeRandomResolution, "video_getClosestDisplayModeRandomResolution", "Use function to get closes match to requested display mode for random resolution", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest10 =
{ (SDLTest_TestCaseFp)video_getWindowBrightness, "video_getWindowBrightness", "Get window brightness", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest11 =
{ (SDLTest_TestCaseFp)video_getWindowBrightnessNegative, "video_getWindowBrightnessNegative", "Get window brightness with invalid input", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest12 =
{ (SDLTest_TestCaseFp)video_getWindowDisplayMode, "video_getWindowDisplayMode", "Get window display mode", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest13 =
static const SDLTest_TestCaseReference videoTest11 =
{ (SDLTest_TestCaseFp)video_getWindowDisplayModeNegative, "video_getWindowDisplayModeNegative", "Get window display mode with invalid input", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest14 =
{ (SDLTest_TestCaseFp)video_getWindowGammaRamp, "video_getWindowGammaRamp", "Get window gamma ramp", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest15 =
{ (SDLTest_TestCaseFp)video_getWindowGammaRampNegative, "video_getWindowGammaRampNegative", "Get window gamma ramp against invalid input", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest16 =
static const SDLTest_TestCaseReference videoTest12 =
{ (SDLTest_TestCaseFp)video_getSetWindowGrab, "video_getSetWindowGrab", "Checks SDL_GetWindowGrab and SDL_SetWindowGrab positive and negative cases", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest17 =
static const SDLTest_TestCaseReference videoTest13 =
{ (SDLTest_TestCaseFp)video_getWindowId, "video_getWindowId", "Checks SDL_GetWindowID and SDL_GetWindowFromID", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest18 =
static const SDLTest_TestCaseReference videoTest14 =
{ (SDLTest_TestCaseFp)video_getWindowPixelFormat, "video_getWindowPixelFormat", "Checks SDL_GetWindowPixelFormat", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest19 =
static const SDLTest_TestCaseReference videoTest15 =
{ (SDLTest_TestCaseFp)video_getSetWindowPosition, "video_getSetWindowPosition", "Checks SDL_GetWindowPosition and SDL_SetWindowPosition positive and negative cases", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest20 =
static const SDLTest_TestCaseReference videoTest16 =
{ (SDLTest_TestCaseFp)video_getSetWindowSize, "video_getSetWindowSize", "Checks SDL_GetWindowSize and SDL_SetWindowSize positive and negative cases", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest21 =
static const SDLTest_TestCaseReference videoTest17 =
{ (SDLTest_TestCaseFp)video_getSetWindowMinimumSize, "video_getSetWindowMinimumSize", "Checks SDL_GetWindowMinimumSize and SDL_SetWindowMinimumSize positive and negative cases", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest22 =
static const SDLTest_TestCaseReference videoTest18 =
{ (SDLTest_TestCaseFp)video_getSetWindowMaximumSize, "video_getSetWindowMaximumSize", "Checks SDL_GetWindowMaximumSize and SDL_SetWindowMaximumSize positive and negative cases", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest23 =
static const SDLTest_TestCaseReference videoTest19 =
{ (SDLTest_TestCaseFp)video_getSetWindowData, "video_getSetWindowData", "Checks SDL_SetWindowData and SDL_GetWindowData positive and negative cases", TEST_ENABLED };
static const SDLTest_TestCaseReference videoTest24 =
static const SDLTest_TestCaseReference videoTest20 =
{ (SDLTest_TestCaseFp) video_setWindowCenteredOnDisplay, "video_setWindowCenteredOnDisplay", "Checks using SDL_WINDOWPOS_CENTERED_DISPLAY centers the window on a display", TEST_ENABLED };
/* Sequence of Video test cases */
@@ -2060,8 +1907,7 @@ static const SDLTest_TestCaseReference *videoTests[] = {
&videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, &videoTest6,
&videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12,
&videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17,
&videoTest18, &videoTest19, &videoTest20, &videoTest21, &videoTest22,
&videoTest23, &videoTest24, NULL
&videoTest18, &videoTest19, &videoTest20, NULL
};
/* Video test suite (global) */