Commit Graph

2825 Commits

Author SHA1 Message Date
Matthias Clasen
309b28fa2c Test the accessible implementation for GtkText 2024-02-20 13:53:08 -05:00
Matthias Clasen
e9f311e6b6 Test the accessible implementation for GtkLabel 2024-02-20 13:53:08 -05:00
René de Hesselle
a48a2a3dc9 ci: Build testsuite for macOS
To make it work on macOS, do not add typelibdir to GI_TYPELIB_PATH.
While this change affects all the other jobs as well, it appears to
be of no consequence.
2024-02-17 14:31:51 +01:00
Matthias Clasen
24de5ffd4e gsk: Stop padding text node bounds
This should not be necessary, provided that the ink extents that
pango provides are accurate.

Update affected tests.
2024-02-16 14:45:20 -05:00
Matthias Clasen
5552b5c0ec ci: Add another xfail
This is reported in
https://gitlab.gnome.org/GNOME/gtk/-/issues/6450
2024-02-16 11:13:57 -05:00
Matthias Clasen
aaaddd1b47 testsuite: Mark the randomized path tests as flaky
They are, and having them run in ci is counterproductive for now.
2024-02-16 10:24:58 -05:00
Matthias Clasen
bb82e3e1fb Merge branch 'matthiasc/for-main' into 'main'
testsuite: Drop duplicated rounded-rect tests

See merge request GNOME/gtk!6907
2024-02-14 20:21:47 +00:00
Matthias Clasen
a4583b03a1 testsuite: Drop duplicated rounded-rect tests
No need to test this twice in a row.
2024-02-14 14:12:43 -05:00
Benjamin Otte
b12169776e testsuite: Print random clip rect
That makes it in test log output, which helps when figuring out why a
test failed if the node was not saved/is already deleted.
2024-02-14 20:12:05 +01:00
Benjamin Otte
afc7b46264 gpu: Add an epsilon before ceil()ing for offscreen size
Avoids getting the scale wrong when due to a rounding error our
pixel-aligned rectangle is 5.000000003px big and we ceil() to 6px
and produce blurry output.

Fixes #6439
2024-02-14 20:11:59 +01:00
Benjamin Otte
1afc7a9210 testsuite: Add a test for scaled texture clipping
This tests that the result is suitably clipped for doing linear
blending - the rightmost green pixel that is technically offscreen
is blending into the red pixel and turning the test yellow.

Cairo gets this wrong for some reason I didn't investigate.
2024-02-14 20:11:30 +01:00
Benjamin Otte
cb6c720d37 gpu: Render enough of a scaled texture offscreen
We were not thinking about pixel alignment and the potential later
linear blend for the final composite.

Fixes #6428
2024-02-14 20:11:29 +01:00
Matthias Clasen
a246d1a995 ci: Add an xfail
Add an xfail for the issue reported in #6444.
2024-02-14 13:32:37 -05:00
Matthias Clasen
370ecd5d15 Add more rounded-rect intersection tests
Add rounded rect intersection tests with difficult rounded rects
where the corners are not disjoint (the 'evil eye').

The first half of these tests were provided by Benjamin Otte
in #6440, the other half was added by me to cover the flipped
version of the evil eye.
2024-02-14 10:37:56 -05:00
Matthias Clasen
fdff21ae13 testsuite: Don't use g_test_init
g_test_init has the ugly habit of aborting if G_DISABLE_ASSERT
is defined, and we want to run our tests in a release build too.

Use gtk_test_init instead, which works around this issue.
2024-02-14 10:37:56 -05:00
Matthias Clasen
3b794c4951 Add a test for node bounds normalization
This tests the fixes in the previous commits for some node types.
2024-02-13 20:06:16 -05:00
Matthias Clasen
1e8d7c7891 tests: Add a new xfail for a failing test
This is filed as #6439
2024-02-13 18:35:13 -05:00
Matthias Clasen
73316a83c4 tests: Remove xfails for tests that work now
We fixed some things, yay.
2024-02-13 17:31:18 -05:00
Benjamin Otte
d4203d147a testsuite: Add a test for shadow offset clipping 2024-02-13 21:56:01 +01:00
Benjamin Otte
f9b66dff8b testsuite: Add a test for shadows with large offset
This was causing crashes in the GPU renderer.

Related: #6425
2024-02-13 21:56:01 +01:00
Alessandro Bono
cc51604267 dmabufformats: Include gdkdmabuffourccprivate.h
It includes a fallback list of fourccs. Otherwise we might miss some
DRM_FORMAT definition.

This happens in SLES12:
```
../testsuite/gdk/dmabufformats.c: In function ‘test_dmabuf_formats_basic’:
../testsuite/gdk/dmabufformats.c:29:56: error: ‘DRM_FORMAT_ABGR16161616F’ undeclared (first use in this function); did you mean ‘DRM_FORMAT_ABGR2101010’?
   29 |   g_assert_true (gdk_dmabuf_formats_contains (formats, DRM_FORMAT_ABGR16161616F, DRM_FORMAT_MOD_LINEAR));
```
2024-02-13 14:15:32 +01:00
Alessandro Bono
4fc05e7c64 dmabuftexture: Include gdkdmabuffourccprivate.h
It includes a fallback list of fourccs. Otherwise we might miss some
DRM_FORMAT definition.
2024-02-13 14:15:32 +01:00
Matthias Clasen
ea9e414ad6 Skip one more failing clipped render test 2024-02-11 22:38:52 -05:00
Matthias Clasen
1db696be79 offload: Find and use source rectangle
Look for nodes like subsurface { clip { texture {} } }, and use
the clip to provide a source rectangle for subsetting the texture.

Update affected tests, and add a new one.
2024-02-11 21:44:47 -05:00
Matthias Clasen
9a30ea1f69 subsurface: Have a source rectangle
This will let us use a subset of the full texture, which can
be necessary in the case that converters put padding around
content in dmabufs. The naming follows the Wayland viewporter
spec.

For now, make all callers pass the full texture rect.
2024-02-11 21:44:27 -05:00
Matthias Clasen
0495359eca subsurface: Rename rect to dest
We are going to introduce another rect, so better to be clear in
naming. We are following the naming of the Wayland viewporter spec
and call the rectangle that we drawing into the dest(ination).
2024-02-11 21:43:51 -05:00
Matthias Clasen
1995b9d92c Merge branch 'wip/otte/offload' into 'main'
Rework offload diff handling

See merge request GNOME/gtk!6879
2024-02-12 02:33:14 +00:00
Matthias Clasen
5b55456b75 Rework diffing one more time
Pass the surface along. We need it to identify the inspector case
in gsk_subsurface_node_diff.
2024-02-11 20:48:59 -05:00
Matthias Clasen
2cf90b6158 tests: Add a note
Point out a little gotcha.
2024-02-11 20:24:28 -05:00
Benjamin Otte
30afac9a6b offload: No need to pass the offload to the diff
We can just check if the subsurfaces contain content - and if they do,
they will be offloading and we can ignore the diff.

This essentially reverts 48740de71a
2024-02-11 20:24:28 -05:00
Benjamin Otte
dac56dd757 offload: Change the way we compute damage regions
Instead of relying on diffing subsurface nodes, we track damage
generated by offloaded contents inside GskOffload.

There are 3 stages a subsurface node can be in:

1. not offloaded
   Drawing is done by the renderer
2. offloaded above
   The renderer draws nothing
3. offloaded below
   The renderer needs to punch a hole.

Whenever the stage changes, we need to repaint.
And that can happen without the subsurface's contents changing, like
when a widget is put above the subsurface and it needs to to go from
offloaded above to below.

So we now recruit GskOffload for tracking these changes, instead of
relying on the subsurface diffing.

But we still need the subsurface diffing code to work for the
non-offloaded case, because then the offloading code is not used.
So we keep using it whenever that happens.

Not that when a subsurface transitions between being offloaded and not
being offloaded, we may diff it twice - once in the offload code and
once in the node diffing - but that shouldn't matter.
2024-02-11 20:24:28 -05:00
Matthias Clasen
0b34af438f ci: Add more xfails
These showed up in ci.
2024-02-11 20:22:16 -05:00
Matthias Clasen
ed605f01a2 testsuite: Give up on cairo for clipping tests
Cairo has a number of problems with clipping, such as

https://gitlab.freedesktop.org/cairo/cairo/-/issues/821
https://gitlab.gnome.org/GNOME/gtk/-/issues/6426
https://gitlab.gnome.org/GNOME/gtk/-/issues/6427

These require cairo fixes that are hard to come by, given
the maintainership situation. And since these the clipping
tests are randomized, such failures will pop up randomly,
making it very frustrating to deal with ci.

So lets focus these tests on the places where it is easier
to get fixes, and run the clipping tests only for the
other renderers.
2024-02-11 19:50:18 -05:00
Matthias Clasen
bed3c6f807 ci: Add xfails for some known issues
Add xfails for failing compare tests where we have known issues,
and annotate them.
2024-02-11 19:50:18 -05:00
Matthias Clasen
f6221835ef build: Compactify compare test setup
Make a loop over the variants we have, rather than duplicating
so much code.
2024-02-11 19:50:18 -05:00
Matthias Clasen
7e9ce1b266 compare-render: Add a --plain argument
This is entirely ignored, but having an argument to specify
for 'run tests as-is' makes the meson code simpler.
2024-02-11 19:50:18 -05:00
Matthias Clasen
c40f29cb54 build: Drop an unused array 2024-02-11 19:50:18 -05:00
Matthias Clasen
d7afa91023 gsk: Add a clip variant to compare tests
This creates a random clip rect and applies it as a clip node.

Currently, a bunch of the tests fail and need tracking down.
2024-02-11 19:50:18 -05:00
Matthias Clasen
865564b32f gsk: Make matrix transforms roundtrip better
When we parse a 2D matrix, we produce a 2D transform, and we
can easily regenerate a 2D matrix from it.

Tests included.
2024-02-11 19:39:19 -05:00
Benjamin Otte
9e72260c3b testsuite: Add a compare test for non-integer repeat children
This encodes the problems from the harmless looking example from
  https://blog.gtk.org/2024/01/28/new-renderers-for-gtk/
in a form that we can test.

Unsurprisingly it doesn't work on GL and Cairo.
2024-02-11 20:04:54 +01:00
Benjamin Otte
9d52b4e269 testsuite: Add another test for pixel alignment
Tests the rounding fixes from the previous commit.

I'm not disabling it on GL because it succeeds - but that is somewhat by
accident I guess.
2024-02-11 20:04:54 +01:00
Ahmed Baïzid
5efc33fe65 GtkCalendar: Add missing accessors 2024-02-11 14:40:30 +00:00
Matthias Clasen
52c228fd9e Merge branch 'macos-dmabuf-tests' into 'main'
macos: skip dmabuf tests

See merge request GNOME/gtk!6874
2024-02-11 13:48:33 +00:00
Matthias Clasen
af62aa4497 Apply 1 suggestion(s) to 1 file(s) 2024-02-11 12:04:21 +00:00
Arjan Molenaar
703e5ab9a8 dmabuf: Skip dmabuf tests for macOS
Dmabuf is not supported for macOS.
2024-02-11 11:27:13 +01:00
Matthias Clasen
7c38945abf Merge branch 'testsuite_fix_recentmanager_win32' into 'main'
testsuite: fix recentmanager failure on win32

See merge request GNOME/gtk!6656
2024-02-09 22:46:51 +00:00
Matthias Clasen
4b34c10d05 testsuite: Plug a memory leak 2024-02-09 00:07:34 -05:00
Alice Mikhaylenko
0bfd4b232b testsuite: Add a compare test for previous commit
Test that scaled border nodes properly scale their offsets.

Related: #6412
2024-02-09 04:28:32 +01:00
Matthias Clasen
906661d40b gdk: Add some subsurface tests
Test that the stacking order is properly maintained.
2024-02-07 17:41:07 -05:00
Matthias Clasen
c654cb0f37 testsuite: Add a suite for offload tests 2024-02-07 12:38:18 -05:00
Matthias Clasen
a61c7f7871 gdk: Split off dmabuf format tests
The dmabuf texture tests are failing, so we don't run them in
ci, but the format tests are perfectly fine, so split them off.

Add some tests for GdkDmabufFormatsBuilder and for the new
gdk_dmabuf_formats_equal(), too.
2024-02-07 12:38:18 -05:00
Benjamin Otte
2e669099a6 testsuite: Add a test for previous commit
Related: #6389
2024-02-04 21:57:13 +01:00
Matthias Clasen
c1270cf52b gpu: Fix a crash in vulkan
The node processing wasn't skipping 0-size nodes when using the
uber shader, leading to assertions down the road. Since the ngl
renderer doesn't use uber shaders, this only affects vulkan.

Test included.

Fixes: #6370
2024-01-27 10:30:38 -05:00
Matthias Clasen
746cfe48b0 nodeparser: Fix a font handling mishap
When we don't have an embedded font file via a url, then we want
to parse fonts "as normal", i.e. allow fallback for aliases like
"Monospace 10". This was broken when the url support was added.
Make it work again.

Update affected tests. In particular, the output of the text-fail
test goes back to be the same it was before the url changes.
2024-01-26 23:54:58 -05:00
Benjamin Otte
a7c98227e6 Merge branch 'wip/antoniof/fix-section-tiles' into 'main'
gtklistitemmanager fixes

See merge request GNOME/gtk!6805
2024-01-25 19:31:35 +00:00
Benjamin Otte
dc1f12682c testsuite: Add a test for zero width borders
See previous commit for an explanation of the problem.

This test actually draws a rounded border, but the rounding is clipped
away. What is remaining is the 4 corners of the border, where the
top/bottom color is red and the left/right color is green. But because
the bottom/right side has a width of zero, the result should be all red.
2024-01-25 19:39:34 +01:00
António Fernandes
4b45adaf39 testsuite: Test inserting items at sections
We are not catching bugs when inserting if we're right at a boundary.

This because we never add or remove items from a section. We only ever
add or remove whole sections.

Introduce a test which inserts items at a random position inside of a
section.
2024-01-25 17:16:00 +00:00
Benjamin Otte
969fc17737 testsuite: Disable test on cairo
With the --repeat version of this test, Cairo needs to draw partially
clipped glyphs. However, there's a bug in Cairo where it doesn't account
for the subpixel positioning when clipping, so the glyphs get cut off at
the edge.

This is filed as https://gitlab.freedesktop.org/cairo/cairo/-/issues/821
2024-01-23 07:12:33 +01:00
Benjamin Otte
ada0ea0f68 testsuite: Add subpixel positioning test for hidpi
On hidpi (ie scaled by 2x) we want to align to the pixel grid, not the
unit grid.

The GL renderer currently gets that wrong, so it's disabled here.
2024-01-23 06:17:14 +01:00
Benjamin Otte
fff912efd3 testsuite: Add a test for subpixel positioning
Draw a grid of 21x21 box glyphs.

Each glyph is offset by n/20 pixels in the x and y direction.

The background color is carefully selected to be divisible by 16, so
that when the box glyph is subpixel positioned by 1/4th of a pixel
offset from the pixel grid in either direction, the result will be an
edge pixel whose color value can be computed exactly.

Cairo still rounds this wrong for color values >= 128 which is why we
use a dark gray that guarantees the resulting color values are all <128.
2024-01-23 06:17:14 +01:00
Benjamin Otte
549c8aec4a testsuite: Add tests for the recent repeat node fixes
Make sure to test horizontal and vertical versions, because who knows...
2024-01-23 06:17:14 +01:00
Benjamin Otte
00be97e741 gsk: Respect offscreen_for_opacity of first child
The container node constructor forgot to initialize that value from the
first child.

Testcase included.

Fixes #6350
2024-01-22 18:22:50 +01:00
Benjamin Otte
d14932474b testsuite: clip the node
Clip from 1025px (which is what this test is about) to 1024px because the
GLES2 renderer in CI otherwise scales its repeat node offscreen for the
--repeat version of this test and that conveniently produces off-by-one
misrenderings everywhere.

However, we need to keep the image large enough so that all the glyphs
are actually rendered and not skipped which would not overflow the
cache.
2024-01-22 08:30:16 +01:00
Benjamin Otte
f0982e2683 testsuite: Overflow slices of glyph cache
This test is specifically engineered to trigger an overflow in the glyph
renderer that was theorized on IRC with an earlier patchset.

If only one slice was available, and that slice was not high enough to
hold the glyph we were trying to put in there, it would allocate a slice
that was too small. The check for the size was missing.

So now add a test that fills up all the slices in the glyph cache apart
from one and than tries to add one final glyph that is too large for the
last slice.
2024-01-22 07:47:35 +01:00
Benjamin Otte
d8fbaf5d4f testsuite: Add a test to exhaust the glyph cache
See previous commit.
2024-01-22 07:47:10 +01:00
Benjamin Otte
3eb5447376 rendernodeparser: Improve error handling for font parsing
After the node-editor crashed on me once too often, I decided to take a
good hard look at the parsing code and add a bunch of weird corner
cases into the testsuite.

That meant redoing the parser so that the error paths cause neither
crashes nor duplicated or wrong error messages.
2024-01-22 07:47:10 +01:00
Benjamin Otte
4e00384830 testsuite: Remove duplicate newline 2024-01-22 07:47:10 +01:00
Matthias Clasen
f781039aa2 gsk: Add a testcase for underlines and carets
The gl renderer has an optimization where it uses the glyph atlas
to render color nodes that show up in the middle of text (e.g. for
underlines and carets). This adds a simple test for that scenario,
which hits this codepath.
2024-01-21 09:29:57 -05:00
Matthias Clasen
e55e9e3b36 Shrink the repeat-repeats tests
This was triggering timeouts in ci.
2024-01-16 20:58:02 -05:00
Matthias Clasen
385b9a7241 gsk: Serialize custom fonts with url
If we see custom fonts when serializeing text nodes, write data
url that contains the font file, the first time we see it.

This does not add blobs standard fonts, like Cantarell or Monospace.

Update all affected nodeparser tests.
2024-01-16 07:04:45 -05:00
Matthias Clasen
cd7fe772a7 tests: Drop fontconfig setup for custom fonts
We are putting custom fonts into node files now, so there is
no more need for this.
2024-01-16 07:04:45 -05:00
Matthias Clasen
317bba756e Port existing gsk tests to embedded custom fonts
Make all the tests using custom fonts use the new url syntax.
2024-01-16 07:04:45 -05:00
Matthias Clasen
246876a404 Add a test for font-related node parser errors
This tests the behaviors implemented in the previous commit.
2024-01-15 18:58:17 -05:00
Matthias Clasen
27a086b5f0 Add a test for new text node syntax
Add a test that checks that font: properties can be parsed without
error, both with and without the optional url.
2024-01-15 18:58:17 -05:00
Matthias Clasen
8158945de9 gsk: Allow custom fonts in node files
This will let us store complete test fonts inside node files,
as data: urls. You can also use a file: url to refer to a local
file.

The syntax is as follows:

text {
  font: "FONT DESCRIPTION" url("data:font/ttf;base64,FONT DATA");
}

with the url being optional.
2024-01-15 18:58:17 -05:00
Matthias Clasen
690381672b tests: Fix up test font naming
The entry for the family name in the name table has nameID=1, not
nameID=0, so we were relying on the filename to be just right.
Oops.
2024-01-15 18:25:15 -05:00
Matthias Clasen
b78d2a7f75 Add another font rendering test
This one tests that we handle glyphs with lsb correctly wrt. to
positioning.
2024-01-13 17:47:27 -05:00
Matthias Clasen
9f4f65be4a gsk: Add test for clipped big glyphs
Tests the fix in the previous commit 93715b963e.

Sadly, the flipped variant of this test fails with the cairo
renderer, so it is marked as -nocairo. All the other renderers
pass it.
2024-01-12 16:02:05 -05:00
Benjamin Otte
3b299f574d testsuite: Add a test for contained clips
Related: #6322
2024-01-12 20:06:04 +01:00
Matthias Clasen
153cb8316e gsk: Fix up test names to include 'compare' 2024-01-11 23:19:29 -05:00
Matthias Clasen
7ad7c0d8c1 Merge branch 'switch-shapes' into 'main'
switch: Follow "switch-shapes" setting

Closes #5354

See merge request GNOME/gtk!6731
2024-01-11 19:19:58 +00:00
Matthias Clasen
afe4cbf26d tests: Change the way custom fonts are handled
Instead of setting FONTCONFIG_FILE to a custom font configuration,
pass the directory containing the fonts as TEST_FONTS and use
FcConfigAppFontAddDir to add them to the default font configuration.
2024-01-10 22:18:37 -05:00
Matthias Clasen
cc92b9b19f gsk: Add another font text
This is similar to text-mixed-color, but it uses the COLRv1 table,
to test our support for this font technology.
2024-01-10 19:44:55 -05:00
Florian Müllner
bf0120f73d switch: Follow "show-status-shapes" setting
Whether or not switches include shapes to indicate their ON/OFF
state is currently controlled by the stylesheet (in particular
the HighContrast style).

However there are use cases for both using the HighContrast style
without shapes, and for using shapes with the regular stylesheet,
so follow the newly added "show-status-shapes" setting instead.

https://gitlab.gnome.org/GNOME/gtk/-/issues/5354
2024-01-11 01:33:16 +01:00
Matthias Clasen
dc30044829 Merge branch 'gpu-fix-mixed-color-text' into 'main'
gpu: Fix handling of mixed-color text runs

See merge request GNOME/gtk!6725
2024-01-10 18:11:23 +00:00
Matthias Clasen
781fe2d7fa gsk: Add a compare test for mixed color runs
This tests the fixes in aa82190da659b5 and dcaa2c4ccb182c74cb40.

The test uses a custom font named 'text-mixed-color' which contains
six glyphs that are just boxes. Glyphs 1, 2, 3 are just plain glyphs,
and glyphs 4, 5, 6 are color glyphs in red, green and blue.

The glyphs are mapped to the characters A, B, C, D, E, F.

The test is currently disabled for cairo, since it has some issues
with transformed color glyphs.
2024-01-10 12:49:08 -05:00
Matthias Clasen
754d364efd gsk: Allow custom fonts in tests
The commit adds a custom fontconfig configuration in
testsuite/gsk/fonts/fonts.conf and sets the FONTCONFIG_FILE
environment variable for the gsk compare tests to point at it.

To use a custom font in tests, just drop it into the
testsuite/gsk/fonts/ directory.

The font configuration includes the system configuration,
so existing tests should not be affected.
2024-01-10 07:58:19 -05:00
Benjamin Otte
c5bdf0a995 testsuite: Add tests for pixel grid accuracy
See previous commit for details.
2024-01-10 01:33:49 +01:00
Benjamin Otte
131ab11f5c testsuite: Check that pixel grid math respects offsets 2024-01-10 00:13:52 +01:00
Benjamin Otte
2ecb8c08dc testsuite: Add a test for borders inside opacity
Tests the latest fix.
2024-01-08 11:17:09 +01:00
Benjamin Otte
a0e9d93b4c testsuite: Add a test for previous fix
Fill a rectangle with fractional coordinates << 1.0 but scale it up so
that it ends up being nice integers.

Makes sure that nobody does any bad rounding here.
2024-01-08 11:17:09 +01:00
Matthias Clasen
bf14a5f70b ci: Fix test names
Don't call the offload test 'parser ...'.
2024-01-07 09:40:43 -05:00
Benjamin Otte
0ba8903fa5 testsuite: Don't #include <gsk/gl/gskglrenderer.h> 2024-01-07 14:47:22 +01:00
Benjamin Otte
e2c8b7fa6c testsuite: Use gsk_renderer_realize_for_display()
... in all the places where we used realize (NULL) before.
2024-01-07 14:47:22 +01:00
Benjamin Otte
5f03053569 gsk: include Vulkan renderer in public header
The Vulkan renderer can just be public API, because it doesn't expose
any Vulkan-specific APIs.
And it can just exist when compiled without Vulkan, because it can fail
to realize.

Also move get rid of the gsk/vulkan/gskvulkanrenderer.h header. It was
experimental and isn't necessary now that the renderer is included via
gsk.h.
2024-01-07 14:47:22 +01:00
Matthias Clasen
c8ae2d9002 testsuite: Add NGL and Vulkan renderer to compare tests
Add a testsuite called gsk-compare-vulkan to run
the gsk renderer tests with the Vulkan renderer and
gsk-compare-ngl to run them with the NGL renderer.

To run the tests locally, you can do:

meson test -C_build --suite gsk-compare-vulkan
2024-01-07 08:18:36 +01:00
Benjamin Otte
64e5c76323 png: Don't set a size limit when saving
gdk_texture_save_to_png_bytes() cannot fail, so ensure that it doesn't.

Testsuite has been updated to check for this case.

Note that we do not load the PNG file that we generate here.
Loading is a lot more scary than saving after all.
If people want to load oversized PNG files, they should use a real PNG
loader.
2024-01-07 07:22:53 +01:00
Benjamin Otte
8361949ba1 gpu: Handle >7 color stops
If there are more than 7 color stops, we can split the gradient into
multiple gradients with color stops like so:
  0, 1, 2, 3, 4, 5, transparent
  transparent, 6, 7, 8, 9, 10, transparent
  ...
  transparent, n-2, n-1, n
and use the new BLEND_ADD to draw them on top of each other.

Adapt the testcae that tests this to use colors that work with the fancy
algorithm we use now, so that BLEND_ADD and transitions to transparent
do not cause issues.
2024-01-07 07:22:52 +01:00
Benjamin Otte
3b6035a46d testsuite: Add new renderers to the scaling test 2024-01-07 07:22:52 +01:00
Benjamin Otte
1858d955de testsuite: Add a test to check scaling behavior
Various GL texture formats do not support linear scaling or mipmap
generation.

Add a test that checks this.
2024-01-07 07:22:51 +01:00
Benjamin Otte
3e5af3afce testsuite: Update memorytexture text to use new renderers
1. Refactor checks for GL support

2. Add NGL and Vulkan
2024-01-07 07:22:51 +01:00
Benjamin Otte
1e54e838e0 vulkan: Remove GskVulkanRenderer
We want to introduce a new one next.

Technically, this breaks API, because gsk_vulkan_renderer_new() is going
away, but practically, we're gonna bring it back once we introduce that
renderer in a few commits.
2024-01-07 07:22:49 +01:00
Benjamin Otte
f200e8b132 reftests: Add a testcase for GtkGLArea::allowed-apis
See code comments for how it uses GL commands that should fail with GLES.

Related: !6520
2024-01-05 07:30:38 +01:00
Benjamin Otte
ac64948efd testsuite: Add a test for a recent mipmap generation bug
Tests the fix in ab1fba6fdc.

Related: #6298
Related: !6704
2024-01-05 07:20:32 +01:00
Benjamin Otte
b16d01e018 testsuite: Replace g_random_*() with g_test_rand_*()
... in the whole testsuite
2024-01-03 16:05:25 +01:00
Benjamin Otte
f0e6c03d94 testsuite: Add a test for pixel alignment of offscreens
The test ensures that offscreens render to the same pixel grid as the
actual image, and they are not offset by fractions of a pixel.

The Cairo renderer fails here because Cairo's clipping code rounds pixel
values wrong.
2024-01-03 04:11:35 +01:00
Benjamin Otte
da5de1ba99 nodeparser: Fix SEGV in shadows parsing code
Testcase included

The code was writing invalid memory, so this might not have always
crashed, but I did my best to write the test so it causes a SEGV.

Also included is a fix for the testsuite where the expected result was
wrong.
2024-01-03 04:11:35 +01:00
Benjamin Otte
e9d2f832a1 testsuite: Add a test for a clipping cornercase
If the new clip cannot intersect with the old clip and there is a global
opacity setting, things can go wrong.

So test that they don't.
2024-01-03 04:11:35 +01:00
Benjamin Otte
4fac0f713a testsuite: Add clipped overly large paths
... to make sure that renderers clip any masks they generate for paths.
2024-01-03 04:11:35 +01:00
Benjamin Otte
fff8198393 testsuite: GTK_MODULES doesn't exist anymore 2024-01-03 04:11:34 +01:00
Benjamin Otte
df2cbb4e9f testsuite: make compare-render --replay store results
The replayed node/images weren't saved.

I wanted to check that an optimization is done when replaying a test,
but without a saved node file, I couldn't.
2024-01-03 04:11:34 +01:00
Benjamin Otte
2990c1d8d8 testsuite: Add a test for conic gradients
Make all colorstops red, so that it's obvious what color each pixel is.
2024-01-03 04:11:34 +01:00
Benjamin Otte
4b5adcd374 testsuite: Fix CRC error in reference image
How did that get there?
2024-01-03 04:11:34 +01:00
Matthias Clasen
71bbba45cc Don't close the display in compare-render
It is not material to this test, and it causes some hard to
understand problem with fontconfigs use of mmap, leading to
a sporadic segfaults in pangos fontconfig thread.
2023-12-30 20:54:37 -05:00
Matthias Clasen
2da5ca4b42 gsk: Temporarily disable a test
This test fails on my system currently, since rawhide libpng appears
to have changed the encoding of pngs so that the texture nodes no
longer match the reference. This will be a problem as long as our
ci systems have an older libpng, so disable this test for now.
2023-12-30 20:54:37 -05:00
Benjamin Otte
c2fda3144d testsuite: Add a radial gradient test
All colors are idential so that the test doesn't fail due to rendering
differences.
2023-12-28 07:35:46 +01:00
Benjamin Otte
1e19629ce1 testsuite: Add a testcase for extensive rounded clips
The GL renderer can't handle this, so it's excluded.
2023-12-28 07:35:46 +01:00
Benjamin Otte
c7b4347342 roundedrect: Fix an intersection cornercase
These 2 rectangles used to intersect fine:
  0 0 50 50 / 50 0
  0 0 50 50 / 0 50
But the computed result was:
  0 0 50 50 / 50
which is not a valid rectangle, because the corners overlap.

Make sure such rectangles return NOT_REPRESENTABLE.

The above rectangle has been added to the testsuite.
2023-12-28 07:35:46 +01:00
Benjamin Otte
1c3e8d5280 testsuite: Add stroke tests
Same as the recent fill tests, just with strokes.
2023-12-28 07:35:46 +01:00
Benjamin Otte
e1ca4b4569 testsuite: Add opacity handling test for fill nodes 2023-12-28 07:35:46 +01:00
Benjamin Otte
34392ca018 testsuite: Add a test filling 3d content
Checks that a simple Cairo fallback cannot be used.
2023-12-28 07:35:46 +01:00
Benjamin Otte
a28915bffb testsuite: Disable all failing tests on GL renderer
Of all the recently added tests, disable the ones that fail on the GL
renderer, so that CI passes.
2023-12-26 05:03:25 +01:00
Benjamin Otte
2af5f7ffd1 testsuite: Limit compare --mask tests to 1000x1000
There are some tests that generate large images.

However, if we mask that image, we might have to generate offscreens
both for the source and for the mask.
And if we do that, it can take a long time. And especially on CI with
software rendering, that can quickly become noticable and result in
timeouts.
2023-12-26 05:03:25 +01:00
Benjamin Otte
e1bae384f0 testsuite: Add a shadow test
This test tests that shadows that are offset to outside the clip region
but where the blur goes back into the clip region get correctly drawn
and not optimized away.

To view what the test actually draws, remove at least the color-matrix
- it's only used so the blurring algorithm doesn't cause different
results - and maybe also the clip node.
2023-12-26 05:03:24 +01:00
Benjamin Otte
12a97ef422 testsuite: Add a forgotten test
The test existed in git but wasn't hooked up. So let's do that by:

1. Adding it to the build
2. Adapting it a bit so rounding errors really don't trigger (as the
   original commit claimed they shouldn't).
3. Re-renaming it because this was actually about 3d gradients
2023-12-26 05:03:24 +01:00
Benjamin Otte
9a6d6e80b5 testsuite: Add a nonorthogonal linear-gradient transform
The actual gradient line is covered by blocks, so there are no
artifacts. But if a renderer screws this up, the blue/red will seep
through these blocks.
2023-12-26 05:03:24 +01:00
Benjamin Otte
b01ed4ce39 rendernode: Set better size for mask nodes
Mask nodes are transparent outside of the intersection of source and
mask, unless the mask ode is inverted alpha.

Set the bounds accordingly.

Tests have been updated accordingly.
2023-12-26 05:03:24 +01:00
Benjamin Otte
2b142a59a1 testsuite: Add compare tests for mask modes inside an opacity node 2023-12-26 05:03:24 +01:00
Benjamin Otte
20c81d90c9 testsuite: Add yet another repeat node test
This one tests that when no offscreen is created for repeating but we
drw everything individually, we still respect the clip set via
child_bounds.
2023-12-26 05:03:24 +01:00
Benjamin Otte
3167a5b4d6 testsuite: Rewrite the --repeat option
* Don't grow the size too much - clip the size to 1000x1000
 * Add an offset, so the repeating doesn't always start top left
2023-12-26 05:03:24 +01:00
Benjamin Otte
f5584b178d testsuite: Add a test for repeat node offscreen scaling
Ensure that the offscreens for repeat nodes pick the right xscale and
yscale so that they render pixel-aligned.
2023-12-26 05:03:24 +01:00
Benjamin Otte
332fd1b840 testsuite: Add a repeat testcase
This test tests multiple things:

1. That huge contents are properly clipped by repeat nodes, even if the
   repeat happens in the visible part
2. That repeating only horizontally or only vertically is done quickly
   via offscreens when lots of repeating is done
2023-12-26 05:03:23 +01:00
Benjamin Otte
5e85b1aa02 testsuite: Add a repeat test
Ensures that repeating actually causes repeating in the renderer by
repeating a 1x1 image a lot.
2023-12-26 05:03:23 +01:00
Benjamin Otte
7f7254f10b testsuite: Add a repeat test for child bounds
Test that if the child is a texture that extends the child bounds, that
extension does not get repeated when rendering.

This can easily happen when the child is not drawn as an offscreen, but
instead the texture cache is consulted and no check for matching size is
done.
2023-12-26 05:03:23 +01:00
Benjamin Otte
72c58ccd7d testsuite: Add another test
This test ensures that offscreens for cross-fade children are properly
clipped and that the renderers can deal with the two not overlapping.
2023-12-26 05:03:23 +01:00
Benjamin Otte
f574cc2936 testsuite: Add test for gradients
Test that it can do 64 color stops.

Should ensure that renderers either can do unlimited amounts or have
fallbacks in place.
2023-12-26 05:03:23 +01:00
Benjamin Otte
2b59c4cf16 testsuite: Test we don't crash with overly large nodes
... when these nodes are used as children of a complex transform nodes
and we lose the clip.
2023-12-26 05:03:23 +01:00
Benjamin Otte
72b35a32fd testsuite: Fix corner case when testing repeats
When we test repeat nodes, make sure we round the size of the original
node up to an integer.
The reference image for the node is a rounded up, so when we generate a
new reference image we cannot deal with anything else.

Fixes huge-width test with --repeat.
2023-12-26 05:03:23 +01:00
Benjamin Otte
97b78cede0 testsuite: Unify renderer exclusion naming
Instead of using "-3d" to exclude Cairo rendering, use "-no$renderer" to
allow excluding any renderer.
And because we use contains() for the check, we can exclude multiple
renderers by naming the test sth like "test-nogl-nocairo.node"
2023-12-26 05:03:23 +01:00
Benjamin Otte
653d1eec55 testsuite: Add a variant of an existing test
This variant ccreates a huge node in the clipped region and tests that
renderers properly clip it away.
2023-12-26 04:25:11 +01:00
Benjamin Otte
4cc2a660e3 testsuite: Add a render test for a recent segfault
Renderer tend to ignore the clip when offscreening the child of a blur
node. So make a test that oversizes that child.
2023-12-26 04:25:11 +01:00
Matthias Clasen
cfa9dc6162 testsuite: Use #pragma once consistently 2023-12-20 10:55:14 -05:00
Benjamin Otte
b782f80311 Merge branch 'testsuite_fix_display_x11_on_win32' into 'main'
testsuite: don't run x11-specific tests if disabled

See merge request GNOME/gtk!6657
2023-12-14 01:57:13 +00:00
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
g.willems
d692243727 testsuite: fix icontheme test failure on win32
g_str_has_suffix() fails due to different path separators.
Compare URIs instead.
2023-12-12 21:25:16 +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
Benjamin Otte
2b6e7147d6 build: Sort alphabetically 2023-12-11 07:33:26 +01:00
Benjamin Otte
6e7c499408 testsuite: Don't create nodes with negative size
If width or height are too small, only create one mask node.

The previous math would create the 2nd node with negative width/height.
2023-12-11 07:33:26 +01:00
Benjamin Otte
e3299e38df cairo: Handle clipped blur content
This is the result of experimenting with corner cases when blurring.

The result is a test that tests when the child of a blur node is
clipped out but the blurred child is not, the blurred parts are still
visible.

This immediately broke the cairo renderer, so the fix is included.
2023-12-11 07:33:24 +01:00