Commit Graph

2197 Commits

Author SHA1 Message Date
Benjamin Otte
bf8b26aa27 sortlistmodel: Add ::item-type and ::n-items
With tests!
2022-06-11 08:25:15 +02:00
Benjamin Otte
fd4562aac9 treelistmodel: Add ::item-type and ::n-items
With tests!
2022-06-11 08:25:14 +02:00
Benjamin Otte
bf5edc6b7c reftests: Add test for the overflow methods
Reference is using labels again
2022-06-11 02:15:08 +02:00
Benjamin Otte
9973a7173f reftests: Add test for inscription markup parsing
Compare with label markup parsing as the reference.
2022-06-11 02:15:08 +02:00
Matthias Clasen
73dc741a82 Avoid g_log_set_writer_func in tests
It is not usable anymore since GLib 2.72.
2022-05-28 10:43:26 -04:00
Benjamin Otte
0410125f20 nodeparser: Fix parsing of color-matrix node
Negative offsets in the color matrix were inverted because it used the
rect parser.
2022-05-18 21:16:33 +02:00
Benjamin Otte
ffd3801b1d testsuite: Add tests for label overdraw
This brings back a subset of what quit-mnemonic.ui tested for, but
trying a lot harder to trigger the label overdrawing its allocation,
which will cause the text to be cut off when clipping is happening.

It should not be an issue at all with GTK4, but keeping that test around
is a good idea.
2022-05-17 00:14:19 +02:00
Matthias Clasen
1b355ff2e0 Drop the quit-mnemonic reftest
I can't quite figure out what this test was meant
to test, and how to make it do so in a way that
does not fall afoul of rendering issues in the GL
renderer and rounding differences in pango.

Can't win with reftests.
2022-05-14 17:03:37 -04:00
Matthias Clasen
6164908bd3 Add tests for gdk_memory_texture_new_subtexture
This checks the fixes in the previous commit.
2022-05-13 11:44:11 -04:00
Sophie Herold
f5fc71fe82 tests: Check for nicks and blurbs not being set 2022-05-11 18:16:44 +02:00
Matthias Clasen
0ce49daa5f testsuite: test new treestore builder functionality
Verify that we can nest rows.
2022-05-06 09:29:44 -04:00
Matthias Clasen
10b5698b78 testsuite: Copy liststore builer tests for trees
This adds tests for data, but not nesting yet.
2022-05-06 09:29:44 -04:00
Matthias Clasen
c645da00dc Merge branch 'wrap-mode-invalid-cast' into 'main'
Don't cast GtkWrapMode to the incompatible enum PangoWrapMode

Closes #4869

See merge request GNOME/gtk!4671
2022-05-03 17:46:51 +00:00
Federico Mena Quintero
4ddf1b70a2 Make the wrap_mode test unix-only
The relevant accessibility code is not built on Windows.
2022-04-28 09:46:48 -05:00
Federico Mena Quintero
898a2e9fcf textbuffer: Test the serialization of the wrap-mode attribute 2022-04-26 20:22:59 -05:00
Federico Mena Quintero
ae06e40bcc Put the text buffer tests in the internal_tests suite
We'll start testing the internal gtk_text_buffer_get_run_attributes()
soon.
2022-04-26 14:01:08 -05:00
Chun-wei Fan
65a7df47f2 Introspection test: Reverse os.add_dll_directory() order
It looks like os.add_dll_directory() works in a LIFO order, so we call
os.add_dll_directory() from the end of the list of directories in %PATH%
so that the directories are searched in the correct order.
2022-04-26 11:52:31 +08:00
Chun-wei Fan
3471c22f52 testsuite: Fix introspection test on Windows
...when we are using Python 3.8.x or later.  Python 3.8.x or later on Windows
require one to call os.add_dll_directory() on every directory that contains
dependent non-system DLLs of a module that are not bundled/installed with the
module.

Since we are very likely running programs that rely on dependent items in
%PATH%, make things easier for people by calling os.add_dll_directory() on
all the valid paths in %PATH% in api.py, so that the test will run
successfully on Windows with Python 3.8.x or later.
2022-04-26 11:51:26 +08:00
Matthias Clasen
c882a611c8 Fix file filter buildable support
File filters creates from ui files had some
extraneous gunk in them. Fix that. Test included.

Fixes: #4787
2022-04-18 23:03:15 -04:00
Sebastian Keller
1c733857b3 testsuite: Add unaligned-offscreen test
Tests whether text rendered to an offscreen node unaligned with the
pixel grid introduces blurriness.
2022-04-04 23:48:58 +02:00
James Westman
8eb9844a45
filefilter: Fix <suffixes> in buildable
A bug in GtkFileFilter's GtkBuildable implementation caused the
<suffixes> tag not to be recognized.
2022-03-17 10:52:20 -05:00
Sebastien Bacher
c44288c739 Use the correct name for installed gdk tests 2022-03-07 16:13:38 +01:00
Benjamin Otte
b28c3ef3d9 renderers: Handle large viewports
When large viewports are passed to gsk_renderer_render_texture(), don't
fail (or even return NULL).

Instead, draw multiple tiles and assemble them into a memory texture.

Tests added to the testsuite for this.
2022-02-26 20:35:44 +01:00
Matthias Clasen
c5f92340ee Fix up tests for version bump 2022-02-23 14:29:48 -05:00
Benjamin Otte
481634930c glcontext: Remove leftover function call
That call should have been removed way back when.

Add a testcase to make sure this keeps working.

Fixes #4697
2022-02-16 03:48:15 +01:00
Emmanuele Bassi
23aec81f1a reftest: Avoid assertions being compiled out
Calling functions inside a g_assert() means those functions will be
compiled out when building with G_DISABLE_ASSERT.

This fixes the release job in the CI pipeline.
2022-01-18 14:07:37 +00:00
Emmanuele Bassi
20ad839075 tests: Don't drop chdir()'s return value on the floor
Avoid a compile time warning, and ensure that the test suite is actually
doing its job.
2022-01-08 15:17:25 +00:00
Benjamin Otte
8e8a746cce Merge branch 'wip/otte/for-main' into 'main'
testsuite: clear_current() when done

See merge request GNOME/gtk!4343
2022-01-06 19:07:58 +00:00
Benjamin Otte
7872b41f16 testsuite: clear_current() when done
That way we ensure that the GL context(s) get disposed, which they
previously weren't due to them still being the current context.

This also implicitly adds testing of gLContext destruction, which
previously wasn't ever done by any test.
2022-01-06 19:22:47 +01:00
Matthias Clasen
70cb61fb71 4.6.0 2021-12-30 10:31:52 -05:00
Matthias Clasen
dd0effe957 Merge branch 'wip/chergert/4575-fix-texthistory-selection' into 'main'
testsuite: ignore texthistory selection on delete/backspace

Closes #4575

See merge request GNOME/gtk!4287
2021-12-29 14:58:53 +00:00
Benjamin Otte
df8588e9b7 Merge branch 'wip/otte/for-main' into 'main'
widget: Don't queue an allocate on a nonexisting parent

See merge request GNOME/gtk!4288
2021-12-26 23:20:34 +00:00
Benjamin Otte
fce9b35e4d css: Don't crash on invalid rotate3d() 2021-12-26 22:58:09 +01:00
Christian Hergert
99d8dd751e testsuite: add failing test for delete selection
This adds a test to expose the failure of #4575 which results in the
selection being incorrect when performing a delete as we are likely
already in a begin_user_action()/end_user_action() pair.

Related #4575
2021-12-26 12:46:16 -08:00
Christian Hergert
22b1abb36d testsuite: ignore texthistory selection on delete/backspace
We don't need to apply these here, as it will clear the selection which is
needed for the undo. Otherwise we won't be able to test that we end up at
the right selection afterwards.
2021-12-26 12:43:22 -08:00
Emmanuele Bassi
a70988ecd5 build: Remove deprecated get_pkgconfig_variable()
Replace it with `get_variable(pkgconfig:...)`.
2021-12-24 15:55:26 +00:00
Maxim Cournoyer
29e6cc5808
testsuite: introspection: Do not override environment variables.
Functional package managers such as GNU Guix rely on environment
variables such as GI_TYPELIB_PATH to discover the system libraries and
resources; extend rather than override them.

* testsuite/introspection/meson.build (env): New variable that extends
rather than override the GI_TYPELIB_PATH and LD_PRELOAD environment
variables.
(api): Use the above as the value of the 'env' keyword argument.
2021-12-20 11:22:41 -05:00
Matthias Clasen
69edf17c2a Merge branch 'wip/otte/wrapping-is-natural' into 'main'
label: Add gtk_label_set_natural_wrap_mode()

See merge request GNOME/gtk!4267
2021-12-20 15:49:05 +00:00
Benjamin Otte
981ed22dff label: Add gtk_label_set_natural_wrap_mode()
Allows influencing natural size requests so that labels can request more
width than necessary for a given height.

Related: !4245
Related: #4535
2021-12-20 02:28:37 +01:00
Emmanuele Bassi
c94996e8e8 build: Check for the gi python module
The introspection tests depend on the pygobject module, but we currently
are not checking if it's available at configuration time, which means we
can get build failures like:

> ModuleNotFoundError: No module named 'gi'

when running the test suite.
2021-12-19 16:06:49 +00:00
Matthias Clasen
47ac080565 Merge branch 'wip/otte/for-main' into 'main'
label: word-char wrapping should word-wrap for natural size

Closes #4535

See merge request GNOME/gtk!4245
2021-12-17 02:11:50 +00:00
Timm Bäder
e411081c84 settings test: Print expected and seen values
That test breaks locally (and in CI it seems?), so at least print the
values we see.
2021-12-16 11:06:50 +01:00
Benjamin Otte
5face79cd0 label: word-char wrapping should word-wrap for natural size
Testcase added

Fixes #4535
2021-12-13 14:49:39 +01:00
Timm Bäder
fd6b3ef5a0 gl: Linear gradients don't support 3d transforms
Add another helper similar to the one for transforms, but that only
works on 2d transforms.

Fixes #4501
2021-12-12 12:57:44 +01:00
Benjamin Otte
4de5d225db reftests: Add center-center reftests without GtkOverlay 2021-12-08 22:16:52 +03:00
Benjamin Otte
7741df9963 reftests: Rename a bunch of tests
They use a GtkOverlay, so reflect that in the name.
2021-12-08 22:16:52 +03:00
Ivan Molodetskikh
7ef54e9c53 picture: Return natural size 0 for size 0
It was returning the full natural size (same as -1) due to default value
handling in the code below.

Tests have been updated to match this output.
2021-12-08 19:20:24 +01:00
Matthias Clasen
2f7fa10434 Merge branch 'textview-im-surrounding' into 'main'
textview: Provide more context to input methods

See merge request GNOME/gtk!4209
2021-12-03 20:26:54 +00:00
Matthias Clasen
d5c01098fd textview: Provide more context to input methods
When returning surrounding context to input methods,
include at least 2 words before and after the insertion
point.

Update the affected input method tests.
2021-12-03 14:44:05 -05:00
Georg Vienna
c517e945de textchildanchor: allow to specify replacement character 2021-12-03 16:02:48 +00:00
Benjamin Otte
07cfdd8ca0 label: Don't set ellipsized size as natural size
Natural size should never ellipsize.

Tests added.
2021-11-30 15:10:02 +01:00
Benjamin Otte
354fa6544a texture: Remove gdk_texture_download_float()
The download API is not well thought out yet, so postpone it until
there's an actual usecase for it.

Remove testcases, too.
2021-11-30 14:12:10 +01:00
Benjamin Otte
ce8faa2e90 testsuite: Make function arguments const 2021-11-30 14:12:10 +01:00
Benjamin Otte
27965d5fdc builder-tool: Don't simplify enums too much
Store the enum nick, not the enum value. That way the file remains
human-readable.

Updated reftests to new expected output.
2021-11-21 02:19:57 +01:00
Benjamin Otte
c025bc5098 paned: Compute the right handle size
Testcase included

Fixes #4469
2021-11-21 01:49:40 +01:00
Benjamin Otte
170bc0a8de window: properly compute desired size
Previously, the code did not expand the size properly when a default
size was already set.

Reftest included.
2021-11-21 01:31:06 +01:00
Benjamin Otte
a0ca936e8d sizerequestcache: Increase size
This is a quickfix to avoid infinite runtime in nested boxes with
wrapped labels.

Test included
2021-11-20 06:04:10 +01:00
Benjamin Otte
50e0893497 widget: force adjustment method is one size is FILL
If halign=fill, force adjustment to height-for-width.
If valign=fill, force adjustment to width-for-height.
Otherwise look at request mode.

This way we don't try to adapt the filled dimension and only adjust
the one that is not set to fill.
2021-11-20 06:04:10 +01:00
Benjamin Otte
7459d430eb widget: Don't forget margins when adjusting
This could lead to the wrong values being passed and computing invalid
sizes which would then lead to very unhappy code.

Test included.
2021-11-19 23:46:59 +01:00
Matthias Clasen
c86789427d Don't spam debug messages into TAP output
g_log_writer_standard_streams just puts all the logs
out onto stderr and stdout if we don't stop it. Pango
recently grew a bunch of g_debug calls, and those were
now showing up, making all the reftests fail.
2021-11-16 18:45:34 -05:00
Benjamin Otte
300a88922e build: Disable gcc warnings as warnings, too
We use -Werror in the build, so even if some warnings are just warnings,
they'd be errors.
2021-11-15 15:35:10 +01:00
Benjamin Otte
46f8600b6a css: Don't crash when color stop offsets descend
Testcase included.

Fixes #4424
2021-11-10 17:28:14 +01:00
Benjamin Otte
1e47b1c610 label: Handle width-chars > text width
This was broken in wrapping labels.

Testcase included.
2021-11-09 18:34:35 +01:00
Benjamin Otte
76c4673944 boxlayout: Fix broken min-size-for-opposite-size
Assume a vbox with 2 wrapping labels saying
  Hello World
  Hi Ho
being measured for their minimum width for 3 rows of text.
This should be layouted like
  Hello
  World
  Hi Ho
and measured accordingly.

However, previously this was layouted as
  Hello World
  Hi Ho
with 1.5 lines being assigned to both labels.
That will obviously not compute the above wrapping which clearly
results in a smaller min width.

A reftest testing exactly this was included.
2021-11-09 03:41:43 +01:00
Benjamin Otte
81169d18c3 label: max-width-chars should be ignored sometimes
When a widget is neither wrappable nor ellipsizable, we cannot modify
the label to fit into any size. So we cannot respect max-width-chars.
2021-11-09 03:41:43 +01:00
Benjamin Otte
cce6a603a6 label: max-width-chars has no effect on smaller text
Having a short text and a large max-width-chars should request the
natural width of the text, not the limit from max-width-chars.

This caused huge message dialogs.

Reftests added.
2021-11-09 03:41:43 +01:00
Benjamin Otte
577d520006 reftests: Add reftest for last 2 issues
Use a label that is long enough to require wrapping and force it into a
hardcoded width. Use a sentence where all the words have the same size
to not get unwanted wrapping behavior.

Also append a 2nd row to check that the first row gets the proper height
allocated.

Found by Marco Melorio.
2021-11-06 04:30:50 +01:00
Benjamin Otte
5c9ae28937 boxlayout: Compute opposite size properly
For size -1 in the opposite orientation, GtkBoxLayout used to measure
the children based on their min size in the box's orientation instead of
-1. That wasn't really intended, but was a side effect of how the sizing
code did (not) distribute extra size above the minimum size.

This is clearly not what we want.
What we want is measuring the orientation as is for size -1. Then we
want to just take the maximum of all children and use that.

A reftest is incldued that ensures a vbox wraps a label just like an
hbox does.
2021-11-05 20:30:49 +01:00
Benjamin Otte
8e27fc7f9b label: Redo measure() code
The old code couldn't properly do height-for-width because it only
computed the widest and smallest layout instead of looking at the actual
passed in for-size.

The label-sizing reftest has been adapted as the label code is now smart
enough to always display the whole text and no longer requests a too
small width-for-single-row when wrapping.
2021-11-05 20:29:42 +01:00
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
Matthias Clasen
df12a41cbb testsuite: Set GDK_DEBUG unconditionally
The default-settings key works in non-debug builds
too, nowadays.
2021-11-03 20:39:33 -04:00
Benjamin Otte
c97a758aa7 cssparser: Remove unused argument
The base_directory argument is never used. So don't have it.
2021-10-28 03:19:08 +02: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
2b2fd23815 Merge branch 'wip/otte/center-center-center' into 'master'
Add a bunch of reftests and fix their failures

Closes #4285

See merge request GNOME/gtk!4085
2021-10-22 16:35:41 +00: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
0898023e6b testsuite: Create GL renderers without surfaces 2021-10-20 21:49:32 +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
a859471960 testsuite: Add workarounds for non-gl backends
read: Fix tests for broadway
2021-10-18 14:17:11 +02:00
Benjamin Otte
1e7fb52b21 Add memory formats used by libpng
Add unpremultiplied high-depth formats. They are used in the real world,
so let's support them.
2021-10-13 14:33:44 +02:00
Matthias Clasen
49a64da7ec Merge branch 'ngl-is-the-new-gl' into 'master'
Rename ngl to gl

Closes #4318

See merge request GNOME/gtk!4037
2021-10-11 06:43:41 +00:00
Benjamin Otte
e581c148d9 testsuite: Add run for GLES
This is supposed to test the most fallback GL stuff, so we might want to
set even more env vars here.

Also enable the run for the Fedora builder in CI.
2021-10-09 06:27:21 +02:00
Benjamin Otte
b4ab9f7b8c testsuite: Add a test targeting GL upload code
Previously, all the tests used the icon upload path using
glTexSubImage2D().

This test uses the custom texture path using glTexImage2D().
2021-10-09 04:44:30 +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
144f727d5a Rename ngl to gl
We have only one gl renderer now, and it is
a bit odd for it not be called gl.
2021-10-07 13:05:53 -04:00
Benjamin Otte
2e555db9a4 testsuite: Fail more accurately
Don't run the full test and then return "something failed" - instead
just explode when you find the failure.
2021-10-06 22:50:07 +02:00
Matthias Clasen
f42c61f9d1 Merge branch 'wip/otte/for-master' into 'master'
testsuite: Actually run all memorytexture tests

See merge request GNOME/gtk!4016
2021-10-01 00:26:59 +00:00
Matthias Clasen
6f002678be gtk-builder-tool: Simplify more
Simplify enum properties as well.

Update affected tests.
2021-09-29 10:58:21 -04:00
Matthias Clasen
5bc3923bae builder-tool: Avoid <style> when converting
We can just set the css-classes property instead.

Update affected tests.
2021-09-28 17:48:50 -04: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
9395b28542 testsuite: Actually run all memorytexture tests
Whoops
2021-09-26 09:41:55 +02:00
Christian Hergert
b578c78eff texthistory: add barriers after final grouping
We don't want to allow new items to be grouped into a previous action
group after the end_user_action() is called. This ensures that we add a
barrier action in those conditions.

Fixes #4276
2021-09-23 13:25:35 -07:00
Martin Kühl
a9d7282f00 gtkcomposetable: Accept long replacement strings
This change removes the assertions limiting replacement strings in the compose table to be less than 20 characters.
The limit seems arbitrary, is not required, will break some users' setups, and problems with it result in applications not launching.

Fixes #4273
2021-09-21 17:03:20 +02:00
Benjamin Otte
1ef000b1ab reftests: Add tests that check default-size is computed correctly
Related: #4136
2021-09-21 02:52:30 +00:00
Matthias Clasen
41b810da7f Add gsk_transform_to_2d_components
This function decomposes a general 2D transform
into skew, scale, rotation and translation.

Tests included.
2021-09-18 02:06:51 -04:00