The refresh rate in SDL_DisplayMode is now a float

This commit is contained in:
Sam Lantinga 2023-01-02 15:47:19 -08:00
parent 851b0e16be
commit e3c1749f5b
32 changed files with 107 additions and 83 deletions

View file

@ -430,7 +430,7 @@ int video_getClosestDisplayModeCurrentResolution(void *arg)
for (variation = 0; variation < 8; variation++) {
/* Vary constraints on other query parameters */
target.format = (variation & 1) ? current.format : 0;
target.refresh_rate = (variation & 2) ? current.refresh_rate : 0;
target.refresh_rate = (variation & 2) ? current.refresh_rate : 0.0f;
target.driverdata = (variation & 4) ? current.driverdata : 0;
/* Make call */
@ -476,7 +476,7 @@ int video_getClosestDisplayModeRandomResolution(void *arg)
target.w = (variation & 1) ? SDLTest_RandomIntegerInRange(1, 4096) : 0;
target.h = (variation & 2) ? SDLTest_RandomIntegerInRange(1, 4096) : 0;
target.format = (variation & 4) ? SDLTest_RandomIntegerInRange(1, 10) : 0;
target.refresh_rate = (variation & 8) ? SDLTest_RandomIntegerInRange(25, 120) : 0;
target.refresh_rate = (variation & 8) ? (float)SDLTest_RandomIntegerInRange(25, 120) : 0.0f;
target.driverdata = 0;
/* Make call; may or may not find anything, so don't validate any further */
@ -503,7 +503,7 @@ int video_getWindowDisplayMode(void *arg)
/* Invalidate part of the mode content so we can check values later */
mode.w = -1;
mode.h = -1;
mode.refresh_rate = -1;
mode.refresh_rate = -1.0f;
/* Call against new test window */
window = createVideoSuiteTestWindow(title);
@ -513,7 +513,7 @@ int video_getWindowDisplayMode(void *arg)
SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
SDLTest_AssertCheck(mode.w > 0, "Validate mode.w content; expected: >0, got: %d", mode.w);
SDLTest_AssertCheck(mode.h > 0, "Validate mode.h content; expected: >0, got: %d", mode.h);
SDLTest_AssertCheck(mode.refresh_rate > 0, "Validate mode.refresh_rate content; expected: >0, got: %d", mode.refresh_rate);
SDLTest_AssertCheck(mode.refresh_rate > 0.0f, "Validate mode.refresh_rate content; expected: >0, got: %g", mode.refresh_rate);
}
/* Clean up */