Commit graph

654 commits

Author SHA1 Message Date
Anonymous Maarten 811adaa342 Only test error message when using specific video drivers
The dummy driver does not sen an error message when passing
a NULL rect argument to SDL_SetTextInputRect.
2024-01-21 23:44:53 +01:00
Sylvain 5368f45567 Remove one test that contains call of SDL_Quit() / SDL_Init() because it
conficts with the initializaion of test common.
(before it used SDL_VideoInit SDL_VideoQuit which weren't perturbated by SDL_Quit())
2024-01-21 23:44:53 +01:00
Sylvain 3d5679bb8e Fix video_getSetWindowPosition() that fail when checking events,
because testautomation_events.c() didn't finish to poll all events before

(cherry picked from commit 3ccfd361cb4ff081f7696e5fbc4174f5d4aa1ca1)
2024-01-21 23:44:53 +01:00
Sam Lantinga e3203278f4 Updated tests so they'll pass if we enable the C runtime in SDL2.dll
This isn't needed here, but will be necessary for sdl2-compat
2024-01-21 11:23:50 -08:00
Simon McVittie 0d9719964f testautomation_surface: Make sure error is set by the function we expect
If the error behaviour in one of these cases was wrong, that could have
been hidden by the error indicator remaining set from a previous test.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-18 13:22:11 -08:00
Simon McVittie e8075179e0 testautomation_surface: Really make width * bpp overflow
A surface of width (0x7fff'ffff) / 2 = 0x3fff'ffff is not quite large
enough to make the pitch overflow in the way we wanted to test here:
with a 32-bit format, that makes each row 0xffff'fffc bytes, which
(just) fits in a 32-bit unsigned size_t. Increasing it to 0x4000'0000
pixels per row is enough to trigger the overflow we intended to test.

In SDL 2, this test bug was hidden by the fact that allocating
0xffff'fffc bytes on a 32-bit platform is very likely to fail, and SDL 2
reported both "malloc() failed" and "this amount of memory is too large
for a size_t" with the same error code.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-18 13:22:11 -08:00
Simon McVittie 62d063f735 testautomation_surface: Really make pitch + alignment overflow
Adding 3 bytes of alignment to 0x7fff'ffff is not enough to make it
overflow a 4-byte unsigned size_t, so this test was not exercising
the intended failure mode. We cannot actually make this overflow
with a signed 32-bit width and an 8-bit format: the maximum width is
not enough to achieve that. However, if we switch to a 24-bit format,
we can make the calculation overflow.

In SDL 2, this test bug was hidden by the fact that allocating
0x7fff'ffff bytes on a 32-bit platform will usually fail, and SDL 2
reported both "malloc() failed" and "this amount of memory is too large
for a size_t" with the same error code.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-18 13:22:11 -08:00
Ozkan Sezer f52a12a8fe remove several instances of unnecessary emptry str "" after SDL_PRI??? 2024-01-18 17:25:56 +03:00
Sylvain 01fa4dd9d1 Fixed ASAN warning, runtime error: left shift of 160 by 24 places cannot be represented in type 'int'
(cherry picked from commit cf0d1d7234e4ce1cc05d4e0ff1517c33363dfe7b)
2024-01-11 09:02:19 -08:00
Simon McVittie 4f2c7328d6 test: Use AUDIO_F32SYS for native-endianness
AUDIO_F32 is an alias for AUDIO_F32LSB, 32-bit floating point with least
significant byte first, resulting in audio_resampleLoss() failing on
big-endian machines. This particular test generates a buffer with
native-endianness float values, so it ought to be using AUDIO_F32SYS,
which is 32-bit floating point in the native endianness.

Already fixed by commit 47bcb078 "Fixed some incorrect SDL_AUDIO_F32 uses"
on the SDL 3 branch.

Resolves: https://github.com/libsdl-org/SDL/issues/8818
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-10 06:10:23 -08:00
Ozkan Sezer 2afd04d09b test/acinclude.m4 (AM_PATH_SDL2): apply recent sdl2.m4 PKG_CONFIG patch 2024-01-09 17:11:10 +03:00
Simon McVittie 69f3bb2e34 test: Accept small numerical differences in more mathematical tests
We can't rely on irrational numbers like pi being represented exactly,
particularly when compiling for i386, where the i387 floating-point
interface carries out calculations in registers that have higher
precision than the actual double-precision variable. The 1980s were a
strange time.

Resolves: https://github.com/libsdl-org/SDL/issues/8311
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 6248472c0c738496a6f246aafa07a0e30afa6a01)
2024-01-09 06:06:46 -08:00
Anonymous Maarten d1c5038f16 testautomation: don't do float equality tests
(cherry picked from commit 474c8d0073b0fb4b14b65b79c7e620db1332e4f3)
2024-01-09 06:06:46 -08:00
Sam Lantinga f62d1220ac Restore the previously initialized subsystems after the Init/Quit test
Fixes https://github.com/libsdl-org/SDL/issues/8796
2024-01-08 14:32:52 -08:00
Sam Lantinga 4c11307a4e Only initialize audio drivers that have been requested
If testautomation is running with only a specific audio driver enabled, we shouldn't try to open other ones, as they might fail.

Fixes https://github.com/libsdl-org/SDL/issues/8797
2024-01-08 13:38:29 -08:00
Anonymous Maarten 3ff56fda1a testautomation: only require accelerated renderer with non-dummy video driver
Backported from SDL3 commit 85e3099b.

Co-authored-by: Simon McVittie <smcv@collabora.com>
Resolves: https://github.com/libsdl-org/SDL/issues/8799
2024-01-08 11:01:06 -08:00
Sam Lantinga 0fc3574464 Updated copyright for 2024 2024-01-01 13:19:49 -08:00
Sylvain 9720672374 Fix compilation / same as sdl2-compat
testautomation_platform.c:351:28: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  351 |     result = SDL_SetError("%s", testError);
      |                            ^~
/home/slvn/release/Release_SDL/sdl2-compat/test/testautomation_platform.c:364:64: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  364 |                             "SDL_GetError(): expected message '%s', was message: '%s'",
(cherry picked from commit 56f111dffc2828d67fd8e0402b0fe1193c48ce26)
2023-12-20 22:29:51 +03:00
Ozkan Sezer 5773c347d5 test/watcom.mif: disable W201 warning for testautomation_stdlib.c. 2023-12-17 20:51:10 +03:00
Ozkan Sezer 3ac69c6210 test/watcom.mif: remove a stale rule. 2023-12-17 20:51:02 +03:00
Sam Lantinga d622c3c9cc Verify that the %p format specifier works for 64-bit pointers
(cherry picked from commit 7f75178908355046e37d908648c44cf4d4625f09)
2023-12-17 08:15:19 -08:00
Frank Praznik cc6d8eb72b tests: Fix whitespace 2023-12-12 17:17:00 -05:00
Frank Praznik a78cdbd7e3 tests: Backport automated video test changes
Changes to the SDL3 video system required some changes to the test suite since the video system always reports the true window size and position.

While SDL2 doesn't directly require these changes, they are needed for SDL2-Compat and committed here to keep the two test suites in sync.
2023-12-12 16:10:44 -05:00
Sam Lantinga 7d94121606 You should call present when using a software renderer as well.
Fixes https://github.com/libsdl-org/SDL/issues/8676

(cherry picked from commit 581d1cab257a14cd235df2192f012abb0d4e36e0)
2023-12-11 08:44:11 -08:00
Anonymous Maarten 0134672345 cmake: copy sources to binary directory in separate target
Don't do it in POST_BUILD to avoid multiple parallel builds
stepping on each others toes.
Also don't use copy_if_different, but unconditionally copy it.
The build system should take care of dependencies.

SDL2 backport of fea6e7afb1c13326f463aef47ecd26396d1e3a2f
2023-11-28 23:03:30 +01:00
Ryan C. Gordon d8102bf660
x11: Deal with difference in GLX_EXT_swap_control_tear behavior.
Mesa and Nvidia handle it differently, and one or the other may fix their
implementation in the future, so test which way it works at runtime.

Reference Issue #8004.

(cherry picked from commit 74a25425646d64edeff508ec8e99622a41576905)
2023-11-23 18:17:25 -05:00
Anonymous Maarten baaac5cca3 cmake: Android expects SDL programs to be built as shared libraries 2023-11-23 03:39:36 +01:00
Sam Lantinga 2d81beb819 Show the mapping used when a game controller is opened 2023-11-21 13:49:38 -08:00
Cameron Cawley 67eb03400a Add SDL_PIXELFORMAT_INDEX2LSB and SDL_PIXELFORMAT_INDEX2MSB 2023-11-20 15:50:51 -08:00
Ryan C. Gordon cb5b8c9747
testshader: Don't make local variables with the same name as GL entry points.
Reference Issue #2706.
2023-11-20 15:10:30 -05:00
Anonymous Maarten d81d986858
cmake: fix uses of undefined macro identifiers (-Wundef) 2023-11-17 03:06:26 +00:00
Sylvain Becker f3419d8c04
Re-add SDL_assert() with non boolean ptr syntax (#8531) 2023-11-11 12:29:05 +03:00
Sylvain Becker a14b948b6c
[SDL2] pointer boolean (#8523) 2023-11-10 06:30:56 -08:00
Anonymous Maarten adc0880520 cmake: also install pdb files of static libraries 2023-11-09 03:23:24 +01:00
Sam Lantinga 509c70c698 Allow the application to draw while Windows is in a modal move/resize loop
SDL will send an SDL_EVENT_WINDOW_EXPOSED event for your window during the modal interaction and you can use an event watcher to redraw your window directly from the callback.

Fixes https://github.com/libsdl-org/SDL/issues/1059
Closes https://github.com/libsdl-org/SDL/pull/4836
2023-11-08 14:01:00 -08:00
Ivan Mogilko d9559ce1d4 Added subsystem refcount tests to testautomation 2023-11-07 08:40:15 -08:00
Sam Lantinga 4194a902e8 Added support for "%[]" sscanf syntax
Fixes https://github.com/libsdl-org/SDL/issues/8423

(cherry picked from commit 39a961ba41430788774f1b8c0e6d63f7308116e7)
2023-10-24 17:32:23 -07:00
Anonymous Maarten 90255914a8 cmake: install pdb's when present 2023-10-22 18:53:34 +02:00
Frank Praznik 7010452062 tests: Disable mouse warp test under Wayland
Wayland does not allow warping the mouse pointer, thus these tests are unreliable and should be skipped.

(cherry picked from commit 9111c5e17843155019d444159a394ee480394056)
2023-10-09 12:58:22 -04:00
Frank Praznik c4a169a6fc Fix automated video tests under X11/Wayland
Backports of f30a182 and f8e8dff
2023-10-06 16:22:46 -04:00
Frank Praznik f9dc49c21c Fix automated tests using the dummy video driver
Manual backport of b8d9125
2023-09-30 11:21:10 -04:00
Anonymous Maarten 92dc226018 cmake: make sure SDL_GetPrefPath is run before testfilesystem
60 seconds timeout ought to be sufficient.
2023-09-10 15:33:22 +02:00
Anonymous Maarten 9d6b028e01 tests: build tests with fast math disabled 2023-08-09 02:53:48 +02:00
Anonymous Maarten fcae9cd210 cmake: build with -Wdocumentation 2023-08-09 02:53:48 +02:00
Sam Lantinga 1d8806b0fc Fixed testautomation --filter pixels_allocFreePalette
Error messages are not part of the ABI, so we can't validate those.

Hand-picked from c9323f8fac
2023-08-08 11:50:04 +03:00
Sam Lantinga e56dc9c30e Fixed testautomation --filter pixels_allocFreeFormat
Error messages are not part of the ABI, so we can't validate those.

Technically SDL_AllocFormat() on a FOURCC format in SDL2 should fail, but SDL3 supports it and we don't expect SDL2 applications to actually do this, so skip that test.

Hand-picked from 5cf9438f88
2023-08-08 11:50:04 +03:00
Ozkan Sezer 7cc3248044 minor os/2 stuff merged from the bitwiseworks' fork 2023-07-28 23:55:50 +03:00
Ozkan Sezer 3e341021c3 fixed typo in prev. patch. 2023-07-28 07:35:14 +03:00
Ozkan Sezer 1ecf77d630 test/testnativecocoa.m: fixed deprecation warnings. 2023-07-28 07:21:14 +03:00
Sam Lantinga ba0c270c7a Removed invalid assert in testatomic
(cherry picked from commit 8adab0b88ab1c0aa69242fffc48afdba085b1dc4)
2023-07-22 18:40:31 -07:00