Commit Graph

619 Commits

Author SHA1 Message Date
Benjamin Otte
01453c733c testsuite: Rename "diff" test to "not-diff"
3 things you need to know about this change:

1. We use diff(1) in various tests to check generated text against
   reference output
2. Windows locates executables not just in $PATH, it also looks in
   $cwd and the directory of the current process' binary
3. Multiple tests live together in the same directory

Windows is fun.
2024-11-05 02:45:37 +01:00
Benjamin Otte
2a7beb75e8 testsuite: Make offload test do actual diffs
We have a testutils.c version for that.
2024-11-05 02:45:37 +01:00
Benjamin Otte
bfbc3e7484 testsuite: Clarify error
200% is not a fractional scale, but it's still forbidden.
2024-11-05 02:45:37 +01:00
Benjamin Otte
2e8fac7789 testsuite: Make nodeparser use shared diffing code
We have a testutils.c version, use that one.
2024-11-05 01:07:22 +01:00
Benjamin Otte
6cd98bae3b testsuite: Add --strip-trailing-cr to diff call
On Windows, git defaults to maintaining line endings, which means it
changed \n to \r\n on all files it identifies as text. And that includes
our test output.

Luckily diff(1) has an option to undo that. And since we do not care
about line endings in those tests, we can just use it.
2024-11-04 22:02:28 +01:00
Benjamin Otte
d2930695ca testsuite: Allow renderers in misc test to fail
When GL or Vulkan is not supported, the test should not fail.

It would be nicer if we could detect GL/Vulkan not being available
otherwise, but I'm not aware of a better solution, in particular because
rendeers might have stricter requirements than GTK itself.

So this is the next best fix.
2024-10-29 00:46:54 +01:00
Benjamin Otte
7d87118151 testsuite: Handle gdk_display_open() returning NULL
It turns out the Windows backend does that.
2024-10-29 00:46:54 +01:00
Benjamin Otte
6ef3fc2dbb testsuite: Hey, everyone has an NGL renderer, right?
No.

This fix is not that much better, but I'm too tired to fix stuff
like this properly.

And the Cairo renderer did at least work everywhere during 4.x
2024-10-20 23:53:04 +02:00
Benjamin Otte
5e9e8a6f5d testsuite: Canonicalize filenames
It looks weird on Windows if half the paths use \ and the other
half use /
2024-10-19 20:22:03 +02:00
Matthias Clasen
ed9e759917 Add a test for gradient rendering
This tests that gradients get interpolated differently in
srgb and rec2100-linear.
2024-10-04 17:13:27 -04:00
Matthias Clasen
f69d7f804a tests: Use the new gradient node apis
Properly replay gradient nodes with color state information.
2024-10-04 17:13:27 -04:00
Matthias Clasen
b43294c1c3 nodeparser: Handle color states for gradients
Test included.
2024-10-04 15:08:34 -04:00
Benjamin Otte
6847c3469d testsuite: Keep bounds for clip tests
The hope here is that it makes clip tests more reproducible because the
coordinates in device pixels are still the same as before.
2024-10-02 01:26:24 +02:00
Benjamin Otte
7a1e5b4418 compare-render: Add a KEEP_BOUNDS flag
If that flag is set, we keep the bounds of the original node when
rendering the modified node.

Gets around the replay test having to draw a transparent color node to
ensure the same bounds.
2024-10-02 01:26:24 +02:00
Matthias Clasen
119ba5844f testsuite: Drop glshader tests
And drop the gl renderer test here, but add ngl and Vulkan
equivalents.
2024-09-30 19:22:54 -04:00
Benjamin Otte
e18c553457 gpu: Consider scissor when intersecting with recangle
The clip might be different from the scissor due to incompatible
intersections.

But the resulting intersection might be fully clipped, so we should
consider it.

Testsuite with longer explanation attached.

Fixes #7044
2024-09-29 06:29:47 +02:00
Benjamin Otte
6c7abf425a Merge branch 'wip/otte/for-main' into 'main'
testsuite: Remove leftover test.in files

See merge request GNOME/gtk!7744
2024-09-26 18:47:49 +00:00
Benjamin Otte
58b44ebc1c testsuite: Remove GLES 2 tests
We want to drop GLES 2 support.
2024-09-26 18:41:13 +02:00
Benjamin Otte
b598f21506 testsuite: Remove leftover test.in files
We stopped supporting installed tests in 3121f88265 but forgot to remove
these files.
2024-09-26 16:35:47 +00:00
Benjamin Otte
bd3223d452 testsuite: Add missing headers 2024-09-25 02:50:22 +02:00
Benjamin Otte
feeca98270 testsuite: Use RGBA8 reference images
Due to a Mesa bug, RGBA16 images aren't properly handled sometimes and
can cause random failures.
In this case, generating the modified reference images for the tests
fails.

Fixes CI breakage.

Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11750
2024-09-24 13:57:09 +00:00
Benjamin Otte
56fc8f0077 gpu: Blur opaque textures correctly
Opaque textures don't clamp to transparent but instead to black.
We didn't consider this, so we were blurring their edges into blackness
not into transparency.

Fix this by adding the GSK_GPU_AS_IMAGE_SAMPLED_OUT_OF_BOUNDS flag
and respecting it in the implementation that uses it.

Test included.

Fixes #6980
2024-09-09 05:10:51 +02:00
Benjamin Otte
567c8b5ab3 Merge branch 'wip/smcv/debug-gsk-scaling-test' into 'main'
gsk/scaling test: Improve debuggability on failure

See merge request GNOME/gtk!7680
2024-09-03 15:30:32 +00:00
Benjamin Otte
7aeca0512c Merge branch 'wip/smcv/bug6977' into 'main'
scaling test: Fix intermittent failure with alpha = 0

Closes #6977

See merge request GNOME/gtk!7684
2024-09-03 15:27:20 +00:00
Simon McVittie
ad3c285fc6 scaling test: Show the input and expected average after each failed test
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 10:19:16 +01:00
Simon McVittie
97f0aa7875 testsuite: Share memorytexture version of compare_textures()
Unlike the version in scaling.c, this one incorporates debugging code
to print the pixels that differ.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 10:05:32 +01:00
Simon McVittie
8e54460a48 testsuite: Extract common code from gdk/memorytexture and gsk/scaling
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 10:05:32 +01:00
Simon McVittie
4c4d260199 scaling test: Avoid dividing zero by zero
If all four of the random colours have alpha channel exactly 0.0,
then the computed premultiplied average will also be zero.
Normalize the expected colour to (0,0,0,0) rather than (NaN,NaN,NaN,0).

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/6977
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 10:03:58 +01:00
Simon McVittie
13cbd9fcc7 testsuite: If gsk_renderer_realize() fails, say why
Showing the error message is usually more useful for debugging than
just saying that something failed.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 02:44:24 +01:00
Benjamin Otte
fa25015e8c compare-render: Appease clang and MSVC
clang wants consts not initialized from consts.

MSVC can't deal with arrays in initializers.
2024-08-30 06:28:58 +02:00
Benjamin Otte
296b6b1ed5 compare-render: Make the test runner generic
Instead of manually running each of the tests, use a loop and just
invoke the test runner.
2024-08-30 06:28:58 +02:00
Benjamin Otte
b88fe301be compare-render: Run clip tests using new runner
This requires adding infrastructure to generate per-test data, so that
the random clip rect can be computed and reused for both test and
reference generation.

So add this infrastructure.
2024-08-30 06:28:58 +02:00
Benjamin Otte
ffd836e6f4 compare-render: Run replay tests using new runner 2024-08-30 06:28:58 +02:00
Benjamin Otte
457cf66d0d compare-render: Run mask tests using new runner 2024-08-30 06:28:58 +02:00
Benjamin Otte
36765745a1 compare-render: Run rotate tests using new runner 2024-08-30 06:28:58 +02:00
Benjamin Otte
46c19a3d28 compare-render: Run repeat tests using new runner 2024-08-30 06:28:58 +02:00
Benjamin Otte
6cf928eb6c compare-render: Run flip tests using new runner 2024-08-30 06:28:58 +02:00
Benjamin Otte
a0d076f01a compare-render: Run plain tests using new runner
Extend the runner so NULL is accepted as a method to create
reference/test, in which case the unmodified original will be used.
2024-08-30 06:28:58 +02:00
Benjamin Otte
37c744759c compare-render: Add a generic test runner
... and port the colorflip test.

This is so we can factor out generic parts of the code. This allows
making changes easier to those parts, like if we want to introduce
rules for what colorstates and memory depths to do diffs in.
2024-08-30 06:28:58 +02:00
Benjamin Otte
277a05eb8c compare-render: Use consistent naming for files
Instead of the adverb, use the verb term. That matches the argument
passed on the cmdline, so only one string is necessary.
2024-08-30 06:28:58 +02:00
Benjamin Otte
d630ddd182 compare-render: Pick colorstate from reference when comparing
When comparing textures, always pick the colorstate from the reference
texture. This allows us to define what color state we expect.

For now, there's no check that the color states are equal, because they
don't really have to be as long as the pixels are.
2024-08-29 20:34:23 +02:00
Benjamin Otte
62542f836f compare-render: Create rotated reference without gdk-pixbuf
We use the renderer to create the reference for the rotate test by
applying the same rotate transform to the reference image instead of the
tested node.

This is somewhat suboptimal because they run very similar codepaths, but
this method works with high bit depth content and different colorstates

This concludes the port away from gdk-pixbuf and means that all rendered
content and reference images can now use high bit depth and colorstates.
2024-08-29 20:34:23 +02:00
Benjamin Otte
6d4c74fdce compare-render: Create masked reference without gdk-pixbuf
We use the renderer to create the reference for the mask test by
rendering the reference clipped.
2024-08-29 20:34:23 +02:00
Benjamin Otte
3dac4a01c6 compare-render: Create colorflipped reference without gdk-pixbuf
We use the renderer to create the reference for the colorflip test by
applying the same colorflip matrix to the reference image instead of the
tested node.

This is somewhat suboptimal because they run very similar codepaths, but
this method works with high bit depth content and different colorstates
2024-08-29 20:34:23 +02:00
Benjamin Otte
f598ec00f5 compare-render: Create clipped reference without gdk-pixbuf
We use the renderer to create the reference for the clip test by
applying the same clip node to the reference image instead of the
tested node.

This is somewhat suboptimal because they run very similar codepaths, but
this method works with high bit depth content and different colorstates
2024-08-29 20:34:23 +02:00
Benjamin Otte
6fc18f4b37 compare-render: Create flipped reference without gdk-pixbuf
We use the renderer to create the reference for the flip test by
applying the same transform node to the reference image instead of the
tested node.

This is somewhat suboptimal because they run very similar codepaths, but
this method works with high bit depth content and different colorstates
and the gdk-pixbuf method does not.
2024-08-29 20:34:23 +02:00
Benjamin Otte
8c9f16fa7a compare-render: Create repeated reference without gdk-pixbuf
We use the renderer to create the reference for the repeat test by
applying the same repeat node to the reference image instead of the
tested node.

This is somewhat suboptimal because they run very similar codepaths, but
this method works with high bit depth content and different colorstates
and the gdk-pixbuf method does not.
2024-08-29 20:34:23 +02:00
Benjamin Otte
001ca0a982 compare-render: Split test variant name from extension name
This is preparation for further patches where we want to use a common
codepath for all variants.
2024-08-29 20:34:23 +02:00
Benjamin Otte
b23c0248ba compare-render: Don't load reference file twice
Instead, convert from texture to pixbuf.

Ultimately, we want to avoid pixbufs entirely, but we're not there yet.
2024-08-29 20:34:23 +02:00
Benjamin Otte
c4c352facc compare-render: Use TAP for the test 2024-08-29 20:34:23 +02:00