mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 06:34:35 +00:00
testautomation: fix video tests on Android
Like emscripten, window positioning and sizing is not supported on Android.
This commit is contained in:
parent
670e4d2ae6
commit
005f10bd97
1 changed files with 70 additions and 27 deletions
|
|
@ -7,6 +7,46 @@
|
||||||
|
|
||||||
/* Private helpers */
|
/* Private helpers */
|
||||||
|
|
||||||
|
static bool VideoSupportsWindowPositioning(void)
|
||||||
|
{
|
||||||
|
const char *video_driver = SDL_GetCurrentVideoDriver();
|
||||||
|
|
||||||
|
if (SDL_strcmp(video_driver, "android") == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (SDL_strcmp(video_driver, "emscripten") == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (SDL_strcmp(video_driver, "wayland") == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool VideoSupportsWindowResizing(void)
|
||||||
|
{
|
||||||
|
const char *video_driver = SDL_GetCurrentVideoDriver();
|
||||||
|
|
||||||
|
if (SDL_strcmp(video_driver, "android") == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (SDL_strcmp(video_driver, "emscripten") == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool VideoSupportsWindowMinimizing(void)
|
||||||
|
{
|
||||||
|
const char *video_driver = SDL_GetCurrentVideoDriver();
|
||||||
|
|
||||||
|
if (SDL_strcmp(video_driver, "android") == 0) {
|
||||||
|
// Technically it's supported, but minimizing backgrounds the application and stops processing
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a test window
|
* Create a test window
|
||||||
*/
|
*/
|
||||||
|
|
@ -1678,7 +1718,6 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
|
||||||
SDL_Rect display0, display1;
|
SDL_Rect display0, display1;
|
||||||
const char *video_driver = SDL_GetCurrentVideoDriver();
|
const char *video_driver = SDL_GetCurrentVideoDriver();
|
||||||
bool video_driver_is_wayland = SDL_strcmp(video_driver, "wayland") == 0;
|
bool video_driver_is_wayland = SDL_strcmp(video_driver, "wayland") == 0;
|
||||||
bool video_driver_is_emscripten = SDL_strcmp(video_driver, "emscripten") == 0;
|
|
||||||
|
|
||||||
displays = SDL_GetDisplays(&displayNum);
|
displays = SDL_GetDisplays(&displayNum);
|
||||||
if (displays) {
|
if (displays) {
|
||||||
|
|
@ -1758,17 +1797,17 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
|
||||||
} else {
|
} else {
|
||||||
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay);
|
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay);
|
||||||
}
|
}
|
||||||
if (video_driver_is_emscripten) {
|
if (VideoSupportsWindowResizing()) {
|
||||||
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(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w);
|
||||||
SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h);
|
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 {
|
} else {
|
||||||
|
SDLTest_Log("Skipping window size validation: %s driver does not support window resizing", video_driver);
|
||||||
|
}
|
||||||
|
if (VideoSupportsWindowPositioning()) {
|
||||||
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
|
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
|
||||||
SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
|
SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
|
||||||
|
} else {
|
||||||
|
SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enter fullscreen desktop */
|
/* Enter fullscreen desktop */
|
||||||
|
|
@ -1799,17 +1838,17 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
|
||||||
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay);
|
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video_driver_is_emscripten) {
|
if (VideoSupportsWindowResizing()) {
|
||||||
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(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);
|
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 {
|
} else {
|
||||||
|
SDLTest_Log("Skipping window size validation: %s driver does not support window resizing", video_driver);
|
||||||
|
}
|
||||||
|
if (VideoSupportsWindowPositioning()) {
|
||||||
SDLTest_AssertCheck(currentX == expectedFullscreenRect.x, "Validate x (current: %d, expected: %d)", currentX, expectedFullscreenRect.x);
|
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);
|
SDLTest_AssertCheck(currentY == expectedFullscreenRect.y, "Validate y (current: %d, expected: %d)", currentY, expectedFullscreenRect.y);
|
||||||
|
} else {
|
||||||
|
SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Leave fullscreen desktop */
|
/* Leave fullscreen desktop */
|
||||||
|
|
@ -1830,17 +1869,17 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
|
||||||
} else {
|
} else {
|
||||||
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay);
|
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay);
|
||||||
}
|
}
|
||||||
if (video_driver_is_emscripten) {
|
if (VideoSupportsWindowResizing()) {
|
||||||
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(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w);
|
||||||
SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h);
|
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 {
|
} else {
|
||||||
|
SDLTest_Log("Skipping window size validation: %s driver does not support window resizing", video_driver);
|
||||||
|
}
|
||||||
|
if (VideoSupportsWindowPositioning()) {
|
||||||
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
|
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
|
||||||
SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
|
SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
|
||||||
|
} else {
|
||||||
|
SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Center on display yVariation, and check window properties */
|
/* Center on display yVariation, and check window properties */
|
||||||
|
|
@ -1866,17 +1905,17 @@ static int SDLCALL video_setWindowCenteredOnDisplay(void *arg)
|
||||||
} else {
|
} else {
|
||||||
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay);
|
SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay);
|
||||||
}
|
}
|
||||||
if (video_driver_is_emscripten) {
|
if (VideoSupportsWindowResizing()) {
|
||||||
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(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w);
|
||||||
SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h);
|
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 {
|
} else {
|
||||||
|
SDLTest_Log("Skipping window size validation: %s driver does not support window resizing", video_driver);
|
||||||
|
}
|
||||||
|
if (VideoSupportsWindowPositioning()) {
|
||||||
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
|
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
|
||||||
SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
|
SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
|
||||||
|
} else {
|
||||||
|
SDLTest_Log("Skipping window position validation: %s driver does not support window positioning", video_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
|
|
@ -2270,8 +2309,7 @@ static int SDLCALL video_getSetWindowState(void *arg)
|
||||||
minimize_test:
|
minimize_test:
|
||||||
|
|
||||||
/* Minimize */
|
/* Minimize */
|
||||||
result = SDL_MinimizeWindow(window);
|
if (VideoSupportsWindowMinimizing() && SDL_MinimizeWindow(window)) {
|
||||||
if (result) {
|
|
||||||
SDLTest_AssertPass("SDL_MinimizeWindow()");
|
SDLTest_AssertPass("SDL_MinimizeWindow()");
|
||||||
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
|
SDLTest_AssertCheck(result == true, "Verify return value; expected: true, got: %d", result);
|
||||||
|
|
||||||
|
|
@ -2304,6 +2342,11 @@ static int SDLCALL video_createMinimized(void *arg)
|
||||||
int windowedX, windowedY;
|
int windowedX, windowedY;
|
||||||
int windowedW, windowedH;
|
int windowedW, windowedH;
|
||||||
|
|
||||||
|
if (!VideoSupportsWindowMinimizing()) {
|
||||||
|
SDLTest_Log("Skipping creating mimized window, %s reports window minimizing as unsupported", SDL_GetCurrentVideoDriver());
|
||||||
|
return TEST_SKIPPED;
|
||||||
|
}
|
||||||
|
|
||||||
/* Call against new test window */
|
/* Call against new test window */
|
||||||
window = SDL_CreateWindow(title, 320, 200, SDL_WINDOW_MINIMIZED);
|
window = SDL_CreateWindow(title, 320, 200, SDL_WINDOW_MINIMIZED);
|
||||||
if (!window) {
|
if (!window) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue