Commit Graph

3013 Commits

Author SHA1 Message Date
Elliott Sales de Andrade
b3706daf90 builder-tool: Handle pack-type, position, and center child in GtkBox
This takes the `position` property and ensures children are sorted by
it, splits children by `pack-type` (also reversing the order of `end`
children), and handles children with `type="center"`.

If either a center child or end children exist, then the `GtkBox` is
converted to a `GtkCenterBox`, with `start-widget`/`end-widget` being a
nested `GtkBox` with the relevant children.

The splitting does cause some non-`object` children to sort differently
(hence the change to `office-runner.expected`.)
2024-09-16 05:12:54 -04:00
Elliott Sales de Andrade
172dfb14c4 builder-tool: Convert node children after the node itself
Some nodes like `GtkBox` need to process removed-in-GTK4 attributes to
correctly convert their contents. If the node children are processed
first, then those attributes are removed prematurely.
2024-09-16 02:39:47 -04: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
6cefdfeddd testsuite: Fix udmabuf creation
We were using the wrong format and color state when downloading the
data.

Tests not included in this commit, but a few commits later.
2024-09-09 04:18:13 +02:00
Matthias Clasen
d16c9fbaca 4.16.0 2024-09-06 22:51:07 -04:00
Matthias Clasen
3f7f9b705e css: Avoid a crash with relative colors
rgba(from @foo ...) would crash if @foo was not a named color.
Handle it as we do elsewhere, by returning NULL from resolve().

Test included.

Fixes: #6985
2024-09-06 07:54:37 -04:00
Matthias Clasen
b6d19f4c8b Fix css tests
Disable css deprecation warnings for the style tests. We want to
be able to do tests with named colors here.
2024-09-06 07:54:37 -04: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
47c461b25b testsuite: Show pixel format of texture pixels that differ
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 10:05:32 +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
Simon McVittie
204b8857a1 testsuite: Add a suite for tests that require /dev/udmabuf
On GTK's official upstream CI, all Linux runners are meant to have
/dev/udmabuf available, so this should pass. On developer machines or
downstream build environments, this can't be guaranteed (not all kernel
configurations offer that device, and on those that do, an autobuilder
might not have access to it) so make it possible to skip this with
`--no-suite=needs-udmabuf`.

Any future tests that rely on /dev/udmabuf (as opposed to using it for
optional better coverage if available, like replay-node does) can be
aded to the same suite.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-08-31 10:22:49 +01:00
Fina Wilke
649782b547 a11y: Consistently use list type for errormessage relation
This more closely matches the spec. This is an API break, however the
atspi backend already assumed that this was a list, and would throw
criticals whenever this relation was set. Therefore it can be assumed
that this relation was not previously in active use.
2024-08-30 20:22:59 +00: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
e268041a42 reftest-compare: Respect color states when diffing
Always pick the color state from texture1 and download the data and
generate the diff in that color state.

That now means the order of the 2 arguments matters.
2024-08-29 20:34:23 +02:00
Benjamin Otte
f9cbeeeedc reftest-compare: Compare high depth images in high depth
I first tried porting everything to float, but it turns out that that
makes a compare-render run (with all 1520 tests succeeding) 9s slower
so I decided to keep the existing U8 code.

A side benefit is that saving the diff to PNG will continue creating
U8 PNGs.
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
Benjamin Otte
30af6d1159 compare-render: Turn into a real test
Use g_test_run() like any other test.
2024-08-29 20:34:23 +02:00
Benjamin Otte
1fac3fe44e compare-render: Compare to reference texture
There's no need to render the original node and compare to its result,
we know that that is equal to the reference image.

Avoids duplicate renderings.
2024-08-29 20:34:23 +02:00
Benjamin Otte
8ac6c08f00 compare-render: Create the reference texture at startup
This allows exiting early when it doesn't exist.
2024-08-29 20:34:23 +02:00
Benjamin Otte
5b62f29b5e compare-render: Rename variables
They conflict with the next commit otherwise.
2024-08-29 20:34:23 +02:00
Benjamin Otte
817cfb09f8 compare-render: Failing to load an image is a failure 2024-08-29 20:34:23 +02:00
Benjamin Otte
8da478ab34 testsuite: Disable a bunch of tests on the GL renderer
We want to generate reference images with the renderers and the GL
renderer can't deal with textures well enough to generate these
reference images.
2024-08-29 20:34:20 +02:00
Benjamin Otte
aa81df921b testsuite: Correct values for red
The value used was for rec2020 (9/14/0/1), not rec2100-pq (9/16/0/1).
2024-08-29 03:01:30 +02:00
Corey Berla
8eb05850cb single-selection: Don't allow unselecting with autoselect
According to the documentation, when autoselect is TRUE it will
"will disallow unselecting the current item".
2024-08-27 21:18:56 +00:00
Matthias Clasen
5e6cf622e3 compare-render: Do less work for replay
We don't need to render the node, we have a reference image.
2024-08-24 20:11:32 -04:00
Matthias Clasen
107ef2017c tests: Use dmabufs in compare tests
Make the --replay mode of compare-render randomly turn textures it
finds into dmabuf textures, using /dev/udmabuf.
2024-08-24 13:10:25 -04:00