Commit Graph

2767 Commits

Author SHA1 Message Date
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
Benjamin Otte
19171c7a89 testsuite: Add a test for opacity + color-matrix nodes
These are 2x2 combinations that:
1. Use a texture child node vs a color child node
   This should force an offscreen vs straight up use a texture.
2. Switch opacity and color-matrix
   Either put the color matrix into the opacity node or put the opacity
   into the color matrix.

This is worth testing because renderers often combine opacity into the
color matrix to avoid offscreens.

And they do that because applications often create faded out symbolic
images, which end up as a combination of these nodes.
2023-12-09 19:32:39 +01:00
g.willems
f96c72c4b3 testsuite: fix recentmanager failure on win32
Replace unsupported and deprecated 'g_test_trap_fork' by 'g_test_subprocess'.
Force 'gtk-recent-files-enabled' to TRUE.
2023-12-09 18:08:03 +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
Matthias Clasen
b7a1b1d7ee Fix some static analysis warnings 2023-11-24 10:35:57 -05:00
Matthias Clasen
210c7f25ad testsuite: Leak even less
A memory leak spotted by asan.
2023-11-21 23:21:55 -05:00
Matthias Clasen
9695791f7b testsuite: Don't leak so much
My subsurface attach code was leaking all the nodes. Oops.
2023-11-21 23:21:55 -05:00
Matthias Clasen
b916c4dac1 ci: Reshuffle test setups
Add a wayland_gl setup that explicitly uses desktop GL, and rename
wayland_gles to wayland_gles2 (since that is what it does).

In ci, make the fedora-x86_64 runner run tests with wayland_gl
and wayland_gles2, and make the fedora-release runner run test
with wayland and x11.
2023-11-19 08:24:38 -05:00
Matthias Clasen
fb969f5431 offload: Raise all subsurfaces that can be
If two subsurfaces don't overlap and aren't otherwise obstructed,
we can just raise them  both.

Tests included.
2023-11-18 08:19:43 -05:00
Matthias Clasen
00a63a9fcf offload tests: Fix the simple test
This was expecting the wrong 'above'. Oops.
2023-11-18 08:19:43 -05:00
Matthias Clasen
b4ae2377b3 offload tests: Make --verbose work
When passing a directory via G_TEST_SRCDIR, still pay attention
to --verbose, and print out each file thats tests. This lets us
quickly pin down which test fails.
2023-11-18 08:19:43 -05:00
Matthias Clasen
392977d670 offload tests: fix output 2023-11-18 08:18:29 -05:00
Matthias Clasen
3ab7b2d7ce Merge branch 'va-fixes-reported-by-pvs' into 'main'
Fix issues spotted by PVS-Studio

See merge request GNOME/gtk!6558
2023-11-15 00:27:08 +00:00
Andrey Kutejko
540a83327f Fix issues spotted by PVS-Studio 2023-11-14 08:56:40 +01:00
Matthias Clasen
44d977844b testsuite: Add offload tests
These tests come in two variants.

The first takes .node and .offload file, parses the node file,
and compares the resulting subsurface attachments to expected results.

The second variant takes two .node/.offload file pairs and a .diff
file, parses the node files, compares the resulting subsurface
attachments, and then diffs the nodes, comparing the resulting
area to the region in the .diff file.
2023-11-13 18:41:53 -06:00
Matthias Clasen
d0a675ab01 gsk: Add subsurface nodes
Also show them in the inspector recorder, with some information.
2023-11-13 22:17:35 +01:00
Benjamin Otte
a9e4993184 Merge branch 'wip/otte/enable-debug' into 'main'
Remove G_ENABLE_DEBUG around debug checks

See merge request GNOME/gtk!6546
2023-11-07 15:12:11 +00: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
Benjamin Otte
a2e1e727c5 testsuite: Make texture-scale-magnify tests have roundable numbers
Use a number that's 2^N * 255 to get floating point awesomeness combined
with uint8_t awesomeness.

Fixes rounding errors in samplers.
2023-11-07 05:12:57 +01:00
Benjamin Otte
f624586a75 testsuite: Don't skip test
The test now works without debugging as debug messages are always
available.
2023-11-05 11:16:23 +01:00
Benjamin Otte
00ce51472c testsuite: Add render test for texture placement
Make sure that texture nodes sample from the texture properly.
2023-11-01 08:01:27 +01:00
Benjamin Otte
7ba4ba05e1 gl: Fix padding in icon library
The previous code would not pad the left side with the left column of
pixels but with the top row.

Test attached.
2023-10-31 00:50:00 +01:00
Benjamin Otte
85e1088171 gsk: Fix texture-scale node Cairo drawing
The code was interpreting x/y coordinates wrong sometimes and causing
things to not be drawn at the correct offset.

Testcase included.
2023-10-31 00:36:27 +01:00
Benjamin Otte
cc3e25b163 testsuite: Be more resistant against rounding errors
Make a test use numbers that are less likely to cause rounding
issues in GPUs (read: use powers of 2).
2023-10-31 00:36:27 +01:00
Benjamin Otte
bdb3e345c8 testsuite: Add test for scaling texture-scale node
Finally figured out a way to test that a texture-scale node using
NEAREST that is upscaled using a transform node doesn't use NEAREST but
LINEAR.
2023-10-31 00:36:27 +01:00
Benjamin Otte
a30e9dcfeb testsuite: Add a test for nearest vs linear scales 2023-10-31 00:36:27 +01:00
Matthias Clasen
fb20542fcc Merge branch 'fix_name_computation' into 'main'
a11y: When using rule 2.E for computing accessible name, use it only if appropriate

See merge request GNOME/gtk!6495
2023-10-27 17:32:14 +00:00
Lukáš Tyrychtr
a26e289d5c Adjust tests 2023-10-26 09:44:59 +02: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
c9b83dfa1d testsuite: Add a test for texture-scale filters
Check that the right filter is chosen and that that filter is
implemented correctly.

The test is disabled for Cairo because Cairo (or rather Pixman)
doesn't follow the filtering specifications for GL/Vulkan and in
particular the nearest filter picks a different pixel.
2023-10-24 01:41:25 +02: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
Benjamin Otte
677a601d11 Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Init the dmabuf subsystem before creating texture

See merge request GNOME/gtk!6499
2023-10-19 19:30:23 +00:00
Benjamin Otte
194db51fba dmabuf: Make Builder::display non-nullable
We always have a display - the default display - so there's no need to
accept NULL.

Plus, we need a display when building the texture, so accepthing NULL
wouldn't even make sense.

Includes update to defaultvalue test.
2023-10-19 20:51:51 +02:00
Benjamin Otte
402a51b876 testsuite: Use a better opacity in the test
Using the default opacity of 0.5 makes it unclear if 0xFF should be
mapped to 0x7F or 0x80.

0.6 should hopefully map to 0x99 always.
2023-10-19 13:38:47 +02:00
Benjamin Otte
d1e091279c testsuite: fix "empty" linear-gradient compare test
We need to provide color stops to avoid rounding errors with different
shaders.

That makes the empty linear gradient somewhat less empty, but I think
it's the emptiest we can make it.
2023-10-19 13:38:47 +02:00
Benjamin Otte
e584d17aad Merge branch 'dmabuf-texture-api' into 'main'
Add API for dmabuf textures

See merge request GNOME/gtk!6463
2023-10-11 20:25:50 +00:00
Matthias Clasen
4936965fb6 display: Get supported dmabuf formats
These are the dmabuf formats that we can import
into a GL context as an EGLImage, and successfully
download.

We skip the GdkDisplay:dmabuf-formats property
in the default value tests, since the nominal
default value is NULL, but the actual value is
constructed on demand.
2023-10-11 15:43:01 -04:00
Christian Hergert
d8bbe1c296 testsuite/gsk: add render test for mask(texture|color) 2023-10-06 10:52:53 -07:00
Matthias Clasen
6da5b8cb25 tests: Split off some path utilities
Thes can be reused in different test sources.
2023-09-23 15:28:35 -04:00
Matthias Clasen
5dd0d39a6b Drop performance tests
These were an experient, and not actively used,
and libsysprof has been changing api so they broke.

Fixes: #6112
2023-09-21 13:14:48 -04:00
Matthias Clasen
cc904698a6 Merge branch 'matthiasc/for-main' into 'main'
contour: Make circles and rounded rects match

See merge request GNOME/gtk!6405
2023-09-18 11:14:39 +00:00
Benjamin Otte
95865cb1bf gsk: Fix clipping error when drawing shadows
When shadows were offset - in particular when offset so the original
source was out of bounds of the result - the drawing code would create a
pattern for it that didn't include enough of it to compose a shadow.

Fix that by not creating those patterns anymore, but instead drawing the
source (potentially multiple times) at the required offsets.

While that does more drawing, it simplifies the shadow node draw code,
and that's the primary goal of the Cairo rendering.

Test included.
2023-09-18 07:53:03 +02:00
Matthias Clasen
9c159cf129 path: Tweak printing a bit more
We are dealing with floats here, so using
g_ascii_dtostr isn't really the best.

Update affected tests.
2023-09-17 22:35:33 -04:00
Matthias Clasen
957d494090 contour: Make circles and rounded rects match
Make sure that we print the weights in the
same way (as floats).

Update affected tests.
2023-09-17 20:32:32 -04:00
Matthias Clasen
f67c57b1f8 path: Fix parsing rounded rects
We were messing up the bottom left corner.

Test included.
2023-09-17 17:01:44 -04:00
Matthias Clasen
ecfc661054 Adapt tests to new path builder behavior
Some tests were expecting to get elevated curves
from GskPathBuilder. But they won't, anymore.
2023-09-17 08:53:10 -04:00
Matthias Clasen
f0bd0c3e50 contour: Add more tests for circles
Cover the radius 0 case, in particular.
2023-09-16 08:31:52 -04:00
Matthias Clasen
4d71ff6da1 contour: Fixes for circles
Make circle contours use 'foreach coordinates' for
its points. This works here, but not for general
conics. As with the other custom contours, avoid
emitting collapsed conics.
2023-09-16 08:27:18 -04:00
Matthias Clasen
6d16776e27 tests: Cosmetics 2023-09-16 08:27:08 -04:00
Matthias Clasen
d21ee115d0 Update private path tests
Our parser only recognizes 'complete' rounded
rects, so don't test roundtrips for incomplete
ones.
2023-09-15 16:46:23 -04:00
Matthias Clasen
2dd8e3b0eb contour: Add more tests for rounded rects
This is covering special cases where some
of the curves are omitted.
2023-09-15 16:46:23 -04:00
Matthias Clasen
eb6ca8f39a contour: Add more tests for rects
Spot-check the special cases:
rects with zero height or width.
2023-09-15 16:31:09 -04:00
Benjamin Otte
41af8ee2e2 testsuite: Add another test
his is the opposite of the test in 1502c21e97.

Also change the numbers in that test so it doesn't need a ref file.

Related: #6075
2023-09-15 16:34:00 +02:00