Commit Graph

45 Commits

Author SHA1 Message Date
Benjamin Otte
2aea75f426 testsuite: Run the plain test without any args
Never do nothing.
2024-03-16 14:53:22 +01:00
Matthias Clasen
cfee8f4b11 tests: Cosmetics 2024-03-09 12:43:33 -05:00
Matthias Clasen
fc6e08082b tests: Make compare-render less repetitive
Only run the unmodified comparison if --plain is passed
on the commandline.
2024-03-08 22:27:14 -05:00
Matthias Clasen
f1a3235039 Add tests for uber rendering
Add a --colorflip option to the compare-render test. This applies
a color matrix to the node, which has the intended side-effect of
convincing the Vulkan renderer to use its uber shader, so we get
test results comparing the uber output to its non-uber siblings.
2024-03-08 20:44:42 -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
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
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
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
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
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
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
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
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
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
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
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
Sergey Bugaev
6cd6da050b testsuite: Add render node replay tests
This takes a render node tree and "replays" it by using the GtkSnapshot
machinery. We don't necesserily expect to get back an exactly equal
render node tree back, since GtkSnapshot applies various small
optimizations where possible, but the original and the replayed nodes
should render to identical textures.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-25 15:54:05 +03:00
Matthias Clasen
2217509701 Plug a memory leak in gsk tests
Pointed out by asan.
2023-06-27 21:48:12 -04:00
Matthias Clasen
b439398d09 testsuite: Plug some memory leaks 2023-06-09 22:40:38 -04:00
Matthias Clasen
dc3003bc4d gsk: Improve test coverage
Add more tests for gsk transforms, render node
and renderer apis.
2023-05-10 20:21:31 -04:00
Matthias Clasen
abbb3a2da6 testsuite: Close displays in the gsk tests
This gives us better coverage of the dispose
codepath for a driver that has actually been
used.
2023-05-10 20:21:12 -04:00
Matthias Clasen
e56a539363 Add a masked variation to gsk tests
This improves test coverage for mask nodes.
2023-05-05 15:05:08 -04:00
Matthias Clasen
406b1e2e03 testsuite: Fix gsk test
The repeated tests were not careful enough to produce
the correct reference image to match what the repeat
node does.

With these changes, all cairo tests pass.
2023-05-01 13:43:33 -04:00
Matthias Clasen
3b2ba8ed99 Add more gsk tests
Add options to the gsk compare-render test for
modifying the node (and do a matching change to
the reference image).

flip: negative scale flipping things horizontally
rotate: 90 degree rotation
repeat: 2x2 grid
2023-05-01 13:35:35 -04:00
Benjamin Otte
625b5ce91a testsuite: Port compare_render() to use textures 2021-09-16 23:59:37 +02:00
Matthias Clasen
ffab67ac70 testsuite: Call g_test_init in test binaries
Without it, we mess out on G_DEBUG=fatal-warnings,
so our ci does not alert us that we run a bunch of
tests which spit out warnings.
2021-09-14 16:12:55 -04:00
Matthias Clasen
4d1075a082 testsuite: Reduce the use of g_assert
Stop using g_assert() in the gsk tests.
2021-04-12 21:22:46 -04:00
Simon McVittie
1c6cf7a3b6 reftests: Share reftest-compare.[ch] between GSK and GTK tests
The only non-whitespace difference is that the copy in GSK does not
set the symbol's visibility.

Signed-off-by: Simon McVittie <smcv@debian.org>
2021-02-15 09:22:41 +00:00
Matthias Clasen
121e61cf01 gsk: Avoid using gtk css types in public api
Using GtkCssSection in public headers here may be
ok from the C perspective, since it all ends up in
the same library anyway. But it causes circular
dependency problems for our gir files that are still
split by namespace.

To avoid this problem, copy the GtkCssLocation struct
struct as GskParseLocation, and pass take two of them
instead of a GtkCssSection in the error callback.

Update all users.

Fixes: #2454
2020-11-16 23:27:44 -05:00
Jonas Ådahl
2ff74eb667 gdk/toplevel: Negotiate surface size via a compute-size signal
GTK will not up front know how to correctly calculate a size, since it
will not be able to reliably predict the constraints that may exist
where it will be mapped.

Thus, to handle this, calculate the size of the toplevel by having GDK
emitting a signal called 'compute-size' that will contain information
needed for computing a toplevel window size.

This signal may be emitted at any time, e.g. during
gdk_toplevel_present(), or spontaneously if constraints change.

This also drops the max size from the toplevel layout, while moving the
min size from the toplevel layout struct to the struct passed via the
signal,

This needs changes to a test case where we make sure we process
GDK_CONFIGURE etc, which means we also needs to show the window and
process all pending events in the test-focus-chain test case.
2020-08-05 15:49:00 +02:00
Timm Bäder
04b7dd802a compare-render: Fix some memory leaks 2020-05-24 17:14:18 +02:00
Timm Bäder
2425d61516 Pass common_cflags to testuite/gsk executables 2020-05-19 08:32:33 +02:00
Matthias Clasen
c22af88235 tests: Allow setting a subdir for output
meson seems somewhat weak when it comes to handling
test output. We need to get the output from different
test runs into different locations, and the only
way to communicate from a test setup with the actual
test code seems the environment, so use that.

Make all tests that produce output in files respect
a TEST_OUTPUT_SUBDIR environment variable which specifies
the name of a subdirectory to use. This is combined
with the existing --output argument, which specifies
a per-test location.

Affected tests are reftests, css performance tests
and gsk compare tests.
2020-05-15 14:11:53 -04:00
Matthias Clasen
fd7f6ca7ad tests: improve error handling 2019-07-25 13:51:34 -04:00
Timm Bäder
042f7d117f compare-render: Don't unref an invalid GFile
We already unref it when the g_file_make_directory_with_parents fails.
2019-07-07 07:24:00 +02:00
Benjamin Otte
062244ab71 testsuite: Make creating the output dir not racy
Fixes #1942
2019-06-09 23:17:10 +02:00
Matthias Clasen
e0bf301d34 gsk tests: Add an --output option
This will be used to save artifacts in ci.
2019-06-03 02:09:04 +00:00
Benjamin Otte
eb386134e3 testuite: Improve compare-render binary
- Remove remains of g_test_*() functions
  We're not a glib test, we're a simple binary.
- Handle nonexistence of reference image properly
  Don't assert, but create the output image and the error out.
2019-05-21 06:43:59 +02:00
Benjamin Otte
63578d832a testsuite: Don't die on the first error
Continue running the test, just mark it as a failure.
2019-05-12 17:27:01 +02:00
Timm Bäder
dde69802cd Add error func to node deserialization 2019-05-05 07:18:39 +02:00
Benjamin Otte
2a7e4ae7f6 testsuite: Don't pretend we're a GTest
This is a meson test, not a GTest thing. So:

- Use g_print(), not g_test_message
That makes meson test --verbose print the actual log messsages.

- Don't g_assert() all the time
Instead, run tests through to the end and just return a non-0 exit
status.
2019-04-23 17:09:14 +02:00
Timm Bäder
74ab3cdf75 compare-render: Assert that no error has been set
Much better error message than just the one from the node != NULL
assertion in the next line.
2019-02-25 08:37:06 +01:00
Alexander Larsson
9a7e721181 GdkSurface: Rename various functions and variables
This is an automatic rename of various things related
to the window->surface rename.

Public symbols changed by this is:
 GDK_MODE_WINDOW
 gdk_device_get_window_at_position
 gdk_device_get_window_at_position_double
 gdk_device_get_last_event_window
 gdk_display_get_monitor_at_window
 gdk_drag_context_get_source_window
 gdk_drag_context_get_dest_window
 gdk_drag_context_get_drag_window
 gdk_draw_context_get_window
 gdk_drawing_context_get_window
 gdk_gl_context_get_window
 gdk_synthesize_window_state
 gdk_surface_get_window_type
 gdk_x11_display_set_window_scale
 gsk_renderer_new_for_window
 gsk_renderer_get_window
 gtk_text_view_buffer_to_window_coords
 gtk_tree_view_convert_widget_to_bin_window_coords
 gtk_tree_view_convert_tree_to_bin_window_coords

The commands that generated this are:

git sed -f g "GDK window" "GDK surface"
git sed -f g window_impl surface_impl
(cd gdk; git sed -f g impl_window impl_surface)
git sed -f g WINDOW_IMPL SURFACE_IMPL
git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface

(cd gdk; git sed -f g window_type surface_type)
git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type

git sed -f g window_at_position surface_at_position
git sed -f g event_window event_surface
git sed -f g window_coord surface_coord
git sed -f g window_state surface_state
git sed -f g window_cursor surface_cursor
git sed -f g window_scale surface_scale
git sed -f g window_events surface_events
git sed -f g monitor_at_window monitor_at_surface
git sed -f g window_under_pointer surface_under_pointer
(cd gdk; git sed -f g for_window for_surface)
git sed -f g window_anchor surface_anchor
git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
git sed -f g native_window native_surface
git sed -f g source_window source_surface
git sed -f g dest_window dest_surface
git sed -f g drag_window drag_surface
git sed -f g input_window input_surface

git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 12:05:26 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Timm Bäder
8312ee0ebe testsuite: Add selected gl renderer test node files 2017-12-28 16:48:35 +01:00