Commit graph

668 commits

Author SHA1 Message Date
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
Sam Lantinga a4ad293d4a Relicensed testutils to match other test code
Permission granted in 76a7b629bf (commitcomment-121408342)

(cherry picked from commit 6c2472d459602eb3c3ee109d6e8f255336109673)
2023-07-16 04:37:15 -07:00
Sam Lantinga 3054c0dc50 Fixed %p formatting when there is following text
(cherry picked from commit f4bd17deeeca6957d92979cf07fa436c249a9eda)
2023-07-06 08:37:27 -07:00
Sam Lantinga 1ab452fc57 Fixed printf formatting for "%p" and added a unit test to check it
(cherry picked from commit c63aa9545eb800390176fd2fd86036da81f91100)
2023-07-05 22:17:15 -07:00
Sam Lantinga a6ba8a1585 Removed spurious casts
(cherry picked from commit f73419e122ab0c2c7920b9de0921f5d6a464115d)
2023-07-03 16:11:02 -07:00
Ozkan Sezer 7f7ea909bc testautomation_guid.c: fix integer warning in 32 bit builds. 2023-05-31 04:50:02 +03:00
Sam Lantinga 7308325559 Added support for printing wide strings using "%ls" syntax
(cherry picked from commit 128ca7016018178c0c3231db7db2005dbf234068)
2023-05-26 14:59:30 -07:00
Ozkan Sezer feeec90873 test/testgles2_sdf.c: type fixes from commit e26e893daf, style clean-up. 2023-05-19 17:00:24 +03:00
Anonymous Maarten d361acdd4e testgles2_sdf: build with CMake + fix build errors/warnings 2023-05-19 15:24:52 +02:00
Ozkan Sezer 92a487f2e4 style fixes for SDL_PROC macros. 2023-05-19 14:10:02 +03:00
Anonymous Maarten d2a2787783 Fix remaining -Wimplicit-fallthrough warnings 2023-03-28 19:24:33 +02:00
Anonymous Maarten ec3e333fb8 testautomation_audio: fix -Wimplicit-fallthrough warning
(cherry picked from commit 11c70406c322b5686f35349acc9659c4d8d5a8f7)
2023-03-28 10:21:36 -07:00
Anonymous Maarten 03c239ded9 testsurround: fix channel names
Used table in include/SDL3/SDL_audio.h as reference.

(cherry picked from commit e1b8a032391f4b24453d5bcbe725a35b3894ea5d)
2023-03-28 10:21:35 -07:00
Anonymous Maarten 977781d3f4 testautomation_math: avoid equality tests with INFINITY
Fixes this warning:
 warning: comparison with infinity always evaluates to false in fast floating point modes [-Wtautological-constant-compare]
2023-03-27 06:13:28 +00:00
capehill 6ed29f47c9 testgles2_sdf: Call correct function to get shader info log
(cherry picked from commit b8c88cc58423b7e654b18fdaf1aab5a343114586)
2023-03-26 22:00:41 -07:00
Sylvain 2dddaa7dc9 backport x11/sdl2 fixes
4b1378f

X11: fix size/position (test video_setWindowCenteredOnDisplay)

this fix x11 backend to correctly pass video_setWindowCenteredOnDisplay()

    get border values early (eg status bar)
    wait for size/position change to get valid values

d4d26e0

testautomation_video: if SDL_SetWindowSize/Position isn't honored, we should check there is an event
x11: send the events if various occasions
2023-03-25 10:27:17 +01:00
Qrox ef347776c2 Uses integer arithmetics in SDL_ResampleAudio
- Avoids precision loss caused by large floating point numbers.
- Adds unit test to test the signal-to-noise ratio and maximum error of resampler.
- Code cleanup

(cherry-picked from commit 20e17559e545c5d3cfe86c1c4772365e70090779)
2023-03-10 18:37:00 +03:00
Ozkan Sezer 5e35309913 fix bad merge of sizeof style patch 2023-03-10 08:32:24 +03:00
Sam Lantinga 0d76380042 Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!)
(cherry picked from commit c6443d86c92e962683a1efe5f123a144988875b5)
2023-03-09 15:23:59 -08:00
Ozkan Sezer bc87983310 tests: added -DHAVE_SIGNAL_H to CFLAGS in watcom makefiles 2023-03-08 18:56:50 +03:00
Sylvain 17515f4aef Backport simplify flags PR #7220 2023-02-09 17:19:46 -08:00
Sam Lantinga 0479df53ca Updated copyright for 2023 2023-01-09 09:48:21 -08:00
Sam Lantinga b8d5fa4aef Improved handling of binding buttons and axes
(cherry picked from commit 71f3bf90edce26083056215124e65881f6c6ad26)
2023-01-03 12:50:20 -08:00
Sylvain 8e72be3117
testime.c: fix wrong {} in switch 2022-12-15 14:39:05 +01:00
Pierre Wendling e580e087ff N3DS: Backport semaphore fixes from #6776. 2022-12-11 17:09:28 -08:00
Ozkan Sezer bcccbbd894 tests: avoid redefinition warnings for MSVC _CRT_???_NO_DEPRECATE macros 2022-12-05 00:35:32 +03:00
Pierre Wendling d0bbfdbfb8 Clang-Tidy fixes (#6725)
(cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
2022-12-01 13:08:50 -08:00
Sam Lantinga b8d85c6939 Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594

(cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
2022-11-30 12:57:41 -08:00
Sylvain Becker fb0ce375f0 Cleanup add brace (#6545)
* Add braces after if conditions

* More add braces after if conditions

* Add braces after while() conditions

* Fix compilation because of macro being modified

* Add braces to for loop

* Add braces after if/goto

* Move comments up

* Remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements after merge

* Fix inconsistent patterns are xxx == NULL vs !xxx

* More "{}" for "if() break;"  and "if() continue;"

* More "{}" after if() short statement

* More "{}" after "if () return;" statement

* More fix inconsistent patterns are xxx == NULL vs !xxx

* Revert some modificaion on SDL_RLEaccel.c

* SDL_RLEaccel: no short statement

* Cleanup 'if' where the bracket is in a new line

* Cleanup 'while' where the bracket is in a new line

* Cleanup 'for' where the bracket is in a new line

* Cleanup 'else' where the bracket is in a new line

(cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
2022-11-28 12:33:03 -08:00
Sylvain 3e70553c48 Unneed test before calling SDL_FreeSurface 2022-11-18 06:58:34 -08:00
Sylvain 71f2864b3a
Fix usage of sizeof() in test/testgles*.c files 2022-11-17 14:55:49 +01:00
Sylvain ddad901c0d
Remove unneeded semicolon 2022-11-17 10:43:45 +01:00
Sylvain b7358e47d5
Don't compare pointer against '0', but NULL 2022-11-17 09:18:49 +01:00
Sylvain 4192d1a1c7
Fix compilation. It needs to be casted to 'int' type 2022-11-16 21:56:19 +01:00
Sylvain ce5da5d579
Don't compare pointer against '0', but NULL 2022-11-16 21:47:43 +01:00
Anonymous Maarten 55534e277e cmake: add time out to tests to avoid ci timeouts 2022-11-16 15:42:08 +01:00
Anonymous Maarten a22fcf77fd cmake: older emscripten releases have a broken FindOpenGL.cmake
This is fixed since 3.1.10: 485a7b4d6f (diff-034f4d123f23ec5493d0fbf28cba1c36e404a991f286c8d031a22799e4e8b0e5)
2022-11-16 15:42:08 +01:00
Anonymous Maarten d8884b845e emscripten: fix warnings in tests 2022-11-16 15:42:08 +01:00
Anonymous Maarten a71e558d85 cmake: testshader needs -sLEGACY_GL_EMULATION on Emscripten 2022-11-16 15:42:08 +01:00
Anonymous Maarten cfa76973ff cmake: FindOpenGL.cmake shipped by emscripten does not have OpenGL::GL 2022-11-16 15:42:08 +01:00
Anonymous Maarten 76e3cf3840 cmake: use custom add_sdl_test_executable macro to add test 2022-11-16 15:42:08 +01:00
Pierre Wendling d080e3bf3a Silence -Wmaybe-uninitialized warnings in tests. 2022-11-14 21:23:08 -08:00
Sam Lantinga 0dfc829a6b Added simple BLE Steam Controller support on all platforms
This is still disabled by default via the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM
2022-11-10 19:17:04 -08:00
Ozkan Sezer db01016dd6 revert replace AM_PATH_SDL2 usage with corresponding PKG_CHECK_MODULES.
Reference issue: https://github.com/libsdl-org/SDL/issues/6494 .
2022-11-07 21:15:30 +03:00
Ozkan Sezer 64c93f7804 replace AM_PATH_SDL2 usage with corresponding PKG_CHECK_MODULES. 2022-11-06 23:51:04 +03:00
Sam Lantinga da478d1f66 Fixed build 2022-10-25 10:30:56 -07:00
Simon McVittie 2dc788cb9f build: Expand version info in SDL_REVISION and SDL_GetRevision()
Instead of using a URL and git sha1, this uses `git describe` to
describe the version relative to the nearest previous git tag, which
gives a better indication of whether this is a release, a prerelease,
a slightly patched prerelease, or a long way after the last release
during active development.

This serves two purposes: it makes those APIs more informative, and it
also puts this information into the binary in a form that is easy to
screen-scrape using strings(1). For instance, if the bundled version of
SDL in a game has this, we can see at a glance what version it is.

It's also shorter than using the web address of the origin git
repository and the full git commit sha1.

Also write the computed version into a file ./VERSION in `make dist`
tarballs, so that when we build from a tarball on a system that doesn't
have git available, we still get the version details.

For the Perforce code path in showrev.sh, output the version number
followed by the Perforce revision, in a format reminiscent of
`git describe` (with p instead of g to indicate Perforce).

For the code path with no VCS available at all, put a suffix on the
version number to indicate that this is just a guess (we can't know
whether this SDL version is actually a git snapshot or has been
patched locally or similar).

Resolves: https://github.com/libsdl-org/SDL/issues/6418
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-22 09:27:10 -07:00
Brad Smith f4e3af15a1 Simplify OSS test by removing OpenBSD specific location of the soundcard.h header
OpenBSD has long since stopped using OSS. Remove checking for OpenBSD specific header.
2022-10-17 07:18:47 -07:00
Simon McVittie 7d230af51d testevdev: Explain why the test data is encoded the way it is
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 19:20:40 +03:00
Simon McVittie 81dee31949 testevdev: Add a static assertion for supported sizeof(long)
If this assertion fails on some platform (unlikely), we will need a
third implementation for SwapLongLE().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 19:20:40 +03:00
Helge Deller fb32effd15 testevdev: Fix detection of word size
The check for whether to use a 32- or 64-bit swap for an array of long
values always took the 64-bit path, because <limits.h> wasn't included
and therefore ULONG_MAX wasn't defined. Turn this into a runtime check,
which a reasonable compiler will optimize into a constant.

This fixes testevdev failures on 32-bit big-endian platforms such as hppa
and older powerpc. Little-endian and/or 64-bit platforms are unaffected.

[smcv: Added commit message]
Bug-Debian: https://bugs.debian.org/1021310
Co-authored-by: Simon McVittie <smcv@collabora.com>
2022-10-11 14:33:34 -07:00
Pierre Wendling c1317175b4 PSP: Fix Wformat warnings. 2022-10-10 22:31:16 -07:00
Pierre Wendling 6784d84c9d N3DS: Fix -Wformat warnings in tests.
All warnings were about invalid specifiers. Since U/Sint32 is a long,
using `%d` emits a -Wformat warning.
2022-10-10 08:50:59 -07:00
Pierre Wendling 655275378d N3DS port (squashed)
A dedicated renderer using Citro3D would likely allow for better
much better graphical performances.
2022-10-10 08:50:59 -07:00
Cameron Gutman ec1137dfbd cmake: Apply CETCOMPAT fix from ef988fe1 to tests 2022-10-09 15:19:47 -05:00
Ozkan Sezer d022039529 testhaptic: fix watcom "&array may not produce intended result" warning 2022-10-09 12:01:02 +03:00
Anonymous Maarten b8a4b8d1cd testautomation_mouse: fix format '%i' expecting 'int' instead of 'Uint32'
Emitted by Nintendo 3DS's gcc
2022-10-08 23:41:07 +02:00
Anonymous Maarten 7ae5d8d406 testmessage: fix conversion from intptr_t to Uint32
Emitted by MSVC
2022-10-08 23:41:07 +02:00
Anonymous Maarten 02b200ef08 testoffscreen: fix '<': signed/unsigned mismatch
Emitted by MSVC
2022-10-08 23:41:07 +02:00
Anonymous Maarten 7a7980fafa testnative: fix conversion from time_t to unsigned int
Emitted by MSVC
2022-10-08 23:41:07 +02:00
Anonymous Maarten 8770689525 testmouse: add explicit int-cast to avoid warning about converting float to int
Emitted by MSVC
2022-10-08 23:41:07 +02:00
Anonymous Maarten 3c251ec41e testintersections: fix conversion from time_t to unsigned int
Emitted by MSVC
2022-10-08 23:41:07 +02:00
Anonymous Maarten b771d9beec tests: avoid MSVC preaching about unsafe functions 2022-10-08 23:41:07 +02:00
Anonymous Maarten ebae142aa4 testhaptic: fix conversion from size_t to int
Emitted by MSVC
2022-10-08 23:41:07 +02:00
Anonymous Maarten 18c776e155 testspriteminimal: fix conversion from time_t to unsigned int
Emitted by MSVC
2022-10-08 23:41:07 +02:00
Anonymous Maarten f3389f13ef testgeometry: fix conversion from 'double' to 'float', possible loss of data
emitted by MSVC
2022-10-08 23:41:07 +02:00
Anonymous Maarten 45da133999 cmake: don't error on apple when using deprecated declarations 2022-10-08 23:41:07 +02:00
Anonymous Maarten 274ec02581 testautomation: avoid format related warnings by using a few pragma's
ci: enable -Werror to a few platforms
2022-10-08 23:41:07 +02:00
Anonymous Maarten d04fa0ef76 controllermap: use enum to avoid '-Wmaybe-uninitialized'
Emitted by MinGW:

In function 'WatchJoystick',
    inlined from 'SDL_main' at D:/a/SDL/SDL/test/controllermap.c:802:9:
D:/a/SDL/SDL/test/controllermap.c:437:9: warning: 'marker' may be used uninitialized [-Wmaybe-uninitialized]
  437 |         SDL_SetTextureAlphaMod(marker, alpha);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/a/SDL/SDL/test/controllermap.c: In function 'SDL_main':
D:/a/SDL/SDL/test/controllermap.c:355:71: note: 'marker' was declared here
  355 |     SDL_Texture *background_front, *background_back, *button, *axis, *marker;
2022-10-08 23:41:07 +02:00
Anonymous Maarten a905db9d65 testcustomcursor: fix Wswitch warning by casting the arg to an int 2022-10-08 23:41:07 +02:00
Anonymous Maarten bb527678a3 testgamecontroller: fix -Wshadow warning by renaming global axis+button textures 2022-10-08 23:41:07 +02:00
Anonymous Maarten 57c886551f automation_main.c: fix -Wformat-zero-length warning due to SDL_SetError("") 2022-10-08 23:41:07 +02:00
Anonymous Maarten be5f55c47e watcom: add ENABLE_WERROR option to makefiles 2022-10-08 23:41:07 +02:00
Anonymous Maarten 335c672498 autotools: add --enable-werror option 2022-10-08 23:41:07 +02:00
Sam Lantinga 64ea6cefaf SDL_ResetHint() no longer clears the callbacks associated with a hint
Also added SDL_ResetHints() to reset all callbacks, and clarified that SDL_ClearHints() is just used for cleanup at shutdown.

Fixes https://github.com/libsdl-org/SDL/issues/6313
2022-10-02 17:17:31 -07:00
Sam Lantinga 19ecb64e0d Fixed build 2022-10-02 10:18:57 -07:00
Sam Lantinga a00565b8ba Fixed displaying more than 18 buttons 2022-10-02 09:20:12 -07:00
Ethan Lee 0d6c4ff622
testaudioinfo: Initialize deviceName unconditionally 2022-09-29 11:36:07 -04:00
Ethan Lee 1ea1a90edb testaudioinfo: Also test SDL_GetAudioDeviceSpec 2022-09-29 10:41:40 -04:00
Jarod Hillman 40893821f2 coreaudio: Add support for SDL_GetDefaultAudioInfo (#6277)
Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
2022-09-29 10:33:07 -04:00
Ryan C. Gordon d843d61cc1
Moved test/versioning.sh to build-scripts/test-versioning.sh
Reference Issue #6171.
2022-09-28 09:09:43 -04:00
Sam Lantinga 2c518747b9 Added microsecond timestamp to sensor values for PS4 and PS5 controllers using the HIDAPI driver 2022-09-27 09:56:49 -07:00
Cameron Cawley 3a6b7c9c69 testiconv: Print the total number of errors at the end 2022-09-24 08:58:51 -07:00
Sam Lantinga 7312b93d32 Fixed crash if a game controller is disconnected while the connect message is in flight 2022-09-22 22:50:28 -07:00
Sam Lantinga c70ffc2a35 Added size_t format specifier test coverage for SDL_snprintf and SDL_sscanf 2022-09-19 15:34:17 -07:00
Ozkan Sezer c833294817 tests, watcom: silence lots of W202 warnings from new vulkan headers. 2022-09-18 17:33:04 +03:00
Cameron Cawley dd51787e07 Fix SDL_PIXELFORMAT_INDEX1LSB test case 2022-09-17 13:18:32 -07:00