Commit Graph

380 Commits

Author SHA1 Message Date
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
Ozkan Sezer 9837a327ff regenerated test/configure 2021-09-06 14:55:40 +03:00
Simon McVittie 91ce6019df test: Fix path used in AC_CONFIG_AUX_DIR
AC_CONFIG_AUX_DIRS is an undocumented, internal version of
AC_CONFIG_AUX_DIR that takes a whitespace-separated list, instead of a
single path to add to the list. It also does not automatically treat
the given path as being relative to the $srcdir, unlike the documented
AC_CONFIG_AUX_DIR.

Newer versions of autoconf treat the argument to AC_CONFIG_AUX_DIRS
as being literal (they do not expand the shell variable), causing
autoreconf to fail if $srcdir is explicitly specified. The argument to
AC_CONFIG_AUX_DIR is checked  relative to $srcdir anyway, so there is no
need to specify $srcdir a second time.

Resolves: https://github.com/libsdl-org/SDL/issues/4719
Signed-off-by: Simon McVittie <smcv@debian.org>
2021-09-06 14:55:10 +03:00
Ryan C. Gordon 79c7a1713f
testvulkan: reformatted to more-closely match SDL coding conventions. 2021-08-24 12:41:41 -04:00
Lionel Landwerlin b073d2753d test/vulkan: fix/workaround validation errors 2021-08-24 12:21:30 -04:00
Ryan C. Gordon abba181118
testvulkan: support multiple windows.
Fixes #4363.
2021-08-23 20:20:49 -04:00
Ozkan Sezer f5c0cdea38 testgeometry.c: fix build in c89 mode 2021-08-19 01:28:10 +03:00
Sylvain bc2173baf9 Add testgeometry to draw a non uniform triangle
--use-texture: an option to load icon.bmp as a texture
handle mouse motion: rotate the triangle
2021-08-19 00:10:59 +02:00
Sylvain 53bcb3e0e9 Add an option to 'testsprite2' to render slicing into triangles.
[--use-rendergeometry mode1|mode2]
mode1: Draw sprite2 as triangles that can be recombined as rect by software renderer
mode2: Draw sprite2 as triangles that can *not* be recombined as rect by software renderer
       Use an 'indices' array
2021-08-19 00:10:59 +02:00
David Gow fbc364908a Use the new SDL_clamp() macro where sensible
There were a few places throughout the SDL code where values were
clamped using SDL_min() and SDL_max(). Now that we have an SDL_clamp()
macro, use this instead.
2021-08-14 09:01:14 -07:00
David Gow 105f120615 checkkeys: Create a renderer for window display on Wayland
On Wayland -- or at least on some Wayland implementations -- windows
aren't shown until something has been rendered into them. For the
'checkkeys' test program, this means that keyboard input isn't
registered, making the program rather useless.

By creating a renderer and presenting once, the window is properly
displayed, and the test behaves as it does under X11 (including
XWayland).

The exact same thing was done with testmessge in 1cd97e2695 (PR #4252)
2021-08-13 08:29:17 -07:00
Sam Lantinga cb1e20b058 Added KMOD_SCROLL to track the scroll lock state
Fixes https://github.com/libsdl-org/SDL/issues/4566
2021-08-10 17:50:17 -07:00
David Gow 773e1ba19f testvulkan: Clamp the drawable size to the allowed range
SDL_Vulkan_GetDrawableSize() doesn't always return a size which is
within the Vulkan swapchain's allowed image extent range.

(This happens on X11 a lot when resizing, which is bug #3287)

Clamp the value we get back from SDL_Vulkan_GetDrawableSize() to this
range. Given the range usually is just a single value, this is almost
always equivalent to just using the min or max image extent, but this
seems logically most correct.
2021-08-08 18:06:15 -07:00
Cameron Cawley 520bc713e3 Fix typo in CMake target name 2021-08-05 10:31:43 -04:00
Sam Lantinga 9fdb06450d Added support for the Joy-Con Charging Grip when SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS is enabled 2021-08-04 11:34:06 -07:00
Sam Lantinga 3d74707830 Run the renderer so Steam can find the main window 2021-08-03 09:25:13 -07:00
Sam Lantinga 8726f500ef Allow quitting controllermap if there are no controllers attached 2021-08-03 01:10:48 -07:00
Sam Lantinga 65ff00ec1b Query the rate for the correct sensor (thanks @meyraud705) 2021-07-29 14:25:13 -07:00
Sam Lantinga a186a503e7 Added SDL_GameControllerGetSensorDataRate() to get the sensor update rate for a controller. 2021-07-29 06:43:39 -07:00
Sam Lantinga ce8261dd6d Only pump events once per frame and process all currently pending events
If you continually poll for events it's possible that new events can come in while you're still processing the last one, delaying rendering. This is more likely with high update rate sensors.
2021-07-29 06:36:20 -07:00
Sam Lantinga 51c61d7cdf Run the entire Cocoa messagebox function on the main thread.
This fixes bug https://github.com/libsdl-org/SDL/issues/4420
2021-07-27 14:57:18 -07:00
Sam Lantinga 7df6a9ea59 Add a test case for bug https://github.com/libsdl-org/SDL/issues/4469 2021-07-27 12:43:45 -07:00
Sam Lantinga 94b7a87645 Added SDL_GameControllerType enumerations for the Amazon Luna and Google Stadia controllers
Fixes bug https://github.com/libsdl-org/SDL/issues/4019
2021-07-24 09:10:18 -07:00
Vladislav Dmitrievich Turbanov f9bf1aeba8
Latest Unifont with OFL is now bundled. (#4268)
* * Latest Unifont with OFL is now bundled.

* * Added a Unifont license file.

Co-authored-by: Vladislav Dmitrievich Turbanov <vladislav@turbanov.ru>
2021-07-08 14:51:16 -07:00
Sam Lantinga d135c0762f Added SDL_GameControllerSendEffect() and SDL_JoystickSendEffect() to allow applications to send custom effects to the PS4 and PS5 controllers
See testgamecontroller.c for an example of a custom PS5 trigger effect
2021-07-08 13:22:41 -07:00
Eric Wasylishen c33e3c15fb testwm2: draw various debug logging into the window itself
Renderer output size, window position/size, display bounds, etc.
Uses new SDLTest_CommonDrawWindowInfo function in test_common.
2021-06-08 05:29:29 +03:00
Sam Lantinga 64c40b9028 Updated copyright date 2021-06-04 14:34:21 -07:00
Ozkan Sezer 37b093eaf2 test/checkkeysthreads: build fixes, and add to os2 makefile. 2021-06-05 00:05:56 +03:00
Francesco Abbate 0dd7024d55 Modifies WaitEvent and WaitEventTimeout to actually wait instead of polling
When possible use native os functions to make a blocking call waiting for
an incoming event. Previous behavior was to continuously poll the event
queue with a small delay between each poll.

The blocking call uses a new optional video driver event,
WaitEventTimeout, if available. It is called only if an window
already shown is available. If present the window is designated
using the variable wakeup_window to receive a wakeup event if
needed.

The WaitEventTimeout function accept a timeout parameter. If
positive the call will wait for an event or return if the timeout
expired without any event. If the timeout is zero it will
implement a polling behavior. If the timeout is negative the
function will block indefinetely waiting for an event.

To let the main thread sees events sent form a different thread
a "wake-up" signal is sent to the main thread if the main thread
is in a blocking state. The wake-up event is sent to the designated
wakeup_window if present.

The wake-up event is sent only if the PushEvent call is coming
from a different thread. Before sending the wake-up event
the ID of the thread making the blocking call is saved using the
variable blocking_thread_id and it is compared to the current
thread's id to decide if the wake-up event should be sent.

Two new optional video device methods are introduced:

WaitEventTimeout
SendWakeupEvent

in addition the mutex

wakeup_lock

which is defined and initialized but only for the drivers supporting the
methods above.

If the methods are not present the system behaves as previously
performing a periodic polling of the events queue.

The blocking call is disabled if a joystick or sensor is detected
and falls back to previous behavior.
2021-06-04 13:50:50 -07:00
Ozkan Sezer 646ddfb782 minor watcom build fixes. 2021-05-15 00:22:50 +03:00
Ozkan Sezer babd79b8ef bump minimum required autoconf version and revise autogen.sh 2021-04-14 23:20:40 +03:00
Ozkan Sezer 197cfcaf71 ran configure.ac through autoupdate-2.69
generated configure script is practically the same except for whitespace
changes.
2021-04-14 21:10:40 +03:00
Ryan C. Gordon da66755450
Fixed up legacy MoinMoin URLs at wiki.libsdl.org
Fixes #4064.
2021-04-01 12:20:33 -04:00
Ryan C. Gordon 2542977b0a
Revert "Update wiki.libsdl.org urls to libsdl-org/SDL/wiki (#4069)"
This reverts commit 82a96afa70.

We ended up not moving to GitHub's wiki after all and built
https://github.com/icculus/ghwikipp to fill the gap...since the wiki is
back at https://wiki.libsdl.org/, put back the original URLs.
2021-04-01 12:15:28 -04:00
Christian Rauch 570768f627 test: fix shadowing variables 2021-03-29 09:01:26 -07:00
Christian Rauch b972258d56 test: remove unused variables and typedefs 2021-03-29 09:01:26 -07:00
Christian Rauch 3f25704592 test: portable 64bit address format specifier 2021-03-29 09:01:26 -07:00
David Gow 1cd97e2695 testmessage: Create a renderer for window display on Wayland
On Wayland -- or at least on some Wayland implementations -- windows
aren't shown until something has been rendered into them. For the
'testmessage' test program, this means that the final messagebox (a
modal one) is blocking an "invisible window", which can then be
difficult to close.

By creating a renderer and presenting once, the window is properly
displayed, and the test behaves as it does under X11 (including
XWayland).
2021-03-29 08:50:30 -07:00
Sam Lantinga 8b87b438b4 Don't try to map the touchpad button, since we don't have any art for that at the moment. 2021-03-26 13:01:06 -07:00
Ozkan Sezer e5821bf276 regenerated configure. 2021-03-18 00:10:00 +03:00
Vanfanel e6b87005c1 Fix tests configuration and building when only GLVND full OpenGL implementation is present. 2021-03-17 12:33:22 -07:00
Ozkan Sezer 9d46bd25c7 revert commit 81cdb1bb0d (unifont license issue.) 2021-03-11 17:00:10 +03:00
Ozkan Sezer 81cdb1bb0d test: add unifont-9.0.02.hex as a resource (so it works out-of-the-box)
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
2021-03-04 18:32:32 +03:00
Ozkan Sezer a52d0db532 test/CMakeLists.txt: add OpenGL module checks and adjust dependencies.
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
2021-03-04 18:28:10 +03:00
Ozkan Sezer e7abf96801 test/CMakeLists.txt: bump cmake minimum required to 3.0 for consistency
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
2021-03-04 18:28:04 +03:00
Ozkan Sezer a29fe29296 configury: replace host checks against *-*-mingw32* with *-*-mingw* 2021-02-18 20:10:50 +03:00
Cameron Cawley 9323cd51f0 Check for ARM SIMD in testplatform 2021-02-17 11:10:02 +03:00
Erik Yuzwa 82a96afa70
Update wiki.libsdl.org urls to libsdl-org/SDL/wiki (#4069) 2021-02-13 11:49:31 -05:00
Ryan C. Gordon 4ff51d29c3 Deprecate SDL_GetRevisionNumber and update things for git instead of hg.
Fixes #4063
2021-02-12 14:31:38 -05:00
Vladislav Dmitrievich Turbanov 31e8a4627a * Fixed closing the test window. 2021-02-11 14:20:01 -08:00
Cameron Gutman 6b057c6783 Expose separate keyboard and mouse grab support
This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(),
SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new
SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise
this functionality and makes a minor fix to X11 that I missed in
https://hg.libsdl.org/SDL/rev/02a2d609369b

To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to
SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards
compatibility with older code.
2021-02-10 10:22:17 -05:00
Ozkan Sezer d0c5097cdc minor autotools build system updates. 2021-01-24 00:51:25 -05:00
Sylvain Becker 4fbb9f31ab Fix declarations after statement 2021-01-24 00:51:24 -05:00
Sylvain Becker 0e7d435f13 Add basic testgles2_sdf program to demonstrate sign distance field with opengles2 2021-01-24 00:51:24 -05:00
Sam Lantinga c94283d404 testgamecontroller: log which controller the event came from 2021-01-13 11:01:54 -08:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Ozkan Sezer 88eaf356a7 minor update to test/acinclude.m4 (pkg.m4) 2020-12-30 15:53:20 +03:00
Ozkan Sezer 5ed3d21f6e testsem.c: fix -Wmissing-braces warnings. 2020-12-24 00:55:30 +03:00
Joel Linn 2b040cebbe Atomic test: Fix use after free
SDL_SemPost() was called by the FIFO threads after the semaphore was
freed because the main thread actually synchronized on the
`writerRunning`/`readersRunning` count and not the semaphores itself.
2020-12-23 13:36:23 -08:00
Joel Linn 6267b95177 Semaphore test: Add overhead tests. 2020-12-23 13:36:02 -08:00
Joel Linn 95a6d4e848 Semaphore test: Put test into separate function. 2020-12-23 13:35:35 -08:00
Ozkan Sezer 090fffac6a test/Makefile.os2: add warning switches to CFLAGS. 2020-12-24 00:29:40 +03:00
Ozkan Sezer 239c8f1f4c testvulkan.c: fix -Wmissing-braces warnings. also fix whitespace. 2020-12-24 00:28:50 +03:00
Ozkan Sezer 20ca1192d2 testgesture.c: comment out unused drawLine() 2020-12-24 00:26:32 +03:00
Ozkan Sezer b064028c2d testatomic.c: fix warnings due to SDL_AtomicDecRef() use 2020-12-24 00:25:40 +03:00
Sam Lantinga 390b2cf0d3 Enable PS5 enhanced functionality for testgamecontroller 2020-12-22 20:53:27 -08:00
Sam Lantinga 058a0ab47f Set the pad lights on the PS5 controller corresponding to the player index
Also allow setting the player index from testgamecontroller using the number keys
2020-12-22 14:38:32 -08:00
Ozkan Sezer b4b674dabb CMakeLists.txt: sync DYLIB_CURRENT_VERSION to Xcode project 2020-12-22 22:10:50 +03:00
Sam Lantinga 350f1b0d16 Updated SDL to version 2.0.15 for development 2020-12-22 10:36:15 -08:00