Commit Graph

223 Commits

Author SHA1 Message Date
g.willems
e3f39bf0c3 testsuite: only run x11-specific tests if x11 enabled
Some testcases rely on X11 support, which is not always available,
typically on win32.
Skip them if the x11 backend is disabled.
2023-12-12 21:29:03 +01:00
Benjamin Otte
6ad9db0bf0 Merge branch 'texture-diff-against-distant-ancestors' into 'main'
texture: Enable texture diff against arbitrarily distant ancestors

See merge request GNOME/gtk!6644
2023-12-12 01:46:05 +00:00
Benjamin Otte
c414889cfa testsuite: Make memorytexture test work with GLES < 3.1
Previously, the code was skipping various tests and not skipping others
that it should.

Fix both of these cases.
2023-12-12 01:49:41 +01:00
Ben Mather
1629b072fe texture: Enable texture diff against arbitrarily distant ancestors 2023-12-08 11:29:56 +00:00
Matthias Clasen
7cc5d5c7a5 Revert "Merge branch 'rgba-new-from-string' into 'main'"
This reverts commit 77f40d7508, reversing
changes made to b969f4649d.

It turns out we did not have agreement on this after all.
2023-12-02 10:55:35 +05:45
Emmanuele Bassi
0114fad8a5 Style/doc fixes from review 2023-11-28 00:42:19 +00:00
FeRD (Frank Dana)
39db73dff1 Add gdk_rgba_new_from_string()
Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
2023-11-24 22:19:39 -05:00
Benjamin Otte
cd7e1c1387 dmabuf: Modify gdk_gl_context_import_dmabuf()
Move a bunch of code - namely the target selection - into the function.

I want to use the same code in the NGL renderer, so no need to duplicate
it.
2023-11-07 05:12:57 +01:00
Chun-wei Fan
864c5b4608 testsuite: Disable dmabuftexture test on Windows
It's not meaningful there.
2023-10-24 14:08:16 +08:00
Benjamin Otte
a579e3bc6d build: Fix up header includes
These weren't fixed in the merge request in
  https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6489
to the change from
  https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6514
2023-10-23 03:12:09 +02:00
Matthias Clasen
d17d8e04a6 Add a few dmabuf texture tests
Test some basic import and export of dmabufs.

For now, put the test into the 'failing' suite,
since it does not work in CI, and also fails
on AMD hw.
2023-10-22 16:39:24 -04:00
Matthias Clasen
10250a0a6a Add XRGB memory formats
These are not uncommon in dmabufs,
and supporting them is easy.

Fixes: #6172
2023-10-20 17:58:06 -04:00
Matthias Clasen
bd974b08b3 Add GDK_MEMORY_A8B8G8R8_PREMULTIPLIED
We did have 4 ordering variations of ARGB straight,
but only 3 premultiplied. Add the missing one.

Update all the places where we switch over memory formats.
2023-10-20 16:42:40 -04:00
Matthias Clasen
7a8a27bd60 ci: Mark the clipboard test as flaky
Lets give up on trying to run this successfully
in ci. More green in more places!
2023-07-28 09:06:14 +03:00
Benjamin Otte
4a8122f685 gdk: Make A8 and A16 formats premultiplied
The relevant question here is about details, because we have to choose
if we declare alpha-only formats as having their (nonexistant) color
channels premultiplied or not, so that the code paths using them can do
the right thing.

Because we are premultiplied by default, it makes sense to treat alpha
like that, because then the alpha-only code doesn't need to do
workarounds for straight alpha.

Where this is relevant of course is when expanding the alpha channel
into color channels, where we want to end up with white.
So make sure we do color = alpha there instead of color = 1 like we did
before.
2023-07-22 01:33:44 +02:00
Benjamin Otte
27fbdcbecb gdk: Add A16_FLOAT and A32_FLOAT formats
We need them for mask-only textures.

For tiffs, we convert the formats to RGBA (the idea that tiff can save
everything needs to be buried I guess) as tiffs can't do alpha-only.
2023-07-22 01:33:44 +02:00
Benjamin Otte
49c2366121 testsuite: Unify skipping memorytexture test
... and make it handle more cases of failure, in particular OpenGL and
Vulkan being unsupported by the system.
2023-06-19 15:08:00 +02:00
Benjamin Otte
ae89f6e6c0 testsuite: Add a vulkan method to memorytexure test
This uses the newly added NULL-surface renderer.
2023-06-19 14:13:03 +02:00
Matthias Clasen
b439398d09 testsuite: Plug some memory leaks 2023-06-09 22:40:38 -04:00
Benjamin Otte
f033b6c2c6 testsuite: Don't always loop in memorytexture tests
When running the tests, only run the random (and potentially large) size
download test once instead of 10 times.

There's no real benefit in doing that, both because it's unlikely to
fail only in the 2nd or 9th run and because the sizes are picked
randomly.

This also speeds up the test massively as the download test was
dominating the runtime.
2023-06-09 01:12:32 +02:00
Benjamin Otte
45656ba426 testsuite: Make memorytexture tests random
Instead of picking a few numbers in advance and running them through the
test gauntlet every time, pick the random numbers at runtime.

This both increases the test coverage in that it ultimately tests more
combinations across many runs and it reduces the runtime of individual
runs because every tun only runs the download tests twice (with 1px and
the random size) instead of 5 times.

And that speedup benefits the CI, where the asan runs would cause this
test to timeout sometimes.
2023-06-09 01:12:32 +02:00
Matthias Clasen
d427933c61 testsuite: Improve test coverage 2023-06-04 09:04:25 -04:00
Matthias Clasen
96f6787a3e testsuite: Add more download tests
Add some odd-sized texture sizes to the
download tests, to trigger alignment issues
in the various upload code paths. And add
a size that is bigger than the max-texture-size
we force in one of our test setups.

To compensate, reduce the number of
runs per size from 20 to 10.
2023-05-30 23:01:20 -04:00
Matthias Clasen
cc665f29ea testsuite: Plug a memory leak 2023-05-30 22:37:03 -04:00
Matthias Clasen
8d2047c824 testsuite: Use proper alignment when uploading to GL 2023-05-30 22:36:41 -04:00
Matthias Clasen
a79da8b655 Improve test coverage for GdkGLTexture 2023-05-30 22:36:10 -04:00
Matthias Clasen
2bf2635635 testsuite: Exclude some formats on GLES
GLES < 3.2 has some problems with 16-bit formats,
so exclude these from our download tests.
2023-05-30 19:46:13 -04:00
Matthias Clasen
67ed09f5ae testsuite: Add tests for native GL textures
Create GL textures in gray and GA formats
and check that we can download from them
successfully.
2023-05-30 19:46:13 -04:00
Sophie Herold
d141ac5adf gdk: Add gray/alpha memory formats to testsuite 2023-05-30 14:41:01 -04:00
Sophie Herold
50115d70c6 gdk: Add grayscale and alpha memory formats 2023-05-30 14:41:01 -04:00
Benjamin Otte
3dc3d03a08 testsuite: Add conversion tests
Ensure we can convert from any format to any other format.
2023-05-30 00:42:10 +02:00
Benjamin Otte
788bd575d6 testsuite: Disable certain texture download tests
The GL renderers like to premultiply content that isn't, and due to the
data loss with alpha == 0 (transparent white, transparent black and
transparent anything are all represented by (0, 0, 0, 0) when
premultiplied) these values cannot be converted back.
2023-05-30 00:42:10 +02:00
Benjamin Otte
94a2dc4c47 testsuite: Update memorytexture test for TextureDownloader
There is no longer a need to use gdk_texture_download() and force
conversion to ARGB8 format. We can download the pixels in the original
format again.

That way we avoid testing the conversion code and avoid having to deal
with differences in representable colors.

However, some formats do do conversions, so we allow pixel comparisons
to be accurate (requires 16bit comparison accuracy) or inaccurate (we
only care about 8bit).
Note that for the default RGBA formats, this is identical and means they
need to be bit-exact the same, no matter what.
But the higher bit depth formats may be more different - floating point
can even have different values with high accuracy (the float mantissa is
23 bit, we only care about 16).
2023-05-30 00:42:10 +02:00
Benjamin Otte
169a7f83e6 testsuite: Imitate gdk_memory_convert() correctly
The formula use to compute pixel values from GdkRGBA floats was slightly
adapted some time ago, copy that adaptation
2023-05-30 00:39:46 +02:00
Matthias Clasen
013401b594 Fix texture tests with GLES
No sync for you if you're using GLES.
2023-05-15 19:11:35 -04:00
Matthias Clasen
0152286fa0 Improve test coverage for GdkGLContext 2023-05-15 16:49:12 -04:00
Matthias Clasen
41b606b16d Add tests for GdkTextureDownloader 2023-05-15 15:24:56 -04:00
Matthias Clasen
f83c00c928 Test gltexture update functionality 2023-05-15 12:50:28 -04:00
Matthias Clasen
f497cb2b6e Improve gdk test coverage 2023-05-15 11:56:31 -04:00
Matthias Clasen
e50209a535 Add more texture load tests
Add some tests for handling of failures.

The test data here is taking from gdk-pixbufs
tests/test-images/fail directory, excluding anything
but png, tiff and jpg images.
2023-05-14 07:50:11 -04:00
Matthias Clasen
d6430995ad Improve gdk test coverage
Test the loadable icon implementation of GdkTexture.
2023-05-14 07:50:11 -04:00
Matthias Clasen
cea15fc63e Improve gdk test coverage
Add tests for GdkToplevvelLayout and
GdkPopupLayout.
2023-05-13 21:56:29 -04:00
Matthias Clasen
57dd88ee53 testsuite: Cosmetics 2023-05-12 19:52:42 -04:00
Emmanuele Bassi
cdeeb3275a build: Internal tests must set GTK_COMPILATION
Otherwise they won't be able to use the appropriate function visibility
on Windows.
2023-05-09 19:01:21 +01:00
Matthias Clasen
b85a137a68 Fix scan-build warning 2023-05-03 15:32:19 -04:00
Benjamin Otte
778979cf0e testsuite: Use GLTextureBuilder 2023-04-27 06:40:47 +02:00
Matthias Clasen
dbefc330bd Add some more keysyms tests
Spot-check a few keypad symbols.
2023-03-29 07:35:24 -04:00
Matthias Clasen
31ebe42d2e testsuite: Update a test
cacecd2fb5 changed a warning message that
some tests check for. Oops.
2023-03-29 07:34:27 -04:00
Matthias Clasen
644b8a4214 testsuite: Add some GL texture tests
Tests creation and upload/download of GL
textures in various contexts.
2023-03-24 13:57:16 -04:00
Matthias Clasen
a8b92935d9 testsuite: Cosmetics 2023-03-24 13:57:16 -04:00
Matthias Clasen
ddf8c4dd1a Drop pixbuf format tests
We have our own loaders for the formats we
always want to support, so we don't need to
check for what gdk-pixbuf supports.
2023-02-07 07:54:22 -05:00
Matthias Clasen
3121f88265 build: Drop the install-tests option
We no longer use installed tests in CI,
so lets reap the benefit and simplify
our build setup for tests.
2022-12-19 23:12:47 -05:00
Simon McVittie
94b57a967c testsuite: Don't create .test files for flaky or failing tests
These tests can be run manually, but are not suitable for use as an
acceptance test, so let's not make frameworks like Debian's autopkgtest
run these when they run ginsttest-runner in the most obvious way.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-11-24 13:46:33 +00:00
Simon McVittie
957dd49ef7 testsuite: Use separate setups for unstable tests instead of should_fail
There are two possible interpretations of "expected failure": either
the test *must* fail (exactly the inverse of an ordinary test, with
success becoming failure and failure becoming success), or the test
*may* fail (with success intended, but failure possible in some
environments). Autotools had the second interpretation, which seems
more useful in practice, but Meson has the first.

Instead of using should_fail, we can put the tests in one of two new
suites: "flaky" is intended for tests that succeed or fail unpredictably
according to the test environment or chance, while "failing" is for
tests that ought to succeed but currently never do as a result of a
bug or missing functionality. With a sufficiently new version of Meson,
the flaky and failing tests are not run by default, but can be requested
by running a setup that does not exclude them, with a command like:

    meson test --setup=x11_unstable --suite=flaky --suite=failing

As a bonus, now that we're setting up setups and their excluded suites
programmatically, the gsk-compare-broadway tests are also excluded by
default when running the test setup for a non-broadway backend.

When running the tests in CI, --suite=gtk overrides the default
exclude_suites, so we have to specify --no-suite=flaky and
--no-suite=failing explicitly.

This arrangement is inspired by GNOME/glib!2987, which was contributed
by Marco Trevisan.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-11-24 13:46:33 +00:00
Matthias Clasen
cd4dbd67a2 testsuite: Skip known-broken tests
The tiff pixbuf tests fail because of known
issues with the pixbuf tiff loader. Skip them.

Fixes: #4615
2022-10-18 23:22:47 -04:00
Matthias Clasen
5a6eab05e9 testsuite: Fix tiff pixbuf tests
This test wasn't actually testing what it claims,
since that functionality is broken in gdk-pixbuf.

Test it anyway.
2022-10-18 23:21:28 -04:00
Matthias Clasen
e8e69a1208 Make clipboard tests work with portals
This was not working right, since it hasn't been
tested with portals - there are no portals in ci.
2022-09-07 08:45:31 -04:00
Matthias Clasen
61a843e824 gdk: Improve test coverage 2022-07-16 09:43:46 -04:00
Matthias Clasen
882c805b53 gdk: Improve test coverage 2022-07-16 09:43:46 -04:00
Matthias Clasen
6164908bd3 Add tests for gdk_memory_texture_new_subtexture
This checks the fixes in the previous commit.
2022-05-13 11:44:11 -04:00
Sebastien Bacher
c44288c739 Use the correct name for installed gdk tests 2022-03-07 16:13:38 +01:00
Benjamin Otte
481634930c glcontext: Remove leftover function call
That call should have been removed way back when.

Add a testcase to make sure this keeps working.

Fixes #4697
2022-02-16 03:48:15 +01:00
Benjamin Otte
7872b41f16 testsuite: clear_current() when done
That way we ensure that the GL context(s) get disposed, which they
previously weren't due to them still being the current context.

This also implicitly adds testing of gLContext destruction, which
previously wasn't ever done by any test.
2022-01-06 19:22:47 +01:00
Benjamin Otte
354fa6544a texture: Remove gdk_texture_download_float()
The download API is not well thought out yet, so postpone it until
there's an actual usecase for it.

Remove testcases, too.
2021-11-30 14:12:10 +01:00
Benjamin Otte
0898023e6b testsuite: Create GL renderers without surfaces 2021-10-20 21:49:32 +02:00
Benjamin Otte
a859471960 testsuite: Add workarounds for non-gl backends
read: Fix tests for broadway
2021-10-18 14:17:11 +02:00
Benjamin Otte
1e7fb52b21 Add memory formats used by libpng
Add unpremultiplied high-depth formats. They are used in the real world,
so let's support them.
2021-10-13 14:33:44 +02:00
Matthias Clasen
49a64da7ec Merge branch 'ngl-is-the-new-gl' into 'master'
Rename ngl to gl

Closes #4318

See merge request GNOME/gtk!4037
2021-10-11 06:43:41 +00:00
Benjamin Otte
b4ab9f7b8c testsuite: Add a test targeting GL upload code
Previously, all the tests used the icon upload path using
glTexSubImage2D().

This test uses the custom texture path using glTexImage2D().
2021-10-09 04:44:30 +02:00
Matthias Clasen
144f727d5a Rename ngl to gl
We have only one gl renderer now, and it is
a bit odd for it not be called gl.
2021-10-07 13:05:53 -04:00
Benjamin Otte
2e555db9a4 testsuite: Fail more accurately
Don't run the full test and then return "something failed" - instead
just explode when you find the failure.
2021-10-06 22:50:07 +02:00
Benjamin Otte
9395b28542 testsuite: Actually run all memorytexture tests
Whoops
2021-09-26 09:41:55 +02:00
Matthias Clasen
63647cace0 testsuite: Run the clipboard test in isolation
We can't have other test pop up windows, and possibly
stealing focus and preventing us from getting data
offers. So, run the clipboard test in isolation.
2021-09-17 11:38:28 -04:00
Benjamin Otte
577bf104c0 testsuite: Add png and tiff methods
We encode the texture to a PNG or TIFF and then decode
it again, in various ways.
2021-09-17 00:25:22 +02:00
Matthias Clasen
95a0c93839 Add contentserializer tests for textures 2021-09-17 00:25:22 +02:00
Matthias Clasen
e30b4c61cb Add tests for the jpeg loader 2021-09-17 00:25:22 +02:00
Matthias Clasen
945c2531ac Add tests for the tiff loader 2021-09-17 00:25:22 +02:00
Matthias Clasen
d6ce65f81c Add tests for the png loader 2021-09-17 00:25:22 +02:00
Benjamin Otte
64acaf99fb testsuite: Fix race in texture-threads test
Threads are evil, yo.
2021-09-16 23:59:37 +02:00
Benjamin Otte
b6d3561f4a testsuite: Be more verbose in texture-threads test
The test randomly fails on CI, so try to be more helpful in debugging
them.
2021-09-16 23:59:37 +02:00
Benjamin Otte
6785461c26 gltexture: Make sure downloading textures works in a different thread
This happens in the real world when using the inspector to look at a
node recording of a GStreamer video while the video is still playing.

GStreamer will use the GL context in a different thread while we are
busy trying to download it.

A test is included.
2021-09-13 01:40:03 +02:00
Benjamin Otte
416763bf2d testsuite: Add tests for gdk_texture_download_float() 2021-09-12 05:54:37 +02:00
Benjamin Otte
9179ebb28e testsuite: Add memory test support for OpenGL up/downloads
Use a GL renderer to upload textures (and then optionally download them
via release() again). This way, we can test that the GL renderer
properly uploads textures to the right formats (not losing information
for HDR for example) and downloads them again.
2021-09-12 05:54:37 +02:00
Benjamin Otte
bcc17b3033 testsuite: Add tests uploading the memorytextures
Use a GL renderer and render_texture() them.
2021-09-12 05:54:37 +02:00
Benjamin Otte
00439f9e5c testsuite: Rework memorytexture test some more
Instead of predefined colors, generate them randomly.
2021-09-12 05:54:37 +02:00
Benjamin Otte
c9d748fc51 testsuite: Overhaul memorytexture test
Instead of hardcoding pixel values, allow construction of textures by
filling them with GdkRGBA values.
2021-09-12 05:54:37 +02:00
James Westman
0782c8a051
gdk_rgba_parse: Support HSL colors 2021-09-10 16:56:42 -05:00
Benjamin Otte
d760332f00 testsuite: Add contentformat tests 2021-07-27 04:28:04 +02:00
Matthias Clasen
47bb556327 testsuite: Avoid a compiler warning
This was showing up in ci on macos.
2021-06-17 09:37:45 -04:00
Matthias Clasen
04bac8ef2a testsuite: Run some installed tests exclusively
My suspicion is that the clipboard (and some other)
installed test interferes with others, because the
clipboard is a shared resource.
2021-05-17 07:16:42 -04:00
Matthias Clasen
bafa23fa2c Add debug spew to gdk tests 2021-05-05 15:41:46 -04:00
Chun-wei Fan
e56754d27c clipboard-client.c: Include necessary headers for Windows
We need to include io.h and process.h for close() and exit(), as unistd.h may
not be universally available.
2021-05-04 12:12:50 +08:00
Matthias Clasen
4c6c0b9099 Add a test for custom serializers 2021-05-02 09:17:20 -04:00
Matthias Clasen
a5cab71c9b Add tests for content serialization
Test that roundtripping various types of content
through a stream of a given mimetype works as
expected.
2021-05-02 00:01:57 -04:00
Timm Bäder
6b6246f7b4 clipboard tests: Add noreturn annotations where possible
Clang complains when they are missing.
2021-05-01 17:14:23 +02:00
Matthias Clasen
c1b614772c Install the clipboard-client binary
It is needed for the installed test.
2021-04-30 09:59:58 -04:00
Matthias Clasen
5636384449 Skip clipboard tests when they don't work
On headless weston, we have no seat, so focusing
the window won't work, and thus claiming the clipboard
won't either. Skip the tests in that case.
2021-04-30 09:17:39 -04:00
Matthias Clasen
f72ca060b5 Run gdk tests with an unset D-Bus address
If the session bus address is unset, GLib will
helpfully try to autolaunch a bus, which will
fail and timeout. If we set an empty address,
it gives up early.
2021-04-30 08:10:48 -04:00
Matthias Clasen
6482954c6e Fix the clipboard test under X11
We don't have a signal handler to worry about here.
2021-04-30 08:02:35 -04:00
Matthias Clasen
e1a0e4bfbe Make clipboard tests run installed
Use dedicated data files, and install them.
As usual, to run the test binary by hand, you
will need to set G_TEST_SRCDIR.
2021-04-30 07:47:19 -04:00