Use SDL_bool instead an int return code in the SDL API
Most SDL functions used to indicate success or failure using an int return code. These functions have been changed to return SDL_bool. Here is a coccinelle patch to change code that previously compared the return value to 0 and changes it to a boolean test: @ bool_return_type @ identifier func =~ "^(SDL_AddEventWatch|SDL_AddHintCallback|SDL_AddSurfaceAlternateImage|SDL_AddVulkanRenderSemaphores|SDL_BindAudioStream|SDL_BindAudioStreams|SDL_BlitSurface|SDL_BlitSurface9Grid|SDL_BlitSurfaceScaled|SDL_BlitSurfaceTiled|SDL_BlitSurfaceTiledWithScale|SDL_BlitSurfaceUnchecked|SDL_BlitSurfaceUncheckedScaled|SDL_CaptureMouse|SDL_ClearAudioStream|SDL_ClearClipboardData|SDL_ClearComposition|SDL_ClearError|SDL_ClearProperty|SDL_ClearSurface|SDL_CloseIO|SDL_CloseStorage|SDL_ConvertAudioSamples|SDL_ConvertEventToRenderCoordinates|SDL_ConvertPixels|SDL_ConvertPixelsAndColorspace|SDL_CopyFile|SDL_CopyProperties|SDL_CopyStorageFile|SDL_CreateDirectory|SDL_CreateStorageDirectory|SDL_CreateWindowAndRenderer|SDL_DateTimeToTime|SDL_DestroyWindowSurface|SDL_DetachVirtualJoystick|SDL_DisableScreenSaver|SDL_EnableScreenSaver|SDL_EnumerateDirectory|SDL_EnumerateProperties|SDL_EnumerateStorageDirectory|SDL_FillSurfaceRect|SDL_FillSurfaceRects|SDL_FlashWindow|SDL_FlipSurface|SDL_FlushAudioStream|SDL_FlushRenderer|SDL_GL_DestroyContext|SDL_GL_GetAttribute|SDL_GL_GetSwapInterval|SDL_GL_LoadLibrary|SDL_GL_MakeCurrent|SDL_GL_SetAttribute|SDL_GL_SetSwapInterval|SDL_GL_SwapWindow|SDL_GetAudioDeviceFormat|SDL_GetAudioStreamFormat|SDL_GetCameraFormat|SDL_GetClosestFullscreenDisplayMode|SDL_GetCurrentRenderOutputSize|SDL_GetCurrentTime|SDL_GetDXGIOutputInfo|SDL_GetDateTimeLocalePreferences|SDL_GetDisplayBounds|SDL_GetDisplayUsableBounds|SDL_GetGDKDefaultUser|SDL_GetGDKTaskQueue|SDL_GetGamepadSensorData|SDL_GetGamepadTouchpadFinger|SDL_GetHapticEffectStatus|SDL_GetJoystickBall|SDL_GetMasksForPixelFormat|SDL_GetPathInfo|SDL_GetRectUnion|SDL_GetRectUnionFloat|SDL_GetRenderClipRect|SDL_GetRenderColorScale|SDL_GetRenderDrawBlendMode|SDL_GetRenderDrawColor|SDL_GetRenderDrawColorFloat|SDL_GetRenderLogicalPresentation|SDL_GetRenderLogicalPresentationRect|SDL_GetRenderOutputSize|SDL_GetRenderSafeArea|SDL_GetRenderScale|SDL_GetRenderVSync|SDL_GetRenderViewport|SDL_GetSensorData|SDL_GetStorageFileSize|SDL_GetStoragePathInfo|SDL_GetSurfaceAlphaMod|SDL_GetSurfaceBlendMode|SDL_GetSurfaceClipRect|SDL_GetSurfaceColorKey|SDL_GetSurfaceColorMod|SDL_GetTextInputArea|SDL_GetTextureAlphaMod|SDL_GetTextureAlphaModFloat|SDL_GetTextureBlendMode|SDL_GetTextureColorMod|SDL_GetTextureColorModFloat|SDL_GetTextureScaleMode|SDL_GetTextureSize|SDL_GetWindowAspectRatio|SDL_GetWindowBordersSize|SDL_GetWindowMaximumSize|SDL_GetWindowMinimumSize|SDL_GetWindowPosition|SDL_GetWindowRelativeMouseMode|SDL_GetWindowSafeArea|SDL_GetWindowSize|SDL_GetWindowSizeInPixels|SDL_GetWindowSurfaceVSync|SDL_HideCursor|SDL_HideWindow|SDL_Init|SDL_InitHapticRumble|SDL_InitSubSystem|SDL_LoadWAV|SDL_LoadWAV_IO|SDL_LockAudioStream|SDL_LockProperties|SDL_LockSurface|SDL_LockTexture|SDL_LockTextureToSurface|SDL_MaximizeWindow|SDL_MinimizeWindow|SDL_MixAudio|SDL_OpenURL|SDL_OutOfMemory|SDL_PauseAudioDevice|SDL_PauseAudioStreamDevice|SDL_PauseHaptic|SDL_PlayHapticRumble|SDL_PremultiplyAlpha|SDL_PremultiplySurfaceAlpha|SDL_PushEvent|SDL_PutAudioStreamData|SDL_RaiseWindow|SDL_ReadStorageFile|SDL_ReadSurfacePixel|SDL_ReadSurfacePixelFloat|SDL_RegisterApp|SDL_ReloadGamepadMappings|SDL_RemovePath|SDL_RemoveStoragePath|SDL_RemoveTimer|SDL_RenamePath|SDL_RenameStoragePath|SDL_RenderClear|SDL_RenderCoordinatesFromWindow|SDL_RenderCoordinatesToWindow|SDL_RenderFillRect|SDL_RenderFillRects|SDL_RenderGeometry|SDL_RenderGeometryRaw|SDL_RenderLine|SDL_RenderLines|SDL_RenderPoint|SDL_RenderPoints|SDL_RenderPresent|SDL_RenderRect|SDL_RenderRects|SDL_RenderTexture|SDL_RenderTexture9Grid|SDL_RenderTextureRotated|SDL_RenderTextureTiled|SDL_RequestAndroidPermission|SDL_RestoreWindow|SDL_ResumeAudioDevice|SDL_ResumeAudioStreamDevice|SDL_ResumeHaptic|SDL_RumbleGamepad|SDL_RumbleGamepadTriggers|SDL_RumbleJoystick|SDL_RumbleJoystickTriggers|SDL_RunHapticEffect|SDL_SaveBMP|SDL_SaveBMP_IO|SDL_SendAndroidMessage|SDL_SendGamepadEffect|SDL_SendJoystickEffect|SDL_SendJoystickVirtualSensorData|SDL_SetAppMetadata|SDL_SetAppMetadataProperty|SDL_SetAudioDeviceGain|SDL_SetAudioPostmixCallback|SDL_SetAudioStreamFormat|SDL_SetAudioStreamFrequencyRatio|SDL_SetAudioStreamGain|SDL_SetAudioStreamGetCallback|SDL_SetAudioStreamInputChannelMap|SDL_SetAudioStreamOutputChannelMap|SDL_SetAudioStreamPutCallback|SDL_SetBooleanProperty|SDL_SetClipboardData|SDL_SetClipboardText|SDL_SetCursor|SDL_SetFloatProperty|SDL_SetGamepadLED|SDL_SetGamepadMapping|SDL_SetGamepadPlayerIndex|SDL_SetGamepadSensorEnabled|SDL_SetHapticAutocenter|SDL_SetHapticGain|SDL_SetJoystickLED|SDL_SetJoystickPlayerIndex|SDL_SetJoystickVirtualAxis|SDL_SetJoystickVirtualBall|SDL_SetJoystickVirtualButton|SDL_SetJoystickVirtualHat|SDL_SetJoystickVirtualTouchpad|SDL_SetLinuxThreadPriority|SDL_SetLinuxThreadPriorityAndPolicy|SDL_SetLogPriorityPrefix|SDL_SetMemoryFunctions|SDL_SetNumberProperty|SDL_SetPaletteColors|SDL_SetPointerProperty|SDL_SetPointerPropertyWithCleanup|SDL_SetPrimarySelectionText|SDL_SetRenderClipRect|SDL_SetRenderColorScale|SDL_SetRenderDrawBlendMode|SDL_SetRenderDrawColor|SDL_SetRenderDrawColorFloat|SDL_SetRenderLogicalPresentation|SDL_SetRenderScale|SDL_SetRenderTarget|SDL_SetRenderVSync|SDL_SetRenderViewport|SDL_SetScancodeName|SDL_SetStringProperty|SDL_SetSurfaceAlphaMod|SDL_SetSurfaceBlendMode|SDL_SetSurfaceColorKey|SDL_SetSurfaceColorMod|SDL_SetSurfaceColorspace|SDL_SetSurfacePalette|SDL_SetSurfaceRLE|SDL_SetTLS|SDL_SetTextInputArea|SDL_SetTextureAlphaMod|SDL_SetTextureAlphaModFloat|SDL_SetTextureBlendMode|SDL_SetTextureColorMod|SDL_SetTextureColorModFloat|SDL_SetTextureScaleMode|SDL_SetThreadPriority|SDL_SetWindowAlwaysOnTop|SDL_SetWindowAspectRatio|SDL_SetWindowBordered|SDL_SetWindowFocusable|SDL_SetWindowFullscreen|SDL_SetWindowFullscreenMode|SDL_SetWindowHitTest|SDL_SetWindowIcon|SDL_SetWindowKeyboardGrab|SDL_SetWindowMaximumSize|SDL_SetWindowMinimumSize|SDL_SetWindowModalFor|SDL_SetWindowMouseGrab|SDL_SetWindowMouseRect|SDL_SetWindowOpacity|SDL_SetWindowPosition|SDL_SetWindowRelativeMouseMode|SDL_SetWindowResizable|SDL_SetWindowShape|SDL_SetWindowSize|SDL_SetWindowSurfaceVSync|SDL_SetWindowTitle|SDL_SetiOSAnimationCallback|SDL_ShowAndroidToast|SDL_ShowCursor|SDL_ShowMessageBox|SDL_ShowSimpleMessageBox|SDL_ShowWindow|SDL_ShowWindowSystemMenu|SDL_StartTextInput|SDL_StartTextInputWithProperties|SDL_StopHapticEffect|SDL_StopHapticEffects|SDL_StopHapticRumble|SDL_StopTextInput|SDL_SyncWindow|SDL_TimeToDateTime|SDL_TryLockMutex|SDL_TryLockRWLockForReading|SDL_TryLockRWLockForWriting|SDL_TryWaitSemaphore|SDL_UnlockAudioStream|SDL_UpdateHapticEffect|SDL_UpdateNVTexture|SDL_UpdateTexture|SDL_UpdateWindowSurface|SDL_UpdateWindowSurfaceRects|SDL_UpdateYUVTexture|SDL_Vulkan_CreateSurface|SDL_Vulkan_LoadLibrary|SDL_WaitConditionTimeout|SDL_WaitSemaphoreTimeout|SDL_WarpMouseGlobal|SDL_WriteStorageFile|SDL_WriteSurfacePixel|SDL_WriteSurfacePixelFloat)$"; @@ ( func( ... ) - == 0 | - func( + !func( ... ) - < 0 | - func( + !func( ... ) - != 0 | - func( + !func( ... ) - == -1 )
This commit is contained in:
@@ -360,7 +360,7 @@ static int video_getClosestDisplayModeCurrentResolution(void *arg)
|
||||
/* Make call */
|
||||
result = SDL_GetClosestFullscreenDisplayMode(displays[i], current.w, current.h, current.refresh_rate, SDL_FALSE, &closest);
|
||||
SDLTest_AssertPass("Call to SDL_GetClosestFullscreenDisplayMode(target=current)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
/* Check that one gets the current resolution back again */
|
||||
if (result == 0) {
|
||||
@@ -815,7 +815,7 @@ static int video_getSetWindowPosition(void *arg)
|
||||
|
||||
/* Sanity check */
|
||||
SDL_GetWindowPosition(window, ¤tX, ¤tY);
|
||||
if (SDL_SetWindowPosition(window, currentX, currentY) < 0) {
|
||||
if (!SDL_SetWindowPosition(window, currentX, currentY)) {
|
||||
SDLTest_Log("Skipping window positioning tests: %s reports window positioning as unsupported", SDL_GetCurrentVideoDriver());
|
||||
goto null_tests;
|
||||
}
|
||||
@@ -891,7 +891,7 @@ static int video_getSetWindowPosition(void *arg)
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
/* Get position */
|
||||
currentX = desiredX + 1;
|
||||
@@ -1013,9 +1013,9 @@ static int video_getSetWindowSize(void *arg)
|
||||
|
||||
/* Get display bounds for size range */
|
||||
result = SDL_GetDisplayUsableBounds(SDL_GetPrimaryDisplay(), &display);
|
||||
SDLTest_AssertPass("SDL_GetDisplayBounds()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
if (result != 0) {
|
||||
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
if (!result) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -1098,7 +1098,7 @@ static int video_getSetWindowSize(void *arg)
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
/* Get size */
|
||||
currentW = desiredW + 1;
|
||||
@@ -1213,8 +1213,8 @@ static int video_getSetWindowMinimumSize(void *arg)
|
||||
/* Get display bounds for size range */
|
||||
result = SDL_GetDisplayBounds(SDL_GetPrimaryDisplay(), &display);
|
||||
SDLTest_AssertPass("SDL_GetDisplayBounds()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
if (result != 0) {
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
if (!result) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -1355,8 +1355,8 @@ static int video_getSetWindowMaximumSize(void *arg)
|
||||
/* Get display bounds for size range */
|
||||
result = SDL_GetDisplayBounds(SDL_GetPrimaryDisplay(), &display);
|
||||
SDLTest_AssertPass("SDL_GetDisplayBounds()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
if (result != 0) {
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
if (!result) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -1693,15 +1693,15 @@ static int video_setWindowCenteredOnDisplay(void *arg)
|
||||
/* Get display bounds */
|
||||
result = SDL_GetDisplayUsableBounds(displays[0 % displayNum], &display0);
|
||||
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
if (result != 0) {
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
if (!result) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
result = SDL_GetDisplayUsableBounds(displays[1 % displayNum], &display1);
|
||||
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
if (result != 0) {
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
if (!result) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -1781,11 +1781,11 @@ static int video_setWindowCenteredOnDisplay(void *arg)
|
||||
/* Enter fullscreen desktop */
|
||||
SDL_SetWindowPosition(window, x, y);
|
||||
result = SDL_SetWindowFullscreen(window, SDL_TRUE);
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
/* Check we are filling the full display */
|
||||
currentDisplay = SDL_GetDisplayForWindow(window);
|
||||
@@ -1798,7 +1798,7 @@ static int video_setWindowCenteredOnDisplay(void *arg)
|
||||
*/
|
||||
result = SDL_GetDisplayBounds(expectedDisplay, &expectedFullscreenRect);
|
||||
SDLTest_AssertPass("SDL_GetDisplayBounds()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
if (video_driver_is_wayland) {
|
||||
SDLTest_Log("Skipping display ID validation: Wayland driver does not support window positioning");
|
||||
@@ -1821,11 +1821,11 @@ static int video_setWindowCenteredOnDisplay(void *arg)
|
||||
|
||||
/* Leave fullscreen desktop */
|
||||
result = SDL_SetWindowFullscreen(window, SDL_FALSE);
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
/* Check window was restored correctly */
|
||||
currentDisplay = SDL_GetDisplayForWindow(window);
|
||||
@@ -1862,7 +1862,7 @@ static int video_setWindowCenteredOnDisplay(void *arg)
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
currentDisplay = SDL_GetDisplayForWindow(window);
|
||||
SDL_GetWindowSize(window, ¤tW, ¤tH);
|
||||
@@ -1958,16 +1958,15 @@ static int video_getSetWindowState(void *arg)
|
||||
/* Maximize and check the dimensions */
|
||||
result = SDL_MaximizeWindow(window);
|
||||
SDLTest_AssertPass("SDL_MaximizeWindow()");
|
||||
if (result < 0) {
|
||||
if (!result) {
|
||||
SDLTest_Log("Skipping state transition tests: %s reports window maximizing as unsupported", SDL_GetCurrentVideoDriver());
|
||||
skipFlags |= SDL_WINDOW_MAXIMIZED;
|
||||
goto minimize_test;
|
||||
}
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
flags = SDL_GetWindowFlags(window);
|
||||
SDLTest_AssertPass("SDL_GetWindowFlags()");
|
||||
@@ -1980,7 +1979,7 @@ static int video_getSetWindowState(void *arg)
|
||||
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "windows") != 0) {
|
||||
result = SDL_GetDisplayUsableBounds(SDL_GetDisplayForWindow(window), &display);
|
||||
SDLTest_AssertPass("SDL_GetDisplayUsableBounds()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
desiredW = display.w;
|
||||
desiredH = display.h;
|
||||
@@ -1997,11 +1996,11 @@ static int video_getSetWindowState(void *arg)
|
||||
/* Restore and check the dimensions */
|
||||
result = SDL_RestoreWindow(window);
|
||||
SDLTest_AssertPass("SDL_RestoreWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
flags = SDL_GetWindowFlags(window);
|
||||
SDLTest_AssertPass("SDL_GetWindowFlags()");
|
||||
@@ -2026,15 +2025,15 @@ static int video_getSetWindowState(void *arg)
|
||||
/* Maximize, then immediately restore */
|
||||
result = SDL_MaximizeWindow(window);
|
||||
SDLTest_AssertPass("SDL_MaximizeWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_RestoreWindow(window);
|
||||
SDLTest_AssertPass("SDL_RestoreWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
flags = SDL_GetWindowFlags(window);
|
||||
SDLTest_AssertPass("SDL_GetWindowFlags()");
|
||||
@@ -2060,15 +2059,15 @@ static int video_getSetWindowState(void *arg)
|
||||
/* Maximize, then enter fullscreen */
|
||||
result = SDL_MaximizeWindow(window);
|
||||
SDLTest_AssertPass("SDL_MaximizeWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_SetWindowFullscreen(window, SDL_TRUE);
|
||||
SDLTest_AssertPass("SDL_SetWindowFullscreen(SDL_TRUE)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
flags = SDL_GetWindowFlags(window);
|
||||
SDLTest_AssertPass("SDL_GetWindowFlags()");
|
||||
@@ -2078,7 +2077,7 @@ static int video_getSetWindowState(void *arg)
|
||||
/* Verify the fullscreen size and position */
|
||||
result = SDL_GetDisplayBounds(SDL_GetDisplayForWindow(window), &display);
|
||||
SDLTest_AssertPass("SDL_GetDisplayBounds()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
if (!skipPos) {
|
||||
desiredX = display.x;
|
||||
@@ -2103,15 +2102,15 @@ static int video_getSetWindowState(void *arg)
|
||||
/* Leave fullscreen and restore the window */
|
||||
result = SDL_SetWindowFullscreen(window, SDL_FALSE);
|
||||
SDLTest_AssertPass("SDL_SetWindowFullscreen(SDL_FALSE)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_RestoreWindow(window);
|
||||
SDLTest_AssertPass("SDL_RestoreWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
flags = SDL_GetWindowFlags(window);
|
||||
SDLTest_AssertPass("SDL_GetWindowFlags()");
|
||||
@@ -2137,29 +2136,29 @@ static int video_getSetWindowState(void *arg)
|
||||
/* Maximize, change size, and restore */
|
||||
result = SDL_MaximizeWindow(window);
|
||||
SDLTest_AssertPass("SDL_MaximizeWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
desiredW = windowedW + 10;
|
||||
desiredH = windowedH + 10;
|
||||
result = SDL_SetWindowSize(window, desiredW, desiredH);
|
||||
SDLTest_AssertPass("SDL_SetWindowSize()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
if (!skipPos) {
|
||||
desiredX = windowedX + 10;
|
||||
desiredY = windowedY + 10;
|
||||
result = SDL_SetWindowPosition(window, desiredX, desiredY);
|
||||
SDLTest_AssertPass("SDL_SetWindowPosition()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
}
|
||||
|
||||
result = SDL_RestoreWindow(window);
|
||||
SDLTest_AssertPass("SDL_RestoreWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
flags = SDL_GetWindowFlags(window);
|
||||
SDLTest_AssertPass("SDL_GetWindowFlags()");
|
||||
@@ -2186,27 +2185,27 @@ static int video_getSetWindowState(void *arg)
|
||||
desiredH = windowedH - 5;
|
||||
result = SDL_SetWindowSize(window, desiredW, desiredH);
|
||||
SDLTest_AssertPass("SDL_SetWindowSize()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
if (!skipPos) {
|
||||
desiredX = windowedX + 5;
|
||||
desiredY = windowedY + 5;
|
||||
result = SDL_SetWindowPosition(window, desiredX, desiredY);
|
||||
SDLTest_AssertPass("SDL_SetWindowPosition()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
}
|
||||
|
||||
result = SDL_MaximizeWindow(window);
|
||||
SDLTest_AssertPass("SDL_MaximizeWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_RestoreWindow(window);
|
||||
SDLTest_AssertPass("SDL_RestoreWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
flags = SDL_GetWindowFlags(window);
|
||||
SDLTest_AssertPass("SDL_GetWindowFlags()");
|
||||
@@ -2232,13 +2231,13 @@ minimize_test:
|
||||
|
||||
/* Minimize */
|
||||
result = SDL_MinimizeWindow(window);
|
||||
if (result == 0) {
|
||||
if (result) {
|
||||
SDLTest_AssertPass("SDL_MinimizeWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
result = SDL_SyncWindow(window);
|
||||
SDLTest_AssertPass("SDL_SyncWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
flags = SDL_GetWindowFlags(window);
|
||||
SDLTest_AssertPass("SDL_GetWindowFlags()");
|
||||
@@ -2286,7 +2285,7 @@ static int video_createMinimized(void *arg)
|
||||
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED) {
|
||||
result = SDL_RestoreWindow(window);
|
||||
SDLTest_AssertPass("SDL_RestoreWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
} else {
|
||||
SDLTest_Log("Requested minimized window on creation, but that isn't supported on this platform.");
|
||||
}
|
||||
@@ -2325,7 +2324,7 @@ static int video_createMaximized(void *arg)
|
||||
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MAXIMIZED) {
|
||||
result = SDL_RestoreWindow(window);
|
||||
SDLTest_AssertPass("SDL_RestoreWindow()");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
} else {
|
||||
SDLTest_Log("Requested maximized window on creation, but that isn't supported on this platform.");
|
||||
}
|
||||
@@ -2365,7 +2364,7 @@ static int video_getWindowSurface(void *arg)
|
||||
|
||||
result = SDL_UpdateWindowSurface(window);
|
||||
SDLTest_AssertPass("Call to SDL_UpdateWindowSurface(window)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
|
||||
/* We shouldn't be able to create a renderer on a window with a surface */
|
||||
renderer = SDL_CreateRenderer(window, renderer_name);
|
||||
@@ -2374,7 +2373,7 @@ static int video_getWindowSurface(void *arg)
|
||||
|
||||
result = SDL_DestroyWindowSurface(window);
|
||||
SDLTest_AssertPass("Call to SDL_DestroyWindowSurface(window)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Verify return value; expected: SDL_TRUE, got: %d", result);
|
||||
SDLTest_AssertCheck(!SDL_WindowHasSurface(window), "Validate that window does not have a surface");
|
||||
|
||||
/* We should be able to create a renderer on the window now */
|
||||
|
||||
Reference in New Issue
Block a user