SDL: test: Don't expect a specific error message (e8aa9)

From e8aa9551cbb91108d7576f2eb5000779ee68fcc7 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Sat, 20 Dec 2025 00:56:07 +0000
Subject: [PATCH] test: Don't expect a specific error message

SDL3 + sdl2-compat doesn't give precisely the same error message as
"classic" SDL2 here. To facilitate the transition from "classic" SDL2
to sdl2-compat, allow either one. This allows the "classic" SDL2 test
suite to be run against sdl2-compat, demonstrating that sdl2-compat is
indeed compatible with the version that it's replacing.

Signed-off-by: Simon McVittie <smcv@debian.org>
(cherry picked from commit c795b08567c4c030d0771c4ecccc4ee05a7831e4)
---
 test/testautomation_surface.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/test/testautomation_surface.c b/test/testautomation_surface.c
index 575ebcfb41060..9b200a74584dd 100644
--- a/test/testautomation_surface.c
+++ b/test/testautomation_surface.c
@@ -768,29 +768,24 @@ int surface_testOverflow(void *arg)
 
     if (sizeof(size_t) == 4 && sizeof(int) >= 4) {
         SDL_ClearError();
-        expectedError = "Out of memory";
         /* 0x5555'5555 * 3bpp = 0xffff'ffff which fits in size_t, but adding
          * alignment padding makes it overflow */
         surface = SDL_CreateRGBSurfaceWithFormat(0, 0x55555555, 1, 24, SDL_PIXELFORMAT_RGB24);
         SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width + alignment");
-        SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
-                            "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
+        SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), "") != 0, "Error indicator should be set");
         SDL_ClearError();
         /* 0x4000'0000 * 4bpp = 0x1'0000'0000 which (just) overflows */
         surface = SDL_CreateRGBSurfaceWithFormat(0, 0x40000000, 1, 32, SDL_PIXELFORMAT_ARGB8888);
         SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * bytes per pixel");
-        SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
-                            "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
+        SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), "") != 0, "Error indicator should be set");
         SDL_ClearError();
         surface = SDL_CreateRGBSurfaceWithFormat(0, (1 << 29) - 1, (1 << 29) - 1, 8, SDL_PIXELFORMAT_INDEX8);
         SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height");
-        SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
-                            "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
+        SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), "") != 0, "Error indicator should be set");
         SDL_ClearError();
         surface = SDL_CreateRGBSurfaceWithFormat(0, (1 << 15) + 1, (1 << 15) + 1, 32, SDL_PIXELFORMAT_ARGB8888);
         SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height * bytes per pixel");
-        SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
-                            "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
+        SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), "") != 0, "Error indicator should be set");
     } else {
         SDLTest_Log("Can't easily overflow size_t on this platform");
     }