From d95b04feaf774d59f85d0d219473dd1b83101a45 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 15 Mar 2023 16:12:54 -0700
Subject: [PATCH] Fixed display ID check in video_setWindowCenteredOnDisplay
---
test/testautomation_video.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/test/testautomation_video.c b/test/testautomation_video.c
index 7cf46294bbf5..c333414cfa14 100644
--- a/test/testautomation_video.c
+++ b/test/testautomation_video.c
@@ -1582,7 +1582,7 @@ static int video_setWindowCenteredOnDisplay(void *arg)
SDL_Rect expectedDisplayRect;
/* xVariation is the display we start on */
- expectedDisplay = xVariation % displayNum;
+ expectedDisplay = displays[xVariation % displayNum];
x = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
y = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
w = SDLTest_RandomIntegerInRange(640, 800);
@@ -1604,7 +1604,7 @@ static int video_setWindowCenteredOnDisplay(void *arg)
SDL_GetWindowSize(window, ¤tW, ¤tH);
SDL_GetWindowPosition(window, ¤tX, ¤tY);
- SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay);
+ 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);
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
@@ -1619,7 +1619,7 @@ static int video_setWindowCenteredOnDisplay(void *arg)
SDL_GetWindowSize(window, ¤tW, ¤tH);
SDL_GetWindowPosition(window, ¤tX, ¤tY);
- SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay);
+ SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display ID (current: %d, expected: %d)", currentDisplay, expectedDisplay);
SDLTest_AssertCheck(currentW == expectedDisplayRect.w, "Validate width (current: %d, expected: %d)", currentW, expectedDisplayRect.w);
SDLTest_AssertCheck(currentH == expectedDisplayRect.h, "Validate height (current: %d, expected: %d)", currentH, expectedDisplayRect.h);
SDLTest_AssertCheck(currentX == expectedDisplayRect.x, "Validate x (current: %d, expected: %d)", currentX, expectedDisplayRect.x);
@@ -1642,10 +1642,10 @@ static int video_setWindowCenteredOnDisplay(void *arg)
/* Center on display yVariation, and check window properties */
- expectedDisplay = yVariation % displayNum;
+ expectedDisplay = displays[yVariation % displayNum];
x = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
y = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
- expectedDisplayRect = (expectedDisplay == 0) ? display0 : display1;
+ expectedDisplayRect = (yVariation == 0) ? display0 : display1;
expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2));
expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2));
SDL_SetWindowPosition(window, x, y);
@@ -1654,7 +1654,7 @@ static int video_setWindowCenteredOnDisplay(void *arg)
SDL_GetWindowSize(window, ¤tW, ¤tH);
SDL_GetWindowPosition(window, ¤tX, ¤tY);
- SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay);
+ 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);
SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);