Commit Graph

2124 Commits

Author SHA1 Message Date
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