Commit Graph

1836 Commits

Author SHA1 Message Date
Sam Lantinga 409f3ade88 Removed SDF test program
There's a much better example of SDF support in testgputext in SDL_ttf
2025-01-29 04:15:27 -08:00
Sam Lantinga 4176e188bf Enable testgles2 on all platforms
We use SDL's headers so we're not dependent on system OpenGL header availability.
2025-01-29 04:03:31 -08:00
Petar Popovic a336b62d8b Remove newlines from error messages 2025-01-23 11:45:04 -08:00
Petar Popovic 983cfe8b1c Remove even more newlines from log messages 2025-01-23 09:32:50 -08:00
nightmareci 718034f5fa Remove newlines from log messages 2025-01-22 20:25:04 -08:00
Anonymous Maarten cb3cc28809 emscripten: pass --no-sandbox to the chrome web driver
This fixes running the Emscripten tests on Ubuntu 24.04.
2025-01-22 02:48:32 +01:00
Anonymous Maarten efa6e7aece android: add style to test apk's 2025-01-21 20:20:17 +01:00
Sam Lantinga 9b454a762c Revert "testautomation: don't validate alpha values on XRGB formats"
This reverts commit 759e01bd64.

It's better to return the expected format from SDL_RenderReadPixels() than skip alpha testing.
2025-01-20 12:57:48 -08:00
Frank Praznik 819628c6bf
testautomation: Remove Win32 borderless resizable hint
This defaults to 'true' now, so setting it manually is no longer necessary.
2025-01-20 14:49:35 -05:00
Sam Lantinga 759e01bd64 testautomation: don't validate alpha values on XRGB formats
The results are not defined, and some renderers set 0xFF always and other renderers set the alpha to blend results, even though it won't be used when rendering.

Fixes --filter render_testBlendModes with D3D renderers
2025-01-20 11:29:41 -08:00
Sam Lantinga 362f96a6cf testcontroller: use SDL_MAIN_USE_CALLBACKS so updates happen during live resizing 2025-01-20 10:11:31 -08:00
Sam Lantinga b716eeefef testtray: minor cleanup 2025-01-19 18:53:55 -08:00
Ryan C. Gordon 874c07f8de storage: Don't allow "." and ".." paths, enforce '/' dir separators.
Also clarify what characters are valid for Storage paths in the category docs.

Fixes #11079.
Fixes #11370.
Fixes #11369.
2025-01-16 08:19:28 -05:00
Ryan C. Gordon 67664a0427 testfilesystem: test some Storage APIs, too. 2025-01-16 08:19:28 -05:00
Ryan C. Gordon 87e1b0eb89 filesystem: SDL_EnumerateDirectory() gives dirs with path seperators appended.
Fixes #11065.
Fixes #11427.
2025-01-16 08:19:28 -05:00
Ramez Ragaa e98ee9bb04 Adjust testgl.c to test gl_release_behavior 2025-01-16 08:19:05 -05:00
Evan Hemsley fb6df93384
GPU: Add name properties to resources (#11946) 2025-01-13 17:29:08 -08:00
Ozkan Sezer 307dac97ac testcontroller.c: fix build errors due to -Wformat after commit b524af1 2025-01-12 22:00:02 +03:00
Sam Lantinga b524af1b43 testcontroller: log the ID of gamepads as they are added and removed 2025-01-12 10:02:39 -08:00
Frank Praznik 6b776a9989 keyboard: Add some SDL keycodes for common Xkb keys
Add SDL keycodes for keys found commonly found in the default Xkb layout, such as left tab and compose, and keys frequently used for custom modifiers such as Meta, Hyper, and Level5 Shift.

As these keys aren't Unicode code points and don't have associated scancodes (at least on modern keyboards), they are placed in the new extended key code space, with bit 30 set as a flag.
2025-01-09 17:26:41 -05:00
Ryan C. Gordon 3f7f632e14
audio: Added SDL_AudioDeviceStreamPaused.
We had the other two wrapper functions to pause and resume, and forgot query.
2025-01-09 01:36:57 -05:00
Ryan C. Gordon f61860fa93
testautomation: fixed incorrect test.
The test was doing this:

- The output size is 80x60
- The logical size is 40x30
- The viewport is { 10, 7, 40, 30 }
- Draw to fill this whole viewport.

This would offset the filled rectangle a little, as before, but then the
viewport was the size of the entire logical space, so it wasn't a rectangle
centered in the middle of the output, as was expected.

This used to produce the expected output before the fix in
fa7a529912. But it appears the test was
incorrect, so this tweaks the viewport to produce the expected result.
2025-01-08 23:33:39 -05:00
Frank Praznik f2f04e825d
tests: Fix get/set window size test being skipped
A return check conversion was missed when the SDL_* functions were converted to return boolean values instead of int, which caused this test to be skipped.
2025-01-08 11:02:45 -05:00
Ryan C. Gordon b674b715f5
fix integer overflow ub in testautomation_sdltest
(cherry-picked from commit f804293a27)
2025-01-06 13:18:03 -05:00
Ryan C. Gordon 6a0405b933
testautomation: Added a test to stdlib_swprintf that previously would fail. 2025-01-05 02:45:15 -05:00
Anonymous Maarten efba42a67b tests: avoid undefined signed overflow 2025-01-04 01:06:29 +01:00
Anonymous Maarten 53aaf8c26b cmake: custom generate-XXX targets must depend on outputs 2025-01-04 00:19:45 +01:00
Sam Lantinga a8c41135aa Enable themed Windows dialogs when building with Visual Studio 2025-01-03 09:25:10 -08:00
Ryan C. Gordon e484182765
testcamera: Log the camera backend in use. 2025-01-03 03:46:22 -05:00
Sam Lantinga 9f7b2c3595 Fixed incorrect error message when a joystick can't be opened 2025-01-02 17:18:09 -08:00
Erik Soma c6b5c21aaf clipboard: Ensure SDL_ClearClipboardData clears data even when no data has been set 2025-01-02 07:23:27 -08:00
Anonymous Maarten b713e7581b stdlib: fix SDL_strtol of "0" with base 0
SDL_strtol("0") skipped the "0" octal prefix
and returned a failure because the remainder of the string was empty.
2025-01-02 01:15:28 +01:00
Sam Lantinga e43aa12b49 Updated copyright for 2025 2025-01-01 08:01:29 -08:00
Sam Lantinga f2074d7af3 Updated copyright for 2025 2025-01-01 07:45:52 -08:00
Sam Lantinga 3197e27b59 testcamera: fixed return codes 2024-12-31 19:27:11 -08:00
Sam Lantinga f18e023317 Added testclipboard 2024-12-31 19:27:11 -08:00
Sam Lantinga 1c04ebe423 Renamed SDL_ASYNCIO_CANCELLED to SDL_ASYNCIO_CANCELED 2024-12-30 19:13:02 -08:00
Anonymous Maarten 543f244965 tests: include SDL_build_config.h when HAVE_BUILD_CONFIG is defined 2024-12-29 20:08:06 +01:00
Ozkan Sezer c2121dd9a2 testcamera: fix MSVC build failure due to C4244 warning. 2024-12-29 21:28:02 +03:00
Sam Lantinga 5c84d38822 testcamera: don't pick a frame size larger than the maximum texture size
Ran into this on a Huawei Y6 phone, where the back facing camera can generate 4160x2000 frames, but the maximum texture size was 4096x4096
2024-12-29 09:41:00 -08:00
Anonymous Maarten f1232de3d2 cmake: add_dependencies must have at least 2 arguments 2024-12-28 02:43:12 +01:00
Anonymous Maarten 2664d36faf cmake: avoid parallel generation of headers through intermediate target
See
https://cmake.org/cmake/help/latest/command/add_custom_command.html#example-generating-files-for-multiple-targets
2024-12-28 02:39:12 +01:00
Sam Lantinga 75a24116b5 testcontroller: show gamepad connection state 2024-12-27 13:58:49 -08:00
Semphris 0461180e25 SDL_EVENT_QUIT when no window nor tray
SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE will not fire if there are active tray icons. This impacts only applications that create tray icons, and that at least one icon outlives the last visible top-level window. SDL_EVENT_QUIT will fire when the last active tray is destroyed if there are no active windows.
2024-12-27 09:22:27 -08:00
Sam Lantinga 948b16533c testcamera: use the first available cameras 2024-12-26 19:23:43 -08:00
Semphriss 01b9b0edb7
Add system tray support (#10873) 2024-12-24 10:36:39 -08:00
capehill 80c1b1e1a0 Fix testautomation pixels_saveLoadBMP big endian issue
It seems created surfaces are ARGB8888 format on both BE and LE,
therefore BGRA32 failed.
2024-12-22 12:08:54 -08:00
Sam Lantinga cadeec9cc9 SDL_SoftStretch() doesn't handle large pixel formats
Fixes https://github.com/libsdl-org/SDL/issues/11534
2024-12-21 09:19:03 -08:00
Sam Lantinga f37eef948c Removed raw mouse events
It's too close the 3.2.0 release for an API change like this.

If/when we re-add these, some things for consideration:
* What use cases does this enable that aren't currently possible?
* What cross-platform API guarantees do we make about the availability of these events? e.g. do we try to simulate them where raw input isn't actually available?
* How is this different from the existing relative mode, and how do we clearly explain when you want these events vs wanting relative mode?

Notes from @expikr:
First observation: the reason I originally passed denominators instead of multipliers was because some rational values cannot be exactly represented by floats (e.g 1/120) so instead let the end-developer decide how to do the dividing themselves. It was the reason why it was using split values with an integer numerator to begin with, instead of having both as floats or even just normalize it in advance.

On the other hand, passing them as multipliers might have hypothetical uses for dynamically passing end-user controlled scaling in a transparent manner without coupling? (Though in that case why not just do that as additional fields appended to `motion` structs in an API-compatible layout?)

So it’s somewhat of a philosophical judgement of what this API of optional availability do we intend for it to present itself as:
- should it be a bit-perfect escape hatch with the absolute minimally-denominal abstraction over platform details just enough to be able to serve the full information (á la HIDPIAPI),
- or a renewed ergonomic API for splitting relative motion from cursor motion (in light of The Great Warping Purge) so that it is unburdened by legacy RelativeMode state machines, in which case it would be more appropriate to just call it `RELATIVE` instead of `RAW` and should be added alongside another new event purely for cursor events?

This alternate API stream was conceived in the context of preserving compatibility of the existing RelativeMode state machine by adding an escape hatch. So given the same context, my taste leans towards the former designation.

However, as The Great Warping Purge has made it potentially viable to do so, if I were allowed to break ABI by nuking the RelativeMode state machine entirely, I would prefer the latter designation unified as one of three separate components split from the old state machine, each independently controlled by platform-dependent availability without any state switching of a leaky melting pot:
- cursor visibility controls (if platform has cursor)
- cursor motion events (if platform has cursor)
- relative motion events (if the platform reports hardware motion)
2024-12-21 05:18:42 -08:00
Sam Lantinga c44fa5bb07 Updated raw input events to match SDL style
Also added raw keyboard events, and implemented raw input events on iOS, OpenBSD console, Linux console, and X11
2024-12-21 05:18:42 -08:00
Frank Praznik 5ec5f23fff
tests: Print accurate enabled/disabled relative mode status in testrelative 2024-12-20 10:57:12 -05:00
cosmonaut 0f9e86fe1c tests: Fix GPU tests crashing when window is minimized 2024-12-19 16:21:50 -08:00
cosmonaut e46d8756e5 tests: Update GPU tests to use new swapchain best practice 2024-12-19 15:55:04 -08:00
Frank Praznik 4bfc8f84f7
tests: Add a raw event mode to testrelative
Add a code path to test raw motion events (activated by '--raw').
2024-12-19 14:14:36 -05:00
Sam Lantinga e08f34c3be Removed SDL_HINT_MOUSE_RELATIVE_MODE_WARP
This complicated mouse handling and is a rarely tested path. Real relative mode is much better performance and higher precision.
2024-12-19 10:33:02 -08:00
Frank Praznik eda0261c4e video: Drop size and position requests for windows in a fixed size/position state
It is not uncommon for clients to redundantly set the window size and position, either as a holdover from an SDL 1 port, when this was required, due to any window state change triggering a universal update function that sets all window state, even if unnecessary (e.g. always calling SDL_SetWindowSize(), even if the window is fullscreen), or due to the use of compatability layers. Historically, these clients expect that their behavior won't override the base window state, which is an assumption that the windowing changes in SDL 3 broke by caching size and position changes that can't be applied immediately.

This change drops size and position requests when the window is in the maximized and fullscreen states (fullscreen-desktop windows will be repositioned, but the non-fullscreen floating position will not be overwritten), which is behavior more in line with existing client assumptions, and should ease the porting process, as well as prevent annoying bugs when older software is run via sdl2-compat.

In the process of making these changes, pending window state has been moved to separate variables in the SDL_Window struct, as this fixes bugs regarding fullscreen display selection and centering windows immediately after resize on asynchronous platforms, which had issues due to pending state possibly being overwritten.
2024-12-17 10:45:40 -05:00
Ryan C. Gordon 1fbb8e1824
examples/audio/04-multiple-streams: Remove drag-and-drop support.
I'm going to reuse that code for an actual drag/drop example later, but for
simplicity and accessibility of the examples, this is just going to load two
wavs and loop them, so you get the music with a sword-clinking sound mixed
over it.
2024-12-10 23:10:43 -05:00
Sam Lantinga 900627f7fc Enable the SDL_HINT_MOUSE_DOUBLE_CLICK_TIME and SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS hints on macOS
Fixes https://github.com/libsdl-org/SDL/issues/4000
2024-12-06 17:07:16 -08:00
Sam Lantinga 23828b62d4 Added SDL_IsMainThread() and SDL_RunOnMainThread() 2024-12-05 13:53:51 -08:00
Ryan C. Gordon 3ca629ceb5 asyncio: Allow file closes to request a flush/fsyncdata. 2024-12-03 17:32:20 -05:00
Ryan C. Gordon e79ce2a200 asyncio: Added async i/o APIs. 2024-12-03 17:32:20 -05:00
Ryan C. Gordon f852038384 filesystem: Added SDL_GetCurrentDirectory().
Fixes #11531.
2024-11-27 23:42:11 -05:00
Sam Lantinga e027b85cc4 Validate that pixel formats have the correct attributes
Also added a test to save and load as BMP format to make sure pixel transformations are working correctly.

Fixes https://github.com/libsdl-org/SDL/issues/11483
2024-11-17 11:58:57 -08:00
Ryan C. Gordon e4778d53d3
testautomation_video: Another Emscripten test to be skipped. 2024-11-14 19:34:25 -05:00
Ryan C. Gordon d48d4c8c48
testautomation_video: Don't test window position on Emscripten.
This _might_ fix GitHub Actions. We'll know once I push this!  :)
2024-11-14 19:00:10 -05:00
cosmonaut a85f0b49f4 GPU: Remove D3D11 shaders from testgpu_spinning_cube 2024-11-12 17:32:25 -08:00
L zard 1ed1bc1d5d testautomation keyboard: use `space` instead of `a` 2024-11-08 07:01:50 -08:00
capehill 588e32ea5a test: Change LoadContext() return value type from int to bool
It should be then consistent with SDL_SetError().
2024-11-05 14:22:57 -08:00
Sam Lantinga ecfd143a26 testcontroller: update the controller name when it's opened as a gamepad 2024-11-05 11:43:28 -08:00
Sam Lantinga 0ef7a1d901 Show the guid of gamepads that are opened 2024-11-05 11:43:28 -08:00
Wouter Wijsman 780578cd36 PSP: Allow building tests in parallel 2024-11-01 08:57:09 -04:00
Sam Lantinga 77a0411dde Minor cleanup 2024-10-31 15:44:41 -07:00
Sam Lantinga 850158f83f testcontroller: fixed incorrect usage of memcpy() 2024-10-24 18:12:01 -07:00
Sam Lantinga 370c0426ce testspriteminimal: only quit when escape is pressed 2024-10-23 10:51:14 -07:00
Sam Lantinga 45584ad73e Simplify get_channel_name() so it's easier for people to read and understand 2024-10-22 18:19:30 -07:00
Sam Lantinga 315842cf71 Fixed crashes handling D3D11/12 device lost in testsprite
You can test this using "dxcap -forcetdr"
2024-10-21 00:29:18 -07:00
Petar Popovic 6897385623 Add `void` to `run_colorspace_test()` function prototype 2024-10-16 11:16:42 -07:00
Sam Lantinga afee27a530 Make sure stdio handles are in blocking mode
Standard I/O doesn't work well with non-blocking handles, so make sure any pipes are in blocking mode before launching child processes.

Fixes https://github.com/libsdl-org/SDL/issues/10998
2024-10-14 22:10:49 -07:00
Sam Lantinga bb764e3106 Added support for full range BT.709 YUV conversion
Also added simple colorspace testing to testyuv.
2024-10-14 20:36:46 -07:00
Zack Middleton f212cb5f92 Don't overwrite the SDL_IOFromConstMem() error in testshape 2024-10-14 20:07:03 -07:00
Ryan C. Gordon 44bc19b592
test: remove testaudio-art.txt (this info is in test/LICENSE.txt now). 2024-10-14 01:52:18 -04:00
Sam Lantinga d7be7fc168 Fixed Cohen-Sutherland out code computation for float line intersection
Fixes https://github.com/libsdl-org/SDL/issues/10866
2024-10-13 13:04:59 -07:00
Cameron Cawley 2bef8852fb testdrawchessboard: Allow using the standard render API 2024-10-12 16:07:16 -07:00
Cameron Cawley 94c8c170eb 3DS: Only bundle resources with tests that need them 2024-10-12 13:59:00 -07:00
Sam Lantinga c5904d8710 Improved implementation of SDL_DelayPrecise() (thanks @nightmareci!)
Fixes https://github.com/libsdl-org/SDL/issues/10592
2024-10-11 21:18:31 -07:00
Ozkan Sezer 41dfe2c246 test/testautomation_stdlib.c: fix gcc warning on 32 bit
test/testautomation_stdlib.c:361: warning: integer constant is too large for 'long' type
2024-10-10 21:10:24 +03:00
Frank Praznik 40ff6a2785 test: Fix mouse focus test on X11
X11 seems to need a slight delay before warping the pointer to ensure that the window is actually fully visible on the desktop, or the pointer enter event may not be sent.

This also disables the warp focus test on XWayland, as warping the mouse cursor when outside the window on any Wayland desktop usually just doesn't work.
2024-10-10 11:37:45 -04:00
Sam Lantinga 8262072d91 Fixed possible memset(NULL) call in testautomation's SDL_aligned_alloc() check
Fixes https://github.com/libsdl-org/SDL/issues/11144
2024-10-10 08:06:18 -07:00
Sam Lantinga c8f5f6d47a Added SDL_DelayPrecise()
SDL_DelayNS() now passes through to the high precision OS delay function, and SDL_DelayPrecise() tries to busy wait to get as close as possible to the desired wait time.

Fixes https://github.com/libsdl-org/SDL/issues/11141
2024-10-10 08:06:18 -07:00
Daniel Ludwig 5b6342a00d Default SDL_HINT_JOYSTICK_GAMEINPUT to "1" on GDK platforms 2024-10-09 07:30:13 -07:00
Daniel Ludwig ed87e7e434 test: enable GameInput driver on GDK platforms
By default, it's the only driver available on Xbox, but disabled.
2024-10-09 07:30:13 -07:00
Ryan C. Gordon 9f170286ba
test: Replace README with LICENSE.txt
Fixes #11097.
2024-10-06 19:05:18 -04:00
Sam Lantinga c358bf3f9b Removed test program list, it's better to just look at the code.
Fixes https://github.com/libsdl-org/SDL/issues/9399
2024-10-06 11:28:29 -07:00
Sam Lantinga f8dd73fdb9 Fixed build 2024-10-06 08:42:00 -07:00
Sam Lantinga 0f47d3a77b Fixed use after free (thanks @meyraud705!)
Fixes https://github.com/libsdl-org/SDL/issues/11090
2024-10-06 08:34:35 -07:00
capehill e159bcf5de test: Make blit_testExampleApplicationRender work on big endian
Changed image data pixel format to BGRA32.
2024-10-06 08:27:58 -07:00
Sam Lantinga 596ef1ba2e Moved the SDL_ttf IME demo to showfont in the SDL_ttf project 2024-10-06 00:24:01 -07:00
Sam Lantinga 8db3b47482 Just use normal stdio for the child process
Make sure we flush all output so it's seen by the parent as it happens.
2024-10-04 14:13:52 -07:00
Sam Lantinga 6c64c62114 Rename SDL_BUTTON() to SDL_BUTTON_MASK()
Fixes https://github.com/libsdl-org/SDL/issues/11056
2024-10-04 09:13:59 -07:00
Sam Lantinga fe2880fcda Rename SDL_SetThreadPriority() to SDL_SetCurrentThreadPriority()
Fixes https://github.com/libsdl-org/SDL/issues/11055
2024-10-04 08:57:03 -07:00