Commit Graph

153 Commits

Author SHA1 Message Date
Kacper Michajłow de837aa80b test/libmpv_common: ensure our atexit clean fires before internal ones
This allow to use MPV_LEAK_REPORT and makes exit order more predictable
when debugging.
2025-02-14 15:21:02 +01:00
Dudemanguy 58f46e7f0b test/libmpv_test_track_selection: add another multilang selection test
Because you can never have too many tests. This covers some scenarios
that the other multilang one doesn't (multiple tracks with the same
language).
2025-02-13 23:22:28 +00:00
Dudemanguy 9e38208951 test/libmpv_test_track_selection: eliminate reloading redundancy
Loading the file and then waiting it for it to be loaded again doesn't
need to be two separate functions. Combine it into a simple
"reload_file" so it's more readable.
2025-02-13 23:22:28 +00:00
Dudemanguy dba53e1b5b test/libmpv_test_track_selection: remove unneeded option resetting
This got refactored so it only loads one file at a time and not
everything in a loop. The option resetting at the end of conditional
branches is pointless.
2025-02-13 23:22:28 +00:00
Dudemanguy f7a681b362 test: add default track selection testing
The amount of options we have that are related track selection is insane
and touching any of this stuff is scary. Add some track selection
testing to the CI to hopefully make it slightly less scary to touch any
of that. Since trying to work in media files from some outside source
would be a pain and need to live in some repo somewhere, it's nicer to
just generate dummy files on the fly with ffmpeg during the ci runs and
use that. Obviously, the actual tests themselves could be even more
thorough (external tracks were not even considered), but this is more
than a good enough start for now.
2025-02-12 15:29:07 +00:00
Dudemanguy 25067e845c test: split libmpv_test into separate files
The big libmpv test file is really actually three different tests shoved
together into one. They do all use fairly similar underlying structures,
so put the shared stuff into an inline header. There's a little bit of
duplication with regards to the main function, but it's cleaner to
separate out the tests.
2025-02-12 15:29:07 +00:00
Dudemanguy d980e950c6 test: group together all the libmpv tests under the libmpv suite 2025-02-12 15:29:07 +00:00
Dudemanguy 956cb2c49f various: simplify mp_normalize_path usage
If a talloc_ctx was being made solely for a onetime usage of getting a
normalized string, we can now just pass NULL instead and free the string
directly to make things easier.
2025-02-01 16:12:03 +00:00
Kacper Michajłow 59d1dc43b9 various: fix typos 2025-01-04 15:59:49 +02:00
Kacper Michajłow 0c4c2caabf misc/codepoint_width: assume tabstop width to be 8
It has been hardcoded to the same value in stats.lua so keep the current
behaviour. Can be made configurable if requested in the future.
2024-10-21 20:06:48 +02:00
Kacper Michajłow bf025cd289 msg: allow to truncate the message to terminal width 2024-10-11 15:16:33 +02:00
Kacper Michajłow 95f0046309 misc/codepoint_width: add unicode width detection support
Add 4 stage trie to lookup unicode codepoint width and grapheme join
rules.

Generated by GraphemeTableGen from Microsoft Terminal (MIT Licence):
https://github.com/microsoft/terminal/blob/a7e47b711a2adc7b9e80eddea8168089f7d3b11e/src/tools/GraphemeTableGen/Program.cs

With minor adjustment to use it in C codebase.
- Replaced constexpr with static
- Replaced auto with explicit types

Generated from Unicode 16.0.0:
ucd.nounihan.grouped.xml: sha256(b11c2d23673bae660fff8ddcd3c1de4d54bdf6c60188a07696b010282f515fcf)
2024-10-11 15:06:14 +02:00
Dudemanguy 5bf9cf5bf0 test: only run ffmpeg tests on release versions
The CI breaking because some new format was added in the master branch
is pretty annoying so only run these on release versions that are known
to work to reduce some maintenance burden. Although why we even bother
with this is still a valid question.
2024-10-10 13:17:29 +00:00
Kacper Michajłow 7202406fe8 various: remove global.h inclusion where not needed 2024-10-01 12:23:44 +02:00
Kacper Michajłow 7746942a55 win32: remove pathcch compatibility code
No longer needed after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
sfan5 d2e3e6f3bd test/libmpv_lifetime: don't re-define ASAN macro 2024-07-16 23:04:36 +02:00
der richter 05b0b7cf65 test/libmpv_lifetime: activate test on macOS 2024-07-16 11:20:40 +02:00
Kacper Michajłow b3320ac64a test/libmpv_lifetime: add test to test libmpv ability to reinit itself
This test:
- Checks if libmpv can be loaded dynamically.
- Checks for leaks after mpv context destroy.
- Checks if libmpv can be reloads after dlclose()
2024-07-11 21:55:21 +02:00
llyyr f89d0d48bc test/libmpv_encode: check fread return value
Fixes warning with clang
2024-07-08 23:45:37 +02:00
Kacper Michajłow 529450a965 test/paths: add tests for mp_basename and mp_dirname
Note that those functions have different behaviour than POSIX ones.
2024-06-27 02:56:59 +02:00
Kacper Michajłow 4a0c0ce92d test/paths: use helper functions for result testing 2024-06-27 02:56:59 +02:00
Kacper Michajłow 3c5a79300c various: remove av channel layout check 2024-06-22 16:12:14 +02:00
Dudemanguy 42a4c306ec test/libmpv_test: fix some stray tabs 2024-06-19 23:04:21 -05:00
Dudemanguy b402cc3248 test/libmpv_encode: avoid mktemp warning
Doesn't really matter but it's annoying so replace it with mkstemp
instead. For windows, just use _mktemp.
2024-06-19 13:55:54 +00:00
Kacper Michajłow 0c716e762f test/meson: remove unneded sources 2024-06-03 19:18:06 +02:00
Kacper Michajłow 4caca3e6c0 test/paths: skip normalize tests if pathcch library is not available
If pathcch is not available paths are not normalized on Windows.

Fixes tests on ancient mingw.
2024-06-03 19:18:06 +02:00
Kacper Michajłow 734846c123 test_utils: don't use subprocess for diffing test results
Helps with testing during cross-compilation and avoids external
dependency.

Output maybe is not that nice, but this output in our tests is not
useful anyway. We know if it changes it is beacuse one of the dependency
version changed.
2024-06-03 19:18:06 +02:00
Kacper Michajłow 09c359e1d3 test/libmpv_encode: print logs also during initialize 2024-06-03 19:18:06 +02:00
Kacper Michajłow 8a9901963d test/libmpv_encode: don't use mpv internals for test
mktemp is good enough for this test purposes and also tests if libmpv is
able to create a file that doesn't exist.
2024-06-03 19:18:06 +02:00
Guido Cella 1f69659a77 test: test mp_guess_lang_from_filename with [] and () 2024-05-10 22:54:12 +02:00
Guido Cella 63d820bd68 test: test mp_guess_lang_from_filename() 2024-05-10 01:22:31 +02:00
Kacper Michajłow 5009e13431 player/loadfile: match language and subcodes 2024-05-09 17:12:55 +02:00
nanahi f11002cef3 various: fix tabs in code 2024-05-07 11:23:08 +02:00
Kacper Michajłow 006c3ce9fe test: mark libmpv as expected fail if OSC is not available
This test is expected to fail without lua and osc.lua support.
2024-05-06 22:01:17 +02:00
Kacper Michajłow cd12e923f8 test/libmpv_encode: minor adjustments for win32 build fix 2024-05-06 22:01:17 +02:00
Kacper Michajłow 5cf0da2a6a various: remove unused sys/time.h include 2024-05-06 22:01:17 +02:00
Kacper Michajłow 053d971507 misc/path_utils: normalize win32 paths 2024-05-05 19:37:57 +02:00
Guido Cella 1d640c9887 player: normalize paths for resuming playback
Paths like foo.mkv, ./foo.mkv .//foo.mkv, ../"$(basename
"$PWD")"/foo.mkv, and C:\foo.mkv and C:/foo.mkv on Windows, use
different config files for resuming playback, so if you quit-watch-later
and later play the same file with a different path, mpv does not resume
playback. This commit normalizes the paths on Unix to fix this.
2024-05-05 19:37:57 +02:00
Guido Cella 1128989885 test: fflush between printf and abort
This is necessary to show the output with meson test. Followup to
06edb04692.
2024-05-05 17:51:34 +02:00
sfan5 426be8441a test: make libmpv_test abort if an error is logged
Among others this provides a trivial test that built-in scripts aren't throwing
an error at load or init time.
2024-04-24 12:58:50 +02:00
sfan5 3b64bf908a test: add an encoding test with libmpv 2024-04-17 20:22:36 +02:00
Dudemanguy a5269d7a73 test: support format refs for multiple ffmpeg versions
With some small tweaks to the test, we can support multiple ffmpeg
versions. This adds back ffmpeg 6 support that was removed in the
previous commit.
2024-04-12 17:39:34 +00:00
Dudemanguy 05607fed19 test: update format refs for new major ffmpeg version
xvmc was removed and d3d12 was added.

https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/a12cd3be98e8aba6e74274192ec6532988aa9444
https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/142f727b9ca21c95414536074e3f89c687271dd4
2024-04-12 17:39:34 +00:00
Kacper Michajłow c389f9e75e win32: change fputs to fwrite wrapper
Removes mp_puts/mp_fputs and adds mp_fwrite.

In fact I wanted fwrite instead of puts, no need to make it more awkward
with the implicit new lines.

Fixes: fc55f355fc
2024-04-07 20:23:04 +02:00
Kacper Michajłow 06edb04692 test: fflush output stream before abort
For `meson test` to not eat lines on abort.
2024-03-21 03:50:11 +01:00
Kacper Michajłow 8708f4dc91 m_property: add > for fixed precision floating-point expansion
This enhancement makes it easier to create constant width property
expansions, useful for the `--term-status-msg`. Additionally, it changes
to `%f` printing with manual zero trimming, which is easier to control
than `%g`. With this method, we can directly specify precision, not just
significant numbers. This approach also avoids overly high precision for
values less than 1, which is not necessary for a generic floating-point
print function.

A new print helper function is added, which can be used with adjusted
precision for specific cases where a different default is needed. This
also unifies the code slightly.
2024-03-21 03:50:11 +01:00
nanahi 8c1117b2cb meson: remove winmm dependency for win32 desktop target
Not needed anymore as timeBeginPeriod() is removed.
2024-03-19 20:23:25 +01:00
nanahi aff376e066 win32: increase hires timer resolution
timeBeginPeriod() only allows setting minimum timer resolution
to 1 ms. However, modern x86 platforms support a minimum timer
resolution of 0.5 ms. Use NtSetTimerResolution() instead for
the increased resolution, which can be set with MPV_HRT_RES.

Additionally, change the units of mp_start_hires_timers(),
mp_end_hires_timer(), MPV_HRT_RES, and MPV_HRT_MAX to nanoseconds,
in accordance with other functions used in timer.h.
2024-03-19 20:23:25 +01:00
Kacper Michajłow fc55f355fc win32: add puts/fputs wrappers 2024-03-19 19:58:09 +01:00
Kacper Michajłow 3372e17d51 win32: optimize mp_vfprintf a little
- remove redundant strlen/wcslen
- reuse allocated temporary buffers

The difference is not big, but it satisfies me to remove those
redundancies.
2024-03-19 19:58:09 +01:00