Commit Graph

648 Commits (9b8208c195d11d54cb53e55d5588c8e5a0c52351)

Author SHA1 Message Date
Sam Lantinga 2fa2f9ff77 Greatly improved Nintendo Joy-Con support using the HIDAPI driver
* Added support for mini-gamepad mode for Joy-Con controllers, matching the mapping for hid-nintendo on Linux and iOS 16
* Added the ability to merge left and right Joy-Con controllers into a single Pro-style controller
* Added the hint SDL_HINT_JOYSTICK_HIDAPI_SWITCH_COMBINE_JOY_CONS to control this merging functionality
* Removed the hint SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS
2022-07-28 19:22:27 -07:00
Cameron Gutman b8a5540740 testgamecontroller: Add battery reporting 2022-07-24 15:21:04 -05:00
Anonymous Maarten ac9e8691a2 cmake: only build testnative when X11 is available 2022-07-21 14:49:35 +02:00
Sam Lantinga 7e2a996958 Added a virtual joystick automated test
Useful to verify 4fa2653394 on a big-endian system
2022-07-13 08:58:15 -07:00
Francisco Javier Trujillo Mata 643f9e56d0 Rename folder created in test_filesystem 2022-07-03 09:24:55 -07:00
Cameron Cawley 0a600b1df4
Merge testguid into testautomation (#5873) 2022-07-01 16:27:51 -07:00
Cameron Cawley 0025621b80 Add a default URL in testurl 2022-07-01 13:54:17 -07:00
Sam Lantinga 391dd0d94b Don't spin as quickly as possible in the checkkeys rendering loop 2022-07-01 13:35:41 -07:00
Sam Lantinga e9d5060c4c checkkeys will now render text that is input
Also added test functions for multi-line debug text display

Currently this only supports ASCII, as the font doesn't have the correct Latin-1 characters
2022-07-01 12:56:47 -07:00
Sam Lantinga 24251fb544 Fixed checkkeys closing when tapping the screen on a phone 2022-06-29 17:40:45 -07:00
Sam Lantinga cbd0187475 Removed the limit on the size of the SDL error message
Also added SDL_GetOriginalMemoryFunctions()

Fixes https://github.com/libsdl-org/SDL/issues/5795
2022-06-27 16:59:50 -07:00
chalonverse 3b191580c3
Windows GDK Support (#5830)
* Added GDK

* Simplfied checks in SDL_config_wingdk.h

* Added testgdk sample

* Added GDK readme

* Fixed error in merge of SDL_windows.h

* Additional GDK fixes

* OpenWatcom should not export _SDL_GDKGetTaskQueue

* Formatting fixes

* Moved initialization code into SDL_GDKRunApp
2022-06-27 10:19:39 -07:00
Francisco Javier Trujillo Mata 84d69da4e1 Initial SDL_ps2_main implementation 2022-06-27 00:32:43 -07:00
Anonymous Maarten 965c164537 cmake: let cmake test script make use of the installed cmake scripts 2022-06-23 14:17:38 +02:00
Anonymous Maarten 3e1021239a cmake: also add the recently-added include folder to the public interface 2022-06-22 17:04:58 +02:00
Sam Lantinga 9065897514 Added test for digit count in sscanf, e.g. "%1x" 2022-06-18 06:53:05 -07:00
Sam Lantinga 28ecdc6bc7 No need to cast from char* to const char* 2022-06-18 06:52:46 -07:00
Sam Lantinga 5d5488ca71 Fixed test/versioning.sh on macOS 2022-06-16 12:41:31 -07:00
Francisco Javier Trujillo Mata 580416d3c8 Initial CMake configuration 2022-06-15 15:15:26 -07:00
Pierre Wendling 6bd3e0b189 Test: Check sqrt and atan against the epsilon.
On i686-linux, the `sqrt_regularCases` and `atan_limitCases` tests would
fail as the result was not precise enough.
2022-06-15 23:32:40 +03:00
Pierre Wendling cee47a9ebe Test: Use inexact helper for log10 regular cases.
On ARMv6, the result is not precise enough for this function.
2022-06-15 12:05:30 -07:00
Pierre Wendling a52b8580f0 Test: Tidy up test descriptions and documentation.
Test function documentation now lists the input(s) and expected output(s).
Descriptions in TestCaseReference were updated.
2022-06-15 12:05:30 -07:00
Pierre Wendling 4d7f12f6bd Test: Add Atan2 tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 8ebe640a36 Test: Change inexact tests to use an epsilon.
Instead of using `trunc` to check the first ten digits, inexact test now
relies on an epsilon defining an acceptable range for the expected
result to be in.
2022-06-15 12:05:30 -07:00
Pierre Wendling 62fd6aad39 Test: Add Atan tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 6a6e93bc29 Test: Add +/-0.0 tests to Acos. 2022-06-15 12:05:30 -07:00
Pierre Wendling 6b4b6d8e59 Test: Add Asin tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 43f6983a24 Test: Add Acos tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 95f6edb9a5 Test: Refactor trigonometric tests into a helper.
The precision test of these functions need a special helper, it can also
be used for their arc functions down the line.
2022-06-15 12:05:30 -07:00
Pierre Wendling 3b9f47b85f Test: Remove early return in pow test. 2022-06-15 12:05:30 -07:00
Pierre Wendling 6be430c7f7 Test: Add Tan tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling af79b46f9e Test: Add Sin tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling b06eda55e9 Test: Fix math suite build on Win32.
The cosine precision test now uses an array of double and the result
gets truncated instead of casted to signed int64.
2022-06-15 12:05:30 -07:00
Pierre Wendling adb445eafb Test: Add Cos tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling a864180cf3 Test: Add float header for FLT_RADIX definition. 2022-06-15 12:05:30 -07:00
Pierre Wendling 7a55fa4e56 Test: Add Scalbn tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling afd812374f Test: Add Sqrt tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling c389c32d30 Test: Change assertion type in range tests.
Changes SDLTest_AssertPass(...) to SDLTest_AssertCheck(SDL_FALSE, ...)
for failed assertions so the internal counter gets updated properly.
2022-06-15 12:05:30 -07:00
Pierre Wendling 5ecc75a4fc Test: Add Pow tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 6349ad7319 Test: Add Log10 tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 7041bbaf00 Test: Add Log tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling dd30ff2e31 Test: Add Exp tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling aacb5e1774 Test: Extract range test parameters into defines. 2022-06-15 12:05:30 -07:00
Pierre Wendling 75b9aab6c1 Test: Add Fmod tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 0dbdf90e7b Test: Use SDLCALL in typedefs instead of ifdefs.
Thanks to @sezero for the tip.
2022-06-15 12:05:30 -07:00
Pierre Wendling 2ec48b36ba Test: Fix OS/2 compilation in math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 43c22e5d1e Test: Refactor math suite duplicate code.
Many tests were using the same underlying routine, as such three helper
functions were added:
- A wrapper to test double -> double functions.
- A wrapper to test (double, double) -> double functions,
- A wrapper for range tests on double -> double functions.
2022-06-15 12:05:30 -07:00
Pierre Wendling 3d720ba381 Test: Refactor math suites edge cases.
Split infinity and zero checks in their own functions.
The result of NAN tests is now logged.
The SDL_TestCaseReference structure were renamed to be more explicit.
2022-06-15 12:05:30 -07:00
Pierre Wendling a530fc9199 Test: Add Copysign tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 48a406db4d Test: Add Fabs tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 2130dff0fc Test: Add Round tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 324b96153f Test: Add Trunc tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling b09266a4ef Test: Add Ceil tests to math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 9eb09d2392 Test: Refactored and formatted math test suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling 0f630e9177 Test: fix indentation in Makefile.in. 2022-06-15 12:05:30 -07:00
Pierre Wendling 4e3a26e271 Test: Add math test suite to autotools. 2022-06-15 12:05:30 -07:00
Pierre Wendling e64acb619a Test: Fix for-loop for OS/2 in math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling a3a852e912 Test: Unrolled the array of cases in math suite.
On OS/2, `INFINITY` is a `const double` which cannot be used to
instantiate an array.
2022-06-15 12:05:30 -07:00
Pierre Wendling c23216bf46 Test: Removed static from local variables (Math).
Static would break compilation on OS/2.
2022-06-15 12:05:30 -07:00
Pierre Wendling 6646edf692 Test: Fix Windows build for math suite. 2022-06-15 12:05:30 -07:00
Pierre Wendling d9ff6380ae Test: Add math test suite to Watcom Makefile. 2022-06-15 12:05:30 -07:00
Pierre Wendling 7389eba943 Test: Fix C89 declaration and math include. 2022-06-15 12:05:30 -07:00
Pierre Wendling b3faebb8a8 Test: Add Floor tests to math. 2022-06-15 12:05:30 -07:00
Pierre Wendling b72b5d0f99 Test: Add math automation test suite. 2022-06-15 12:05:30 -07:00
Anonymous Maarten 97711e99fe cmake: no need to explicitly add a depency (target_link_libraries does this implicitly) 2022-06-15 11:11:49 -07:00
Anonymous Maarten ad21c70408 cmake: fix CMP0072 warning by prefering GLVND 2022-06-15 11:11:49 -07:00
Ozkan Sezer 163f669745 minor tidy-up to configury. 2022-06-15 17:00:02 +03:00
Simon McVittie e974985998 test: Add test coverage for surface size overflows
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-13 11:53:53 -07:00
Simon McVittie 63b3b9a558 Fix some typos in diagnostic messages
Detected by Debian's packaging QA tool, Lintian.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-13 08:33:27 -07:00
Eric Wasylishen 2830895740 testgles2.c: refresh cached SDL_GL_GetDrawableSize() on SDL_WINDOWEVENT_SIZE_CHANGED, not SDL_WINDOWEVENT_RESIZED
Fixes bug with viewport not updating when moving window between monitors with different scale
factors on Windows (this should also fix the same issue on other OS'es, though untested)
2022-06-11 14:19:01 -07:00
Eric Wasylishen df36f926fc testautomation: add video_setWindowCenteredOnDisplay test 2022-06-11 14:19:01 -07:00
Sam Lantinga 51d6d60f11 Updated to autoconf 2.71 2022-06-08 10:14:36 -07:00
Sam Lantinga 30cf26e089 Show the firmware version in testgamecontroller 2022-06-06 06:59:54 -07:00
Christoph Reichenbach 46624b4e1d Removed two distracting gcc-11 warnings 2022-06-05 14:11:10 +03:00
Christoph Reichenbach 3a20274ddf Refactoring: move GUID operations out of Joystick
- SDL_JoystickGUID -> SDL_GUID (though we retain a type alias)
- Operations for GUID <-> String ops are now in
  src/SDL_guid.c and include/SDL_guid.h
- The corresponding Joystick operations delegate to SDL_guid.c
- Added test/testguid.c
2022-06-04 17:22:13 -07:00
Christoph Reichenbach 4e07d4722d Build warning fixes for gcc-11.3 2022-06-04 17:41:00 +03:00
Sam Lantinga 345efdcb10 Wait for all the threads to actually finish before exiting
Fixes https://github.com/libsdl-org/SDL/issues/5748
2022-06-03 08:46:08 -07:00
Cameron Cawley 4c711d2d43 testcustomcursor: Allow running without custom or system cursors 2022-05-25 14:25:54 -07:00
Simon McVittie a95f5a792c test: Use install(1) more portably
I had assumed that only Linux users would be interested in GNOME-style
installed-tests, but in principle there's no reason why they can't be
used on non-Linux.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-20 22:22:20 +03:00
Ozkan Sezer 848d2008c6 test/Makefile.w32: fix minor typo 2022-05-20 21:10:56 +03:00
Cameron Cawley 83ae1b4987 Convert the test executables to AIF in RISC OS CMake builds 2022-05-19 15:26:13 -07:00
Cameron Cawley d2b5965894 Remove extra path separator in GetNearbyFilename 2022-05-19 15:25:49 -07:00
Cameron Cawley aa51a9791a Run tests with OpenWatcom on CI 2022-05-19 20:11:10 +03:00
Cameron Cawley 9dfa000bc0 Initial support for building for Windows with OpenWatcom 2022-05-19 20:11:10 +03:00
Cameron Cawley 5ef36ead08 Add some missing tests to Watcom builds 2022-05-19 20:11:10 +03:00
Cameron Cawley 3066873126 Split the common code in test/Makefile.os2 into a separate file 2022-05-19 20:11:10 +03:00
Cameron Cawley 0cca71a846 Use SDLCALL for callbacks in public APIs 2022-05-18 15:01:27 -07:00
Sam Lantinga 0ffd985972 Check to see if the file exists in the base path before returning it 2022-05-18 10:10:51 -07:00
pionere c4cf63f812 improve test-configuration
- testkeys 'NEEDS_DISPLAY'
- 'disable' relevant tests in case DUMMY audio/video is disabled
2022-05-18 09:06:56 -07:00
pionere ea15253220 fix GetNearbyFilename
- fix memory leak due to variable 'base'
- fix usage of uninitialized variable (path)
2022-05-18 08:30:34 -07:00
Ryan C. Gordon a12ffbd532 testcustomcursor: Log the current cursor type as it changes.
So you know what you're looking at.
2022-05-17 12:49:36 -04:00
Sam Lantinga 1f2a241688 Add new virtual joysticks to the end of the list
This guarantees that the device index that's returned is stable, as long as no joystick hotplug events occur.
2022-05-16 09:02:35 -07:00
Sam Lantinga 3c3ccb1d48 Fixed crash if a virtual joystick was disconnected 2022-05-16 08:56:17 -07:00
Sam Lantinga f0bc5c9cbf Added effects support for virtual controllers 2022-05-16 07:21:28 -07:00
Sam Lantinga e3fd8feae6 Fixed getting the controller index when specifying --virtual (thanks @zturtleman) 2022-05-16 06:17:23 -07:00
Sam Lantinga 94eeb587c1 First pass at extending virtual controller functionality
Added the ability to specify a name and the product VID/PID for a virtual controller

Also added a test case to testgamecontroller, if you pass --virtual as a parameter
2022-05-15 20:01:12 -07:00
Simon McVittie d15f6e379c test: Add a unit test for overflow detection
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-09 21:31:39 -07:00
Cameron Cawley c71ee68b8a Fix enabling tests on platforms without testnative support 2022-05-08 17:38:48 -07:00
Cameron Cawley 318b5577f9 Delete gcc-fat.sh 2022-05-08 17:38:22 -07:00
Ozkan Sezer db36664f26 configure.ac: remove unnecessary AC_SUBST's added by commit 38ef678990 2022-05-05 18:55:02 +03:00
Simon McVittie ce502054ad test: Install GNOME-style installed-tests metadata
This allows these tests to be discovered and run by
gnome-desktop-test-runner.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Simon McVittie 38ef678990 test: Add a `make install` target for the tests
This makes it more convenient to compile them alongside SDL, install
them in an optional package and use them as smoke-tests or diagnostic
tools. The default installation directory is taken from GNOME's
installed-tests, which seems as good a convention as any other:
https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Simon McVittie 76a7b629bf test: Add some common code to load test resources
As well as reducing duplication, this lets the tests load their resources
from the SDL_GetBasePath() on platforms that support it, which is useful
if the tests are compiled along with the rest of SDL and installed below
/usr as manual tests, similar to GNOME's installed-tests convention.

Thanks to Ozkan Sezer for the OS/2 build glue.

Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Simon McVittie 40bef98f8b test: Add a mode to skip tests that involve arbitrary delays
This can be used as a quick acceptance test for CI workflows.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Simon McVittie 7d2808e30b test: Run selected noninteractive tests at build-time
In Autotools, these are run by `make -C ${builddir}/test check`.
In CMake, they're run by `make -C ${builddir} test` or
`ninja -C ${builddir} test` or `ctest --test-dir ${builddir}`.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Simon McVittie b299f74d05 test: Make testevdev succeed if the feature is disabled
"Not applicable" is more like success than it is like failure.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Simon McVittie 6fc7aa28e7 cmake: Add some missing test-cases
These were built by Autotools but not by CMake.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Simon McVittie 2a8297e427 workflows: Add a test to assert that all the version numbers agree
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Cameron Cawley b398a847be Add SDL_FLOATWORDORDER for older ARM toolchains 2022-05-04 09:52:11 -07:00
Susko3 f25a78eede Enable `SDL_TEXTEDITING_EXT` events in `checkkeys` test 2022-05-02 15:50:39 -07:00
Sam Lantinga 0687128c96 Reduce CPU usage in testgamecontroller 2022-04-29 20:57:17 -07:00
Eddy Jansson 5c1f5a7306 test: Correct invalid enum length.
Ensure that they can't break like this again.
2022-04-28 12:58:27 -07:00
Ryan C. Gordon 7d7ec9c951
x11: Remove XVidMode and Xinerama support.
Fixes #1782.
2022-04-26 23:17:13 -04:00
Sam Lantinga e551384a99 Added functions to get the platform dependent name for a joystick or game controller 2022-04-26 14:54:14 -07:00
Eddy Jansson 5bc2933425 test: Basic tests for SDL_FRectEquals
Based on the integer version. These tests mostly check that input
isn't mangled and that invalid input gives the expected negative
result.
2022-04-20 08:38:53 -07:00
Simon McVittie 68b6fff245 test: Copy utf8.txt to build directory
testiconv wants this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-12 11:01:20 -04:00
Simon McVittie b4256d03e9 testevdev: Adapt to a broader definition of keyboards
At the time I contributed this unit test, SDL had a relatively narrow
definition of what is a keyboard, approximately matching udev
ID_INPUT_KEYBOARD. Now it uses the equivalent of udev ID_INPUT_KEY,
which matches anything with keyboard keys, and not just reasonably
complete alphanumeric keyboards.

Fixes: 040bd7a9 "Fix udev not detecting ID_INPUT_KEY devices when udev is not running"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-12 10:59:53 -04:00
Simon McVittie c2946902fa testevdev: Recognise touchpads as such
At the time I contributed this unit test, SDL didn't understand Linux
touchpads, but now it does.

Fixes: 373216ae "Added support for touchpads in the Linux evdev code"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-12 10:59:53 -04:00
capehill 006a5a9e03 testgles2: Fix buffer object sizes 2022-04-05 13:05:51 -04:00
Christoph Reichenbach 6cd444f0fa Visualise scroll wheel events in testmouse 2022-04-02 20:50:21 -07:00
capehill 0dcfa92e4c testgles2: Call correct function to get shader info log and add link status checking 2022-03-27 09:44:48 -07:00
Ryan C. Gordon beecae31f6
testshader: use SDL_malloc instead of SDL_stack_alloc. 2022-03-26 08:42:09 -04:00
capehill d6122704e8 Initialize compile status variable and check also program link status 2022-03-26 08:38:42 -04:00
Sylvain 7f1feee02a
Fixed bug #2426 - SDL_RenderReadPixels result is unspecified and fails testautomation
Call SDL_RenderPresent after calling SDL_RenderReadPixels.
From "include/SDL_render.h":
"If you're using this on the main rendering target, it should be called after rendering and before SDL_RenderPresent()."
2022-03-21 10:20:04 +01:00
Ozkan Sezer 01663238dc testplatform.c: move static asserts out of TestTypes(). 2022-03-17 08:43:27 -07:00
Sylvain c44966b78b
Fixed bug #2691 - re-enable surface_testCompleteSurfaceConversion for ARGB2101010 2022-03-15 17:48:38 +01:00
IOBYTE 13756b5c72 Add X1 and X2 button support to mouse test 2022-03-04 12:09:08 -05:00
Sam Lantinga 18032979d8 Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks
This hint defaults off, but when it is enabled the mice will have a game controller mapping set up for Profile 3 (set in the Armoury Crate software)
2022-02-15 13:07:51 -08:00
Wouter Wijsman 4cb6181808 Do not build loadso test eboot for PSP 2022-02-10 19:01:15 +01:00
Sylvain 94e5c3f30e
testgesture: display device name with SDL_GetTouchName() 2022-02-08 11:40:39 +01:00
Ryan C. Gordon ca22b30e46
testgles2: Use vertex buffer objects instead of client-side arrays.
GLES2 always has them, and they work without hacks on Emscripten, unlike
client-side arrays.

I cleaned it up slightly, but this patch was mostly written by @bing2008.

Fixes #5258.
2022-01-24 22:41:41 -05:00
Ozkan Sezer 836a4ec7b1 updates to os/2 build 2022-01-08 22:35:02 +03:00
Ozkan Sezer 93cab32db3 minor update to test/Makefile.os2 2022-01-08 14:40:20 +03:00
Wouter Wijsman e0c5399119 Don't make psp eboot for testoffscreen 2022-01-06 13:33:17 -08:00
Wouter Wijsman eca198d519 Don't build an eboot for testgesture for PSP 2022-01-05 08:30:28 -08:00
Wouter Wijsman cd6cb959c0 Only copy resources to PSP eboot directory if it exists 2022-01-05 08:30:28 -08:00
Wouter Wijsman 9d0b4d85fc Don't build EBOOT files for all tests for PSP 2022-01-05 08:30:28 -08:00
Wouter Wijsman b2ca62f23a Make sure all tests have the resources they need 2022-01-05 08:30:28 -08:00
Wouter Wijsman fcb638ff90 Copy test resources to correct directory on PSP 2022-01-03 10:39:15 -08:00
Wouter Wijsman 5e84f6384f Rename test directories for PSP and only build PRX if asked 2022-01-03 10:39:15 -08:00
Wouter Wijsman bf2336078c Make tests build for PSP and make them able to launch 2022-01-03 10:39:15 -08:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Ozkan Sezer 563ef2aeb2 regenerated configure scripts. 2021-12-01 01:56:50 +03:00
Ozkan Sezer efa1aa9a8f initial attempt at adding os2 support to autotools 2021-12-01 01:55:56 +03:00
Sam Lantinga 4b571c624c Added an option to map the touchpad button for Sony controllers 2021-11-29 09:00:26 -08:00
Ozkan Sezer ede73b4cfc testnativeos2.c: make its code style to match SDL2. 2021-11-28 23:02:02 +03:00
Sam Lantinga f1c15aa324 Tests cover the latest SDL features 2021-11-28 08:56:25 -08:00
Nate River 6c25aed419
added hint for joysticks to stablize sixaxis & dualshock controllers (#5007) 2021-11-27 11:01:18 -08:00
Ozkan Sezer d2871a348b testhaptic.c, testjoystick.c: fixed -Wshadow warnings. 2021-11-23 15:10:50 +03:00
Sam Lantinga e6a4230de9 Revert testevdev libc changes
This file uses internal SDL headers as a hack, without actually being built as part of SDL, so we should use normal C functions here.
2021-11-23 03:51:32 -08:00
Ozkan Sezer 3eaa80bb0b testgamecontroller.c: fixed -Wshadow warnings. 2021-11-23 14:22:02 +03:00
Ozkan Sezer 370b8318af testmouse.c: fixed -Wshadow warnings. 2021-11-23 14:01:10 +03:00
Sylvain f1582f549b Fix comment 2021-11-22 08:38:46 -08:00
Sylvain d31251b014 use SDL's functions version inplace of libc version 2021-11-22 08:38:46 -08:00
Ozkan Sezer fadf41fc6e remove excess whitespace 2021-11-20 21:55:20 +03:00
Ryan C. Gordon e86d4bde54
test: Makefile should copy unifont file, for testime.c to use. 2021-11-20 13:35:56 -05:00
Ozkan Sezer 495ee42a83 testcustomcursor.c: replaced libc sscanf with SDL_sscanf 2021-11-20 01:15:20 +03:00
Ozkan Sezer 990fb668f7 tests: several -Wwrite-strings fixes. 2021-11-20 01:02:02 +03:00
Cameron Gutman eb98ff4740 testmessage: Fix overread of stack variable 2021-11-13 13:05:02 -06:00
Ozkan Sezer 62b41f61d4 fix build of testmouse.c 2021-11-13 21:29:50 +03:00
Cameron Gutman f124259e59 testautomation: fix use-after-free when restoring hint value 2021-11-12 17:25:24 -06:00
Ozkan Sezer e688a95ba4 updated os2 makefile for tests 2021-11-12 23:55:40 +03:00
Misa 3bf7994fe2 Add and use `SDL_FALLTHROUGH` for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Clang before Clang 10 and GCC before GCC 7 have problems with using
__attribute__ as a sole statement and warn about a "declaration not
declaring anything", so fall back to using the /* fallthrough */ comment
if we are using those older compiler versions.

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-12 07:26:14 +03:00
Sam Lantinga abc12a832c Revert "Add and use `SDL_FALLTHROUGH` for fallthroughs"
This reverts commit 66a08aa391.

This causes problems with older compilers:
https://github.com/libsdl-org/SDL/pull/4791#issuecomment-966630997
2021-11-11 15:58:44 -08:00
Cameron Gutman fe09a4930a joystick: Add APIs to query rumble support 2021-11-11 15:10:08 -08:00
Misa 66a08aa391 Add and use `SDL_FALLTHROUGH` for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-11 07:23:25 -08:00
Sam Lantinga dc4c7d9539 Fixed infinite loop in SDL_vsnprintf() if the format string is too large for the output buffer
Fixes https://github.com/libsdl-org/SDL/issues/4940
2021-11-10 09:48:49 -08:00
Eric Wasylishen 0d98793693
testwm2: Fix video modes menu hit detection when highdpi or logical size used (#4936)
* SDLTest_CommonDrawWindowInfo: log SDL_RenderGetScale, SDL_RenderGetLogicalSize

* testwm2: fix video modes menu hit detection in High DPI cases

- also when logical size is specified, e.g.
  `--logical 640x480 --resizable --allow-highdpi`

* add function to determine logical coordinates of renderer point when given window point

* change since to the targeted milestone

* fix typo

* rename for consistency

* Change logical coordinate type to float, since we can render with floating point precision.

* add function to convert logical to window coordinates

* testwm2: use new SDL_RenderWindowToLogical

* SDL_render.c: alternate SDL_RenderWindowToLogical/SDL_RenderLogicalToWindow

Co-authored-by: John Blat <johnblat64@protonmail.com>
Co-authored-by: John Blat <47202511+johnblat64@users.noreply.github.com>
2021-11-09 21:03:42 -08:00
Sam Lantinga cdb4d8f22f Added a test case for snprintf of 0.0
This verifies regressions in https://github.com/libsdl-org/SDL/issues/4795
2021-11-07 09:39:57 -08:00
Eric Wasylishen a0e055a7f9 testwm2: add mode menu, click on a mode to call SDL_SetWindowDisplayMode 2021-11-07 08:42:09 -08:00
Sam Lantinga 35b0baaa7a Unfixed typo 2021-11-06 19:25:06 -07:00
Sam Lantinga 1d40c69a1b Fixed typo 2021-11-05 22:52:18 -07:00
Eddy Jansson e2ba84a532 testtimer: Be more like the C90's. 2021-11-03 00:22:06 -04:00
Eddy Jansson 4ab7ee1925 testtimer: Add basic sanity check for SDL_GetTicks*() 2021-11-03 00:22:06 -04:00
Ryan C. Gordon d78cb9e903 testtimer: added SDL_GetTicks64() calls. 2021-11-01 14:28:00 -04:00
Cameron Gutman 210713a600 cmake: Work around bug in opengl32.lib detection on MSVC ARM64 2021-10-31 17:57:40 -07:00
Cameron Gutman 77141e84e0 cmake: Fix test linking with MinGW 2021-10-31 17:57:40 -07:00
Cameron Gutman 618b0d414f cmake: Remove SDL2_test_resources dummy hack
It doesn't work properly on MSVC because the dummy target fails to link
2021-10-31 17:57:40 -07:00
Ozkan Sezer f3640e26a4 tests: minor update to acinclude.m4::pkg.m4 2021-10-31 08:47:00 +03:00
Ozkan Sezer cc3fe1a182 tests: don't fail configury if libunwind is not available. 2021-10-31 08:25:24 +03:00
Ozkan Sezer c401627793 testsurround.c: remove unnecessary libc includes and stdint.h types 2021-10-31 08:14:50 +03:00
Ozkan Sezer e28e399338 testsurround.c: add missing newline at end of file. 2021-10-31 08:00:20 +03:00
Cameron Gutman cd66c050fe testsurround: Add surround sound channel tester 2021-10-30 21:26:03 -07:00
Cameron Gutman 6b8e880a10 checkkeysthreads: Create a renderer for window display on Wayland
Applies checkkeys patch from 105f1206 to checkkeysthreads.
2021-10-26 20:27:34 -05:00
Ozkan Sezer 7ac0c73af2 regenerated test/configure 2021-10-25 21:40:04 +03:00
David Gow c57bcb47b1 test: Fix building with libunwind under autotools
There are two issues which are stopping the SDL tests from building on
my machine:
- libunwind is not being linked
- Even if it is, it is missing several symbols.

The first is fixed by having the test programs link against libunwind if
available. Technically, SDL2_test should be linking against it, as it's
used in SDL_test_memory.c, but as SDL2_test is a static library, it
can't itself import libunwind. We just assume that if it's present on
the system, we should link it directly to the test programs. This should
strictly be an improvement, as the only case where this'd fail is if
SDL2 was compiled when libunwind was present, but the tests are being
compiled without it, and that'd fail anyway.

The second is fixed by #define-ing UNW_LOCAL_ONLY before including
libunwind.h: this is required to make libunwind link to predicatable
symbols, in what can only be described as a bit of a farce. There are a
few more details in the libunwind man page, but the gist of it is that
it disables support for "remote unwinding": unwinding stack frames in a
different process (and possibly from a different architecture?):
http://www.nongnu.org/libunwind/man/libunwind(3).html

Note that I haven't tried this with CMake: I suspect that it'll work,
though, as the CMakeLists.txt seems to have SDL2 link against libunwind if
it's present. This adds an ugly extra dependency to SDL2, but does mean
that issue 1 isn't present. The UNW_LOCAL_ONLY change shouldn't be
build-system-specific.
2021-10-25 11:28:20 -07:00
Brick f30e2e438d Fix compiler warnings in testvulkan.c
MSVC gives the following warnings when compiling testvulkan.c:
```
testvulkan.c(656,1): warning C4018: '<': signed/unsigned mismatch
testvulkan.c(656,1): warning C4018: '>': signed/unsigned mismatch
testvulkan.c(660,1): warning C4018: '<': signed/unsigned mismatch
testvulkan.c(660,1): warning C4018: '>': signed/unsigned mismatch
```
2021-10-06 15:24:41 -07:00
Sylvain decd1b4d74
testdraw2: display FPS similarly to testsprit2. fix helper syntax 2021-09-23 22:28:45 +02:00
Sam Lantinga 79b0aae86c The return value of SDL_snprintf is the number of characters that would have been written.
Fixes https://github.com/libsdl-org/SDL/issues/4762
2021-09-22 11:46:24 -07:00
Sam Lantinga 42ae9116ad Getting "(null)" when formatted printing NULL is a valid result 2021-09-22 10:01:42 -07:00
Sam Lantinga a4a9d28461 You may need to wait a bit for SDL_WarpMouseInWindow() to complete 2021-09-22 09:56:06 -07:00
Sam Lantinga 94a42af570 Fixed the name of the verbose hints 2021-09-22 09:49:41 -07:00
Sam Lantinga b914bc3954 SDL_PIXELFORMAT_ARGB2101010 isn't fully supported for all surface conversion paths yet 2021-09-22 09:48:51 -07:00
Sam Lantinga e5d59fa77c Fixed building testgles2 on Linux 2021-09-22 09:31:26 -07:00
Sam Lantinga eb3bf80f9c Fixed compiler warnings using Visual Studio 2019 2021-09-21 18:15:09 -07:00
Ozkan Sezer e55b850703 minor tidy-up in os2 makefile for tests. 2021-09-20 23:50:02 +03:00
Ozkan Sezer e967f00271 testmouse.c: remove unused local var. 2021-09-10 00:01:20 +03:00
Cameron Cawley 830206581b Add testmouse 2021-09-09 13:46:58 -07:00
Ozkan Sezer 2c6f52d18c regenerate test/configure really with ac2.69 2021-09-06 15:24:50 +03:00
Simon McVittie 2e3a415bdc test: Use a static pattern rule to copy data to $(builddir)
The version with an implicit pattern rule tended to fail if test/
was built in an "out-of-tree" build directory not below test/, for
example:

    cd SDL
    mkdir _build-test
    ( cd _build-test; ../test/configure )
    make -C _build-test

as a result of the pattern rule first checking for axis.bmp, then for
../test/axis.bmp, then ../test/../test/axis.bmp, and so on until the
maximum path length was reached.

Note that this requires GNU make. The FreeBSD ports file for SDL seems
to use GNU make (gmake) already, so presumably SDL's build system is
already relying on GNU make extensions.

Signed-off-by: Simon McVittie <smcv@debian.org>
2021-09-06 15:23:10 +03:00