diff --git a/test/testautomation_video.c b/test/testautomation_video.c index e1cb1293d..7074dd294 100644 --- a/test/testautomation_video.c +++ b/test/testautomation_video.c @@ -1683,7 +1683,9 @@ static int video_setWindowCenteredOnDisplay(void *arg) int displayNum; int result; SDL_Rect display0, display1; - SDL_bool video_driver_is_wayland = SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0; + const char *video_driver = SDL_GetCurrentVideoDriver(); + SDL_bool video_driver_is_wayland = SDL_strcmp(video_driver, "wayland") == 0; + SDL_bool video_driver_is_emscripten = SDL_strcmp(video_driver, "emscripten") == 0; displays = SDL_GetDisplays(&displayNum); if (displays) { @@ -1758,18 +1760,22 @@ static int video_setWindowCenteredOnDisplay(void *arg) SDL_GetWindowSize(window, ¤tW, ¤tH); SDL_GetWindowPosition(window, ¤tX, ¤tY); - if (!video_driver_is_wayland) { - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay); + if (video_driver_is_wayland) { + SDLTest_Log("Skipping display ID validation: %s driver does not support window positioning", video_driver); } else { - SDLTest_Log("Skipping display ID validation: Wayland driver does not support window positioning"); + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay); } - SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); - SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); - if (!video_driver_is_wayland) { + if (video_driver_is_emscripten) { + SDLTest_Log("Skipping window size validation: %s driver does not support window resizing", video_driver); + } else { + SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); + SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); + } + if (video_driver_is_emscripten || video_driver_is_wayland) { + SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver); + } else { SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); - } else { - SDLTest_Log("Skipping window position validation: Wayland driver does not support window positioning"); } /* Enter fullscreen desktop */ @@ -1794,18 +1800,23 @@ static int video_setWindowCenteredOnDisplay(void *arg) SDLTest_AssertPass("SDL_GetDisplayBounds()"); SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); - if (!video_driver_is_wayland) { - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay); - } else { + if (video_driver_is_wayland) { SDLTest_Log("Skipping display ID validation: Wayland driver does not support window positioning"); + } else { + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay); } - SDLTest_AssertCheck(currentW == expectedFullscreenRect.w, "Validate width (current: %d, expected: %d)", currentW, expectedFullscreenRect.w); - SDLTest_AssertCheck(currentH == expectedFullscreenRect.h, "Validate height (current: %d, expected: %d)", currentH, expectedFullscreenRect.h); - if (!video_driver_is_wayland) { + + if (video_driver_is_emscripten) { + SDLTest_Log("Skipping window position validation: %s driver does not support window resizing", video_driver); + } else { + SDLTest_AssertCheck(currentW == expectedFullscreenRect.w, "Validate width (current: %d, expected: %d)", currentW, expectedFullscreenRect.w); + SDLTest_AssertCheck(currentH == expectedFullscreenRect.h, "Validate height (current: %d, expected: %d)", currentH, expectedFullscreenRect.h); + } + if (video_driver_is_emscripten || video_driver_is_wayland) { + SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver); + } else { SDLTest_AssertCheck(currentX == expectedFullscreenRect.x, "Validate x (current: %d, expected: %d)", currentX, expectedFullscreenRect.x); SDLTest_AssertCheck(currentY == expectedFullscreenRect.y, "Validate y (current: %d, expected: %d)", currentY, expectedFullscreenRect.y); - } else { - SDLTest_Log("Skipping window position validation: Wayland driver does not support window positioning"); } /* Leave fullscreen desktop */ @@ -1821,18 +1832,22 @@ static int video_setWindowCenteredOnDisplay(void *arg) SDL_GetWindowSize(window, ¤tW, ¤tH); SDL_GetWindowPosition(window, ¤tX, ¤tY); - if (!video_driver_is_wayland) { - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + if (video_driver_is_wayland) { + SDLTest_Log("Skipping display ID validation: %s driver does not support window positioning", video_driver); } else { - SDLTest_Log("Skipping display ID validation: Wayland driver does not support window positioning"); + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); } - SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); - SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); - if (!video_driver_is_wayland) { + if (video_driver_is_emscripten) { + SDLTest_Log("Skipping window position validation: %s driver does not support window resizing", video_driver); + } else { + SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); + SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); + } + if (video_driver_is_wayland) { + SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver); + } else { SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); - } else { - SDLTest_Log("Skipping window position validation: Wayland driver does not support window positioning"); } /* Center on display yVariation, and check window properties */ @@ -1853,18 +1868,22 @@ static int video_setWindowCenteredOnDisplay(void *arg) SDL_GetWindowSize(window, ¤tW, ¤tH); SDL_GetWindowPosition(window, ¤tX, ¤tY); - if (!video_driver_is_wayland) { - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay); + if (video_driver_is_wayland) { + SDLTest_Log("Skipping display ID validation: %s driver does not support window positioning", video_driver); } else { - SDLTest_Log("Skipping display ID validation: Wayland driver does not support window positioning"); + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay); } - SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); - SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); - if (!video_driver_is_wayland) { + if (video_driver_is_emscripten) { + SDLTest_Log("Skipping window position validation: %s driver does not support window resizing", video_driver); + } else { + SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); + SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); + } + if (video_driver_is_wayland) { + SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver); + } else { SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); - } else { - SDLTest_Log("Skipping window position validation: Wayland driver does not support window positioning"); } /* Clean up */ @@ -2390,91 +2409,91 @@ static int video_getWindowSurface(void *arg) /* Video test cases */ static const SDLTest_TestCaseReference videoTestEnableDisableScreensaver = { - (SDLTest_TestCaseFp)video_enableDisableScreensaver, "video_enableDisableScreensaver", "Enable and disable screenaver while checking state", TEST_ENABLED + video_enableDisableScreensaver, "video_enableDisableScreensaver", "Enable and disable screenaver while checking state", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestCreateWindowVariousSizes = { - (SDLTest_TestCaseFp)video_createWindowVariousSizes, "video_createWindowVariousSizes", "Create windows with various sizes", TEST_ENABLED + video_createWindowVariousSizes, "video_createWindowVariousSizes", "Create windows with various sizes", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestCreateWindowVariousFlags = { - (SDLTest_TestCaseFp)video_createWindowVariousFlags, "video_createWindowVariousFlags", "Create windows using various flags", TEST_ENABLED + video_createWindowVariousFlags, "video_createWindowVariousFlags", "Create windows using various flags", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetWindowFlags = { - (SDLTest_TestCaseFp)video_getWindowFlags, "video_getWindowFlags", "Get window flags set during SDL_CreateWindow", TEST_ENABLED + video_getWindowFlags, "video_getWindowFlags", "Get window flags set during SDL_CreateWindow", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetFullscreenDisplayModes = { - (SDLTest_TestCaseFp)video_getFullscreenDisplayModes, "video_getFullscreenDisplayModes", "Use SDL_GetFullscreenDisplayModes function to get number of display modes", TEST_ENABLED + video_getFullscreenDisplayModes, "video_getFullscreenDisplayModes", "Use SDL_GetFullscreenDisplayModes function to get number of display modes", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetClosestDisplayModeCurrentResolution = { - (SDLTest_TestCaseFp)video_getClosestDisplayModeCurrentResolution, "video_getClosestDisplayModeCurrentResolution", "Use function to get closes match to requested display mode for current resolution", TEST_ENABLED + video_getClosestDisplayModeCurrentResolution, "video_getClosestDisplayModeCurrentResolution", "Use function to get closes match to requested display mode for current resolution", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetClosestDisplayModeRandomResolution = { - (SDLTest_TestCaseFp)video_getClosestDisplayModeRandomResolution, "video_getClosestDisplayModeRandomResolution", "Use function to get closes match to requested display mode for random resolution", TEST_ENABLED + video_getClosestDisplayModeRandomResolution, "video_getClosestDisplayModeRandomResolution", "Use function to get closes match to requested display mode for random resolution", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetWindowDisplayMode = { - (SDLTest_TestCaseFp)video_getWindowDisplayMode, "video_getWindowDisplayMode", "Get window display mode", TEST_ENABLED + video_getWindowDisplayMode, "video_getWindowDisplayMode", "Get window display mode", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetWindowDisplayModeNegative = { - (SDLTest_TestCaseFp)video_getWindowDisplayModeNegative, "video_getWindowDisplayModeNegative", "Get window display mode with invalid input", TEST_ENABLED + video_getWindowDisplayModeNegative, "video_getWindowDisplayModeNegative", "Get window display mode with invalid input", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetSetWindowGrab = { - (SDLTest_TestCaseFp)video_getSetWindowGrab, "video_getSetWindowGrab", "Checks input grab positive and negative cases", TEST_ENABLED + video_getSetWindowGrab, "video_getSetWindowGrab", "Checks input grab positive and negative cases", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetWindowID = { - (SDLTest_TestCaseFp)video_getWindowId, "video_getWindowId", "Checks SDL_GetWindowID and SDL_GetWindowFromID", TEST_ENABLED + video_getWindowId, "video_getWindowId", "Checks SDL_GetWindowID and SDL_GetWindowFromID", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetWindowPixelFormat = { - (SDLTest_TestCaseFp)video_getWindowPixelFormat, "video_getWindowPixelFormat", "Checks SDL_GetWindowPixelFormat", TEST_ENABLED + video_getWindowPixelFormat, "video_getWindowPixelFormat", "Checks SDL_GetWindowPixelFormat", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetSetWindowPosition = { - (SDLTest_TestCaseFp)video_getSetWindowPosition, "video_getSetWindowPosition", "Checks SDL_GetWindowPosition and SDL_SetWindowPosition positive and negative cases", TEST_ENABLED + video_getSetWindowPosition, "video_getSetWindowPosition", "Checks SDL_GetWindowPosition and SDL_SetWindowPosition positive and negative cases", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetSetWindowSize = { - (SDLTest_TestCaseFp)video_getSetWindowSize, "video_getSetWindowSize", "Checks SDL_GetWindowSize and SDL_SetWindowSize positive and negative cases", TEST_ENABLED + video_getSetWindowSize, "video_getSetWindowSize", "Checks SDL_GetWindowSize and SDL_SetWindowSize positive and negative cases", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetSetWindowMinimumSize = { - (SDLTest_TestCaseFp)video_getSetWindowMinimumSize, "video_getSetWindowMinimumSize", "Checks SDL_GetWindowMinimumSize and SDL_SetWindowMinimumSize positive and negative cases", TEST_ENABLED + video_getSetWindowMinimumSize, "video_getSetWindowMinimumSize", "Checks SDL_GetWindowMinimumSize and SDL_SetWindowMinimumSize positive and negative cases", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetSetWindowMaximumSize = { - (SDLTest_TestCaseFp)video_getSetWindowMaximumSize, "video_getSetWindowMaximumSize", "Checks SDL_GetWindowMaximumSize and SDL_SetWindowMaximumSize positive and negative cases", TEST_ENABLED + video_getSetWindowMaximumSize, "video_getSetWindowMaximumSize", "Checks SDL_GetWindowMaximumSize and SDL_SetWindowMaximumSize positive and negative cases", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetSetWindowData = { - (SDLTest_TestCaseFp)video_getSetWindowData, "video_getSetWindowData", "Checks SDL_SetWindowData and SDL_GetWindowData positive and negative cases", TEST_ENABLED + video_getSetWindowData, "video_getSetWindowData", "Checks SDL_SetWindowData and SDL_GetWindowData positive and negative cases", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestSetWindowCenteredOnDisplay = { - (SDLTest_TestCaseFp)video_setWindowCenteredOnDisplay, "video_setWindowCenteredOnDisplay", "Checks using SDL_WINDOWPOS_CENTERED_DISPLAY centers the window on a display", TEST_ENABLED + video_setWindowCenteredOnDisplay, "video_setWindowCenteredOnDisplay", "Checks using SDL_WINDOWPOS_CENTERED_DISPLAY centers the window on a display", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetSetWindowState = { - (SDLTest_TestCaseFp)video_getSetWindowState, "video_getSetWindowState", "Checks transitioning between windowed, minimized, maximized, and fullscreen states", TEST_ENABLED + video_getSetWindowState, "video_getSetWindowState", "Checks transitioning between windowed, minimized, maximized, and fullscreen states", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestCreateMinimized = { - (SDLTest_TestCaseFp)video_createMinimized, "video_createMinimized", "Checks window state for windows created minimized", TEST_ENABLED + video_createMinimized, "video_createMinimized", "Checks window state for windows created minimized", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestCreateMaximized = { - (SDLTest_TestCaseFp)video_createMaximized, "video_createMaximized", "Checks window state for windows created maximized", TEST_ENABLED + video_createMaximized, "video_createMaximized", "Checks window state for windows created maximized", TEST_ENABLED }; static const SDLTest_TestCaseReference videoTestGetWindowSurface = { - (SDLTest_TestCaseFp)video_getWindowSurface, "video_getWindowSurface", "Checks window surface functionality", TEST_ENABLED + video_getWindowSurface, "video_getWindowSurface", "Checks window surface functionality", TEST_ENABLED }; /* Sequence of Video test cases */