Commit Graph

388 Commits

Author SHA1 Message Date
Benjamin Otte
53acff167b Revert "label: Never measure more than max-width-chars"
This reverts commit ba44e7a228.

The change was meant to revert to old GTK3 behavior but it actually
broke new GTK4 behavior that is in use where max-width-chars is used to
determine an ideal size, but where we don't want to limit the width to
that size.

So what happens is the reintroduction of GTK3-style lots of whitepsace
bugs, and we really don't want those.

We also don't want to break backwards compat if we can avoid it.

So let's revert this.

The reftest that was made for this purpose has been adapted.

Fixes #4399
2021-11-05 06:12:33 +01:00
Matthias Clasen
e017e4252b reftest: No blinking, please
Blinking cursors aren't helpful when we want to
compare renderings pixel-by-pixel. Turn them off.
2021-11-03 20:43:01 -04:00
Matthias Clasen
97365a8ffe reftest: Stop setting GDK_RENDERING
That environment variable isn't used anymore.
2021-11-03 20:40:22 -04:00
Benjamin Otte
ac8c4245b2 css: Don't throw warnings on broken URL in image css
If a URL can't be loaded, we might end up with a NULL file. Handle that
case properly by creating an invalid image instead and don't crash or
complain to stderr when files are NULL.

This was broken since 0886ade182

A new reftest has been included. We need a reftest instead of a
CSS parser test, because the error only becomes visible when
compute()ing the actual image.

Fixes #4373
2021-10-26 23:52:38 +02:00
Benjamin Otte
2113a18a18 testsuite: Add lots of reftests for picture sizing
Have square images in the following sizes:
  * 20
  * 100
  * 150
  * 200
  * 300
and place them in a can-shrink Picture allocated at the sizes:
  * 200x100
  * 100x200
and set align to center/center.

That's 10 combinations and they should all do the right thing.
2021-10-22 17:51:41 +02:00
Benjamin Otte
438bf8596e reftests: Don't crash if no node
If we have no node, don't crash when trying to save the node file.

Instead, write an empty file.
2021-10-22 17:51:40 +02:00
Benjamin Otte
192e554f3e testsuite: don't XFAIL label-sizing anymore
It's fixed now.
2021-10-19 01:10:59 +02:00
Benjamin Otte
00214cbb4a testsuite: Add test specifically for recent fix
label-sizing.ui tests this, too - but that test tests lots of other
things, and if this ever happens again, we want to debug it in a small
test.
2021-10-19 01:10:59 +02:00
Benjamin Otte
cad979b734 reftest: On failure, save the node files, too
Doesn't hurt to have them available, so it's easy to figure out if a
failure is due to the renderer or if we're generating wrong node files.
2021-10-19 01:01:36 +02:00
Benjamin Otte
30164d5b46 css: Render the background-clip area, not the background-origin
Testcase included

Fixes #4324
2021-10-07 19:59:44 +02:00
Matthias Clasen
c4069fdcee builder: Fix handling of <binding>
We were only applying <binding> elements when the
object is constructed, which can be triggered by
various things (e.g. a <style> element). Defer
this until we reach </object>, so we can be sure
that we pick up all the bindings.

Testcase included.

Fixes: #4147
2021-09-28 15:09:49 -04:00
Matthias Clasen
ec62402908 builder: Fix parsing of mixed declarations
The GtkBuilder parser constructs the object e.g.
when handling a <binding> element. There may be
more <property> elements after it, which we were
just not applying. Fix that by always applying
property when we see </object>. To do that, we
need to track the applied status per property.

Test included.

Fixes: #4208
2021-09-27 17:47:24 -04:00
Benjamin Otte
1ef000b1ab reftests: Add tests that check default-size is computed correctly
Related: #4136
2021-09-21 02:52:30 +00:00
Benjamin Otte
cf3830704b icontheme: Fix variable mixup leading to crashes
Note: Don't have 2 variables named "icon" and "gicon", you will screw
them up.

reftests included.

Fixes #4269
2021-09-17 17:41:13 +00:00
Benjamin Otte
83ea623775 reftests: Use the default (aka NGL) renderer
All tests pass with the renderer now, so we can remove useof the
fallback.
2021-09-16 23:59:37 +02:00
Benjamin Otte
345faa7250 reftests: XFAIL border-half-pixel test
the GL renderer can't deal with non-integers
2021-09-16 23:59:37 +02:00
Benjamin Otte
08df891070 reftests: Use colors without rounding errors
Color values must be divisible by 15 to be convertible into U8 and U16
values with the same result. 0x80 is not one of these values, so switch
it to 0x99.
2021-09-16 23:59:37 +02:00
Benjamin Otte
7cf5e5546b testsuite: Switch color from khaki to yellow
llvmpipe doesn't loike compositing semitransparent khaki onto solid
khaki without rounding errors.
2021-09-16 23:59:37 +02:00
Benjamin Otte
58f66ebd07 reftests: Make image-compare use textures
All image comparisons are done on textures now.
2021-09-16 23:59:37 +02:00
Benjamin Otte
47330598fb reftests: Use 0.6 instead of 0.5 for alpha
See previous commit about rounding
2021-09-16 23:59:37 +02:00
Benjamin Otte
90ed7b92b2 reftests: Use 0.6 alpha, not 0.5
0.5 leads to some GL renderers computing 0.5 * 0xFF as 0x7F and
others 0x80, while 0.6 * 0xFF (255 is divisible by 5) is always 0x99.
2021-09-16 23:59:37 +02:00
Benjamin Otte
0dfab46c15 reftests: Use GdkTexture instead of cairo_surface_t
This also switches the rendering code from using gsk_render_node_draw()
to gsk_renderer_render_texture().

Some tests are broken with the GL renderer, so this patch forces the
Cairo renderer until they get fixed.
2021-09-16 23:59:37 +02:00
Benjamin Otte
3a8ec683d3 reftests: Make diff pixels always opaque
We had pixels that did not differ in alpha and we then set 0 alpha
difference hich made the pixel invisible. Oops.
2021-09-16 23:59:37 +02:00
Benjamin Otte
de53b0c7a3 testsuite: remove box-order test
The test used to test that GtkBox ordered it's children left-to-right in
CSS, no matter the text direction or pack-type.

But there is neither a pack-type anymore nor does GTK4 do that.

So that test has been broken for yers, it just didn't render anything
wrong.
2021-09-16 23:59:37 +02:00
Simon McVittie
16b9a30655 reftest-compare: Treat colour channels as undefined if alpha is zero
If the alpha channel is zero, it doesn't matter what the values of the
red, green and blue channels are: the pixel is still fully transparent.
On most architectures, fully transparent pixels end up all-zeroes
(fully transparent black), matching what's in the reference PNG file;
but on mips*el the blend-difference and blend-normal tests get all-ones
(fully transparent white) and a test failure.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/4227
Signed-off-by: Simon McVittie <smcv@debian.org>
2021-09-02 22:34:48 +01:00
Matthias Clasen
733fb527fa Revert "reftests: Enforce default settings"
This reverts commit 4e4f57e091.

This should not be necessary, since we have GDK_DEBUG=default-settings.
2021-08-30 11:01:22 -04:00
Matthias Clasen
e5e7f5dd88 ci: Disable treeview-headers-hidden reftest
Somebody needs to figure out why it fails in ci so
frequently.
2021-08-05 12:41:04 -04:00
Matthias Clasen
4e4f57e091 reftests: Enforce default settings
Set all settings to their default values, so we
are less dependent on the environment to be set
up just right. In particular, this fixes animations
being disabled when we happen to run in a vm.
2021-07-19 13:26:32 -04:00
Matthias Clasen
3591da517a Disable another font-challenged reftest 2021-05-05 08:17:26 -04:00
Matthias Clasen
4f81dc1eaf Fix the icon-effect-missing reftest
This was comparing the included image-missing icon
with the one in the current icontheme on the test
system. Works fine as long as we don't change
the icons (which we just did). To avoid this, set
the icontheme to hicolor for this test, which does
not have the image-missing icon, so we end up getting
the builtin icon for both ui files.
2021-05-04 16:21:37 -04:00
Matthias Clasen
90d187894d testsuite: Reduce use of g_assert
Stop using g_assert() in the reftests.
2021-04-12 08:30:56 -04:00
Matthias Clasen
68d634b31c Disable the border-image-url reftest
It seems to make assumptions about text positioning that
are not holding with subpixel positioning. I'm not 100%
sure how that leads to exactly the artifacts that are seen
here, but I am just disabling the test until that is fully
understood.
2021-03-30 11:00:54 -04:00
Matthias Clasen
eba9cd8775 Disable the label-background reftest
It makes assumptions about text positioning that are
not holding with subpixel positioning. There is no
guarantee that the next word in a multi-word text
starts on an even pixel boundary, as it does when
you break the text into multiple, separately rendered
blocks.
2021-03-30 11:00:54 -04:00
Matthias Clasen
7aef77a21a reftests: Plug a few memory leaks
Noticed in passing.
2021-03-27 16:25:28 -04:00
Simon McVittie
6b29eeeb1c reftest-compare: Fix spelling of "diff"
This is the only non-whitespace difference between the copies in
testsuite/reftests/ and testsuite/gsk/.

Signed-off-by: Simon McVittie <smcv@debian.org>
2021-02-15 09:22:41 +00:00
Matthias Clasen
a14a0c6315 css: Fix shadow value equal
This function was not doing the right thing.

Once we are doing the right thing and not compare
shadows as unequal, some reftests that inhibit
snapshots for a few frames now hang forever, since
we are no more redrawing unnecessarily. Fix that
with an explicit queue_draw.
2021-02-03 22:10:13 -05:00
Matthias Clasen
ec8db379a6 tests: Disable the textview-margins reftest
It is too flaky to be useful.
2021-01-30 19:57:24 -05:00
Matthias Clasen
749f1a7c00 Add a reftest for transform-origin 2021-01-24 23:47:10 -05:00
Matthias Clasen
bbfaacb598 Add a reftest for box flipping
Test that a horizontal box changes the order of its
children in RTL, and that widget margins flip start
and end.

This tests the fix in d89ff71819.
2021-01-15 18:43:31 -05:00
Emmanuele Bassi
99e0929d6c build: Use a consistent style for Meson files 2020-12-15 12:46:59 +00:00
Matthias Clasen
a828d4318e Mark flaky tests as flaky
We can't mark these as xfail, since it sometimes succeed.
2020-12-08 18:10:02 -05:00
Matthias Clasen
2caf283323 Mark the window-show-contents-on-map.ui reftest as xfail
We know now what the test is trying to test, just lack
the right plumbing to do it properly. So, keep the test
around, marked as expected fail.
2020-12-08 12:04:47 -05:00
Matthias Clasen
6fb66e299a Revert "reftests: Remove window-show-contents-on-map.ui test"
This reverts commit 074b933ae4.
2020-12-08 11:45:52 -05:00
Jonas Ådahl
074b933ae4 reftests: Remove window-show-contents-on-map.ui test
It tested that a widget shown after the window was mapped deals with
window resizing appropriately when doing the follow-up allocation. Now,
doing this only allocates both at the same time, as allocation happens
during the frame dispatch.

To do the equivalent now, one would have to write code that shows the
label after the first frame was drawn, and that's not possible via a
reftest, so lets remove it.
2020-12-08 14:22:59 +01:00
Jonas Ådahl
7b7f3342d8 reftests/textview-tags: Hide text view cursor
Otherwise it'd sometimes show up, causing test flakyness.
2020-12-08 12:03:18 +01:00
Matthias Clasen
74a7f73239 Merge branch 'matthiasc/builder-requires' into 'master'
Matthiasc/builder requires

See merge request GNOME/gtk!2806
2020-11-11 03:53:52 +00:00
Matthias Clasen
18779b9d67 testsuite: Remove <requires> from ui files
We don't need these here, the testsuite is shipped
with GTK.
2020-11-10 19:17:45 -05:00
Emmanuele Bassi
0af6630521 a11y: Consolidate accessibility environment variables
Use a single environment variable for everything:

 - select the ATContext implementation
 - select the test ATContext
 - disable ATContext entirely

We use the same pattern as GSK_RENDERER, GTK_DEBUG, etc.

The documentation needs to be updated to include the environment
variable.
2020-11-09 16:21:49 +00:00
Arnaud Bonatti
f7de0bc9c8 Fix tests with regard to GtkBuilder <requires>. 2020-11-07 16:17:36 +01:00
Emmanuele Bassi
88113956a3 tests: Use the test ATContext for every test
Otherwise we're going to need a full desktop session in order to run the
test suite.
2020-10-12 16:19:32 +01:00