Commit Graph

1928 Commits

Author SHA1 Message Date
Matthias Clasen
2040b7ecdf a11y: Set an accessible role for GtkLabel
Use the label accessible role for GtkLabel. ARIA has some
ominous wording about it going way, but while we have it,
GtkLabel is the obvious candidate for carrying it.

Update the documentation and add a test.
2020-07-28 18:16:37 -04:00
Matthias Clasen
cc35cc6c4e a11y: Add tests for mnemonics
We set up labelled-by accessible relations when
a label is set as mnemonic widget. Verify that that
happens as expected.
2020-07-28 18:16:37 -04:00
Matthias Clasen
9a82aadca7 a11y: Set an accessible role for GtkEntry
Use the text-box accessible role for GtkEntry and
set the placeholder and read-only accessible properties.

Update the documentation and add tests.
2020-07-28 18:16:37 -04:00
Matthias Clasen
23e185e674 a11y: Add a scrollbar relation test
Check that GtkScrolledWindow sets up the expected
relations between its scrollbars and child.
2020-07-28 18:16:37 -04:00
Matthias Clasen
efd4169fa2 a11y: Set accessible roles for GtkImage and GtkPicture
Use the img accessible role for these.
Also update the documentation and add tests.
2020-07-28 18:16:37 -04:00
Christian Hergert
459af3acab build: bump to sysprof 4 ABI
Sysprof has moved to a new ABI which removes GLib from the capture library
so that GLib itself can link against sysprof-capture.

This bumps the library ABI so we can keep things coordinated between all
the new tracing layers in the stack.
2020-07-28 11:22:33 -07:00
Emmanuele Bassi
3294557717 a11y: Update the valuetext attribute of GtkProgressBar
Since progress bars can have a label, we should propagate that information
to ATs whenever it's set.
2020-07-28 16:59:08 +01:00
Emmanuele Bassi
7f04faf30d a11y: Use undefined as default for string attributes
Instead of an empty string.
2020-07-28 16:49:13 +01:00
Matthias Clasen
6e494b93ce a11y: Add spinbutton tests
Tests the fix in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
9190e95df9 a11y: Add scrollbar tests
Tests the fix in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
d2c5e3f2b3 a11y: Add switch tests
Tests the fix in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
2cbaa568b5 a11y: Add separator tests
Tests the fix in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
606daab475 a11y: Add progressbar tests
Test the changes in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
d3a8597a93 a11y: Add dialog and window tests
Tests the modal property changes in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
6ca245306b a11y: Add checkbutton tests
Tests the fix in the previous commit.
2020-07-27 21:18:09 -04:00
Emmanuele Bassi
cd7bb0200a a11y: Test unset relations
We use "NULL" in C to mean "undefined", when it comes to relations that
deal with references or reference lists.
2020-07-27 14:26:19 +01:00
Matthias Clasen
bc0182fa3e Merge branch 'ebassi/new-a11y' into 'master'
Accessibility rework

See merge request GNOME/gtk!2239
2020-07-27 11:55:19 +00:00
Emmanuele Bassi
4060febd7f a11y: Make GtkATContext.create() public
Implementations of the GtkAccessible interface should have a way to
instantiate the appropriate GtkATContext.
2020-07-27 11:48:11 +01:00
Matthias Clasen
40b65b2608 a11y: Add some more tests
Test that setting multiple states or properties
at the same time works as expected.
2020-07-27 01:21:05 -04:00
Matthias Clasen
6c4c93b8d0 Add some more a11y tests
Add some tests that exercise the accessible machinery
without any connection to widgets.
2020-07-27 01:13:16 -04:00
Matthias Clasen
e57d6ec359 Merge branch 'list-constructors' into 'master'
List constructors

See merge request GNOME/gtk!2296
2020-07-26 23:56:21 +00:00
Matthias Clasen
72bb7fc701 selectionfiltermodel: Make constructor allow-none
We don't pay attention to item-type anymore, so
drop the item-type property and the _for_item_type()
constructor, and allow passing NULL to the regular
constructor.

We don't make this constructor transfer-full, since
the selection filter model is not a wrapping model
like the others. It is more like fork than a wrap.
2020-07-26 18:04:40 -04:00
Matthias Clasen
cdc263f796 multiselection: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Also make the constructor return GtkMultiSelection *.

Update all callers.
2020-07-26 18:04:40 -04:00
Matthias Clasen
ccb9dcc86b singleselection: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 18:04:40 -04:00
Matthias Clasen
dd1c0c0b22 treelistmodel: Make constructor transfer full
Make gtk_tree_list_model_new() take the root model
as first argument, and make it transfer full, for
consistency with other wrapping list constructors.

Update all callers.

Still missing here: Make the model property writable,
and allow passing NULL in the constructor.
2020-07-26 18:04:40 -04:00
Matthias Clasen
a46cfd3ff4 sortlistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 18:04:40 -04:00
Matthias Clasen
706d464ae6 filterlistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 18:04:40 -04:00
Matthias Clasen
b6d9f3facb slicelistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 18:04:40 -04:00
Matthias Clasen
32b8fe40bb maplistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 18:02:51 -04:00
Matthias Clasen
1e8be87026 flattenlistmodel: Make the constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 18:02:44 -04:00
Emmanuele Bassi
ac0fcc55a6 a11y: Add a simple test case for GtkButton's accessible state 2020-07-26 21:27:03 +01:00
Emmanuele Bassi
82664003c0 a11y: Allow setting the role post-construction
Some widgets have different roles after they are constructed, so we need
to allow changing the role defined by the class. We should still avoid
setting a role after the GtkATContext has been created.
2020-07-26 21:27:03 +01:00
Emmanuele Bassi
83eac3f33a a11y: Restart the accessibility test suite 2020-07-26 20:49:08 +01:00
Emmanuele Bassi
c63087a563 Remove ATK
To build a better world sometimes means having to tear the old one down.
        -- Alexander Pierce, "Captain America: The Winter Soldier"

ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:

 - it maps to a very specific implementation, AT-SPI, which is Linux and
   Unix specific
 - it requires implementing the same functionality in three different
   layers of the stack: AT-SPI, ATK, and GTK
 - only GTK uses it; every other Linux and Unix toolkit and application
   talks to AT-SPI directly, including assistive technologies

Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:

 - add an "accessible" interface, implemented by GTK objects directly,
   which describe the accessible role and state changes for every UI
   element
 - add an "assistive technology context" to proxy a native accessibility
   API, and assign it to every widget
 - implement the AT context depending on the platform

For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
2020-07-26 20:31:14 +01:00
Benjamin Otte
2f27d29247 Add GtkBoolFilter
Takes a boolean GtkExpression (like a boolean object property) to run a
filter with.
2020-07-26 20:43:08 +02:00
Matthias Clasen
706aa93ab5 hsla: Just store floats
We are using floats for rgb, and we don't need more precision
for hsl colors either. We use hsl for computing color expressions
like shade(), lighter() and darker(), which are not precisely
specified anyway.

This commit updates the one test where the output changes a
tiny bit due to this.
2020-07-25 11:56:05 -04:00
Matthias Clasen
f2bdb1fb87 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2283
2020-07-25 00:05:28 +00:00
Matthias Clasen
bacaa5eb9a Add another sortlistmodel test
This tests the crash fix in f7b73b2e01.
2020-07-24 19:28:54 -04:00
Matthias Clasen
9a297516ba testsuite: Add an incremental sort test
Add a test that makes changes to a model while it
is incrementally sorted.
2020-07-24 19:23:18 -04:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
556997f9df Replace "gfloat" with "float" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Matthias Clasen
2a43ce1705 testsuite: Use better names for sortlistmodel tests
Name the tests for what they do.
2020-07-24 15:37:49 -04:00
Matthias Clasen
3324a6e6b3 testsuite: Reenable tests for incremental sort
This was unintentionally disabled.
2020-07-24 15:22:14 -04:00
Matthias Clasen
63a4345d2c Merge branch 'wip/otte/sortlistmodel2' into 'master'
Massively refactor and improve sortlistmodel

See merge request GNOME/gtk!2273
2020-07-22 13:15:45 +00:00
Benjamin Otte
8c608e9c1c sortlistmodel: Split the SortItem into 2 arrays
Instead of one item keeping the item + its position and sorting that
list, keep the items in 1 array and put the positions into a 2nd array.

This is generally slower while sorting, but allows multiple improvements:

1. We can replace items with keys
   This allows avoiding multiple slow lookups when using complex
   comparisons

2. We can keep multiple position arrays
   This allows doing a sorting in the background without actually
   emitting items-changed() until the array is completely sorted.

3. The main list tracks the items in the original model
   So only a single memmove() is necessary there, while the old version
   had to upgrade the position in every item.
Benchmarks:

        sorting a model of simple strings
                          old      new
        256,000 items   256ms    268ms
        512,000 items   569ms    638ms

        sorting a model of file trees, directories first, by size
                          old      new
         64,000 items   350ms    364ms
        128,000 items   667ms    691ms

        removing half the model
                          old      new
        512,000 items    24ms     15ms
      1,024,000 items    49ms     25ms
2020-07-22 14:30:49 +02:00
Benjamin Otte
93599c2c48 testsuite: Add exhaustive sortlistmodel test
This is basically a copy/paste from the filterlistmodel test, but
adapted for sorting.
2020-07-22 14:04:40 +02:00
Benjamin Otte
26696a741e timsort: Add change tracking to gtk_tim_sort_step() 2020-07-22 14:04:40 +02:00
Benjamin Otte
97c5cb3514 Add a timsort() implementation 2020-07-22 14:04:40 +02:00
Christian Hergert
7884ab6161 build: fix linking support on macOS with Clang
This was preventing any sort of building on macOS, even though the quartz
backend is currently non-functional. Fixing this is a pre-requisite to
getting a new macOS backend compiling.
2020-07-21 14:45:12 -07:00
Benjamin Otte
b67ffe9650 sortlistmodel: Test that the model is stable
Stability is measured relative to the child model, not relative to the
previous sorter.
2020-07-20 22:28:01 +02:00
Benjamin Otte
2c519b006d testsuite: Fix a leak 2020-07-20 22:28:01 +02:00
Timm Bäder
d6b3ac850d testsuite: Fix test case indentation 2020-07-17 05:49:11 +02:00
Benjamin Otte
495069c868 Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2251
2020-07-16 19:43:45 +00:00
Benjamin Otte
e518c1f2f3 stringfilter: Make the constructor take an expression
An expression is critically important for a string filter and people
should be made aware of it when constructing the filter.
2020-07-16 20:43:16 +02:00
Benjamin Otte
22eccbdbb6 testsuite: Don't be too exhaustive
The test was taking over 60s on CI, that's a but much.
2020-07-16 20:43:16 +02:00
Benjamin Otte
58e85c85e4 testsuite: Add a case with escaped Latin-1 code
This came up in recent g_uri_escape() discussions.
2020-07-16 20:43:11 +02:00
Matthias Clasen
6b89148487 Merge branch 'wip/otte/vector' into 'master'
Arrays

See merge request GNOME/gtk!2197
2020-07-16 18:05:43 +00:00
Matthias Clasen
87b5eadb7c treesorter tests: Add a comment
This looks like a leak, but isn't one.
Add a comment to that effect.
2020-07-16 12:14:28 -04:00
Benjamin Otte
a4cd974912 array: Add null-termination 2020-07-16 18:09:57 +02:00
Benjamin Otte
8bf8ac5076 Add GdkArray
This is a scary idea where you #define a bunch of preprocessor values
and then #include "gdkarrayimpl.c" and end up with a dynamic array for
that data type.

See https://en.wikipedia.org/wiki/X_Macro for what's going on.

What are the advantages over using GArray or GPtrArray?

 * It's typesafe
   Because it works like C++ templates, we can use the actual type of
   the object instead of having to use gpointer.

 * It's one less indirection
   instead of 2 indirections via self->array->data, this array is
   embedded, so self->array is the actual data, and just one indirection
   away. This is pretty irrelevant in general, but can be very noticable
   in tight loops.

 * It's all inline
   Because the whole API is defined as static inline functions, the
   compiler has full access to everything and can (and does) optimize
   out unnecessary calls, thereby speeding up some operations quite
   significantly, when full optimizations are enabled.

 * It has more features
   In particular preallocation allows for avoiding malloc() calls, which
   can again speed up tight loops a lot.
   But there's also splice(), which is very useful when used with
   listmodels.
2020-07-16 18:09:57 +02:00
Matthias Clasen
ee96bc7185 multiselection tests: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
f94f325636 filterlistmodel tests: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
6c1217dd93 filter tests: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Emmanuele Bassi
0578422612 build: Restructure the tests to use dictionaries
Instead of an array of arrays, let's use an array of dictionaries; it's
easier to add optional keys without requiring to remember where to put
empty arrays.
2020-07-10 16:32:15 +01:00
Emmanuele Bassi
ad04da84c9 Add the filtermodel-exhaustive test to the slow suite
This increases the default timeout.
2020-07-10 16:16:15 +01:00
Emmanuele Bassi
333b013f7f Increase the default timeout for slow tests
If a test is part of the 'slow' test suite, we should increment the
default timeout to compensate.
2020-07-10 16:13:37 +01:00
Benjamin Otte
4cd92f979c Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2221
2020-07-09 21:34:02 +00:00
Benjamin Otte
4d90846182 testsuite: Be more exhaustive
Create larger source models in tests, so that we hit the incremental
batch size more often and have a higher chance to expose bugs there.
2020-07-09 22:29:36 +02:00
Benjamin Otte
986f721938 filterlistmodel: Don't filter out every 513th element
Incremental filtering would skip every 513th element due to an
off-by-one error.

Test included
2020-07-09 22:29:36 +02:00
Matthias Clasen
8c4df51a14 tests: Plug some more memory leaks
These showed up under asan.
2020-07-09 00:33:14 -04:00
Matthias Clasen
0dc946da63 testsuite: Assorted leak fixes
All found by asan.
2020-07-08 17:44:49 -04:00
Matthias Clasen
e6d8eedc00 testsuite: Fix a memory leak in the bitmask tests
This was showing up when running under asan.
2020-07-08 17:44:16 -04:00
Matthias Clasen
779c71b66d testsuite: Fix some memory leaks reported by asan 2020-07-08 15:09:13 -04:00
Matthias Clasen
8e73d007f5 testsuite: Fix an asan error
asan complains that some of the memorytexture tests
read past limits. Avoid that.
2020-07-08 15:09:08 -04:00
Matthias Clasen
729ba44297 Merge branch 'wip/otte/filterlistmodel' into 'master'
Improve GtkFilterListModel

See merge request GNOME/gtk!2199
2020-07-06 15:42:44 +00:00
Benjamin Otte
bf3382a89e testsuite: Add more filterlistmodel tests
These ones try to be exhaustive and randomly catch weird cases.

As such, the tests are more complicated and harder to grasp.
Sorry.
2020-07-06 03:42:43 +02:00
Benjamin Otte
3162e25671 bitset: Fix typo: gtk_bitset_slice() => gtk_bitset_splice() 2020-07-06 03:42:43 +02:00
Benjamin Otte
3d931b4fe2 bitset: Don't overflow when splicing
Testcase added.
2020-07-06 03:42:43 +02:00
Matthias Clasen
2d8fddc1e9 filefilter: Drop GtkFileFilterFlags
Replace gtk_file_filter_get_needed by gtk_file_filter_get_attributes,
which directly returns the attributes that are needed.

Update all callers.
2020-07-05 15:10:13 -04:00
Matthias Clasen
a8b0125da1 filefilter: Drop GtkFileFilterInfo
We can just make the filter operate on GFileInfo.
This is in preparation for making GtkFileFilter a
GtkFilter.

Update all users.
2020-07-05 13:55:42 -04:00
Benjamin Otte
c4e4de36f6 stringlist: Remove n_additions argument from gtk_string_list_splice()
char ** arrays are null-terminated everywhere, so make sure they are in
splice(), too.

Also fix the argument to be a const char * const * like in the
constructor.
2020-07-05 02:59:21 +02:00
Benjamin Otte
795d3122cc selectionmodels: Add set_model() support
Now that we don't care about item types anymore, we can make the child
models settable.

We try to retain the selection, even when the model changes.
2020-07-05 02:59:21 +02:00
Benjamin Otte
5080730728 listmodels: Stop respecting item-type
Simplify all view model APIs and always return G_TYPE_OBJECT as the
item-type for every model.

It turns out nobody uses item-type anyway.

So instead of adding lots of APIs, forcing people to think about it and
trying to figure out how to handle filter or map models that modify item
types, just having an easy life is a better approach.

All the models need to be able to deal with any type of object going
through anyway.
2020-07-05 02:59:21 +02:00
Matthias Clasen
92e5536335 testsuite: Add selection filter model tests
Verify that the selection filter changes mirror
the selection changes of the underlying model,
as expected. These tests verify the fixes in
the previous commit.
2020-07-03 11:12:55 -04:00
Alexander Mikhaylenko
7c3b30036e headerbar: Show title buttons by default
Most of the time show-title-buttons is set to TRUE. Go ahead and make that
the default.
2020-07-02 23:51:16 +05:00
Matthias Clasen
43b9fc6981 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2162
2020-07-01 01:35:56 +00:00
Matthias Clasen
c4e8218f49 bitset: Add more tests
Add some tests for rectangles, and for iters.
2020-06-28 22:38:23 -04:00
Matthias Clasen
3132353ec5 ci: Drop one of the focus tests
One of the widget-factory focus tests is flaky in ci,
perhaps due to font changes causing size computations
to go slightly differently.

Drop this for now.
2020-06-28 18:59:48 -04:00
Matthias Clasen
3dc6267146 testsuite: Bump the per-test timeout to 60s
The bitset test has repeatedly run into the 30s timeout
in the ci, so give it some more time.
2020-06-28 17:02:01 -04:00
Matthias Clasen
6a6146a9e0 bitset: Fix the right-shift implementation
This was not doing the right thing at all.

This commit also adds tests for left- and
right-shift.
2020-06-28 16:37:30 -04:00
Matthias Clasen
d31bb8b503 testsuite: Don't pass GDK_DEBUG for release builds
The debug env vars are ignored in release builds,
and may spew warnings about that fact that break
tests.
2020-06-28 13:42:02 -04:00
Timm Bäder
20935f678b scale: Rearrange child widgets
Always keep the order:

 - [value]
 - [marks.top]
 - [marks.bottom]
 - trough

Which makes sense given the rendering order. Slider should be drawn
after the marks.

Makes it possible to simply remove the custom snapshot implementations
in scale and range. And Adwaita does not depend on the node order
anyway.
2020-06-27 10:51:06 +02:00
Benjamin Otte
488b0cbb69 gtk: Remove GtkPropertySelection
GtkMultiSelection is so much faster than this that it isn't needed.
2020-06-26 07:13:32 +02:00
Benjamin Otte
3d8b6f6b79 multiselection: Track items across resorts
In particular, track which items remain in ::items-changed
signal emissions.

But the main use case is sorting, which causes items-changed(0, n, n)
to be emitted.
2020-06-26 07:13:32 +02:00
Benjamin Otte
fa0295629b selectionmodel: Add gtk_selection_model_set_selection()
Also port the testsuite.
2020-06-26 07:13:32 +02:00
Benjamin Otte
8395698090 selectionmodel: Replace query_range() with get_selection() 2020-06-26 07:13:32 +02:00
Benjamin Otte
ff36cfb5be testsuite: Add tests for GtkBitset 2020-06-26 07:13:32 +02:00
Matthias Clasen
386b63b85d scrolledwindow: Don't take adjustments in new()
In 99.9% of all cases, these are just NULL, NULL.
So just do away with these arguments, people can
use the setters for the rare cases where they want
the scrolled window to use a different adjustment.
2020-06-24 11:25:09 -04:00
Matthias Clasen
e8210d5865 Add GtkStringList as public api
This is a list model holding strings, initialized
from a char **. String lists are buildable as well,
and that replaces the buildable support in GktDropDowns.
2020-06-23 16:11:46 -04:00
Matthias Clasen
9bcf401ef7 Add a basic clipboard test
This is not reproducing the failure I'm after, unfortunately.
2020-06-22 16:55:01 -04:00
Emmanuele Bassi
1c856a208f Rename master and slave device
We already use the "logical/virtual" and "physical" names in the
documentation, there's no reason to use loaded terms just because X11
uses them.
2020-06-18 19:22:20 +01:00
Emmanuele Bassi
a7f5b2e8fc Update a comment
Drop the use of "blacklist" from the comment, since everything else
refers to "ignored" properties.
2020-06-18 16:57:27 +01:00
Matthias Clasen
1b265a7971 Stop using GTestDBus
It is causing tests to timeout when libraries we are using
leak bus connections, and it turns out our tests run fine
without a session bus.
2020-06-17 12:06:09 -04:00
Matthias Clasen
5dddec4dd9 Add GtkBookmarkList
This is a listmodel similar to GtkDirectoryList,
for tracking recent files.
2020-06-11 16:14:47 -04:00
Benjamin Otte
541aaa2392 selectionmodel: Add unselect_rest argument to select_callback
This is not just about consistency with other functions.

It is about avoiding reentrancy problems.

GtkListBase first doing an unselect_all() will then force the
SelectionModel to consider a state where all items are unselected
(and potentially deciding to autoselect one) and then cause a
"selection-changed" emission that unselects all items and potentially
updates all the list item widgets in the GtkListBase to the unselected
state.

After this, GtkListBase selects new items, but to the SelectionModel and
the list item widgets this looks like an enitrely new operation and
there is no way to associate it with the previous state, so the
SelectionModel cannot undo any previous actions it took when
unselecting.
And all listitem widgets will now think they were just selected and
start running animations about selecting.
2020-06-08 19:06:56 +02:00
Matthias Clasen
f2259adcdc Disable a failing test
For some reason, empty-linear-gradient is failing here,
with the broadway and opengl renderers, and I don't
know why. Disable it for now.
2020-06-06 15:32:26 -04:00
Matthias Clasen
a73457237d Skip broken a11y tests 2020-06-06 14:18:44 -04:00
Matthias Clasen
1567db1f02 Merge branch 'misc-multiselection' into 'master'
Misc multiselection

See merge request GNOME/gtk!2055
2020-06-06 17:54:42 +00:00
Matthias Clasen
d1509971d8 Add GtkPropertySelection
This is a selection model that stores the selection
state in a boolean property of the items, and thus
persists across reordering and similar changes.

Fixes: #2826
2020-06-06 11:41:51 -04:00
Matthias Clasen
27ce68b74a Add tests for select_callback 2020-06-06 11:22:48 -04:00
Matthias Clasen
8090e213de Add a test for multiselection persistence
Add a test that verifies that newly added items
are always unselected.
2020-06-06 10:24:14 -04:00
Emmanuele Bassi
6b096e5c5b Make tooltip properties idiomatic
The tooltip handling in GtkWidget is "special":

 - the string is stored inside the qdata instead of the private
   instance data
 - the accessors call g_object_set() and g_object_get(), and the
   logic is all inside the property implementation, instead of
   being the other way around
 - the getters return a copy of the string
 - the setters don't really notify all the involved properties

The GtkWidgetAccessible uses the (escaped) tooltip text as a source for
the accessible object description, which means it has to store the
tooltip inside the object qdata, and update its copy at construction and
property notification time.

We can simplify this whole circus by making the tooltip properties (text
and markup) more idiomatic:

 - notify all side-effect properties
 - return a constant string from the getter
 - if tooltip-text is set:
   - store the text as is
   - escape the markup and store it separately for the markup getter
 - if tooltip-markup is set:
   - store the markup as is
   - parse the markup and store it separately for the text getter

The part of the testtooltips interactive test that checks that the
getters are doing the right thing is now part of the gtk testsuite, so
we ensure we don't regress in behaviour.
2020-06-05 20:32:26 +01:00
Matthias Clasen
80fbc1b72d multiselection: Fix the select_range implementation
When exclusive is TRUE, we would not always emit a
::selection-changed signal that covers all the items
that were unselected.

This commit includes a test.
2020-06-05 14:57:59 -04:00
Alexander Larsson
5059854a2e reftest: Clean up reftest_inhibit_snapshot()
This was done in a weird way where we always call reftest_uninhibit_snapshot()
on paint, and then re-inhibited it if it wasn't inhibited. To make this
work it also started with an extra inhibit.

This is very contorted and based on how this historically worked. This
changes it to just do:

  if (inhibit_count > 0)
    return;

And keep inhibit_count at its initial zero value unless it is actually
inhibited.
2020-06-04 15:45:29 +02:00
Alexander Larsson
b4af23be23 snapshot: Fix assert in inhibition
In https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2027 i was getting

Bail out! ERROR:../testsuite/reftests/reftest-snapshot.c:212:reftest_uninhibit_snapshot: assertion failed: (inhibit_count > 0)

In (for example the box-shadow-changes-modify-clip reftest. I can reproduce this (on master) with:

```
$ xvfb-run -a -s "-screen 0 1024x768x24" meson test --suite gtk:reftest "reftest box-shadow-changes-modify-clip.ui"
...
1/1 gtk:reftest / reftest box-shadow-changes-modify-clip.ui ERROR          0.77s
``

Fix this by re-inhibiting if we didn't draw anything, or we will get an assert the next paint.
2020-06-04 14:22:27 +02:00
Matthias Clasen
28f6e27276 Add GtkMultiSelection
This is implemented using a private GtkSet helper.

Includes tests.
2020-06-03 13:32:57 -04:00
Matthias Clasen
572386e4ce Merge branch 'matthiasc/for-master' into 'master'
print backend: Fix list model handling in dispose

See merge request GNOME/gtk!2013
2020-06-02 00:07:45 +00:00
Emmanuele Bassi
fb3d08c651 Print out the file name we're testing
We're printing out the file we're testing once we succeed, but it's hard
to know which file caused a failure. Let's add a g_test_message()
directive so we can look in our logs.
2020-06-01 21:06:04 +01:00
Matthias Clasen
0266bcab7a Add a test for the previous fix
This checks that action muxer hierarchy is properly
updated when muxers appear in the middle.
2020-06-01 13:52:50 -04:00
Matthias Clasen
af65b7e6d7 More action tests
Test actions under hierarchy changes.
2020-05-31 18:13:50 -04:00
Matthias Clasen
83c0937a46 testsuite: Beef up action tests
Check return values from  gtk_widget_activate.
2020-05-31 16:40:50 -04:00
Matthias Clasen
fc9462d49e Add some tests for new GtkBuilder syntax
Some valid and invalid examples for <closure>,
<lookup> and <constant>.
2020-05-30 19:31:38 -04:00
Matthias Clasen
371dab51bb Add GtkDropDown
This is a simple drop down control using list models.
2020-05-30 19:31:38 -04:00
Benjamin Otte
7910271b6c testsuite: Add tests for GtkTreeListSorter 2020-05-30 19:30:14 -04:00
Matthias Clasen
66500a6882 columnview: Add sorting
This is a somewhat large commit that:

- Adds GtkColumnViewSorter
This is a special-purpose, private sorter implementation which sorts
according to multiple sorters, allowing each individual sorter to be
inverted. This will be used with clickable column view headers.

- Adds a read-only GtkColumnView::sorter property
The GtkColumnView creates a GtkColumnViewSorter at startup that it uses
for this property.

- Adds a writable GtkColumnViewColumn::sorter property
This allows defining per-column sorters. Whenever an application sets a
sorter for a column, the header becomes clickable and whenever
a header is clicked, that column's sorter is prepended to the list of
sorters, unless it is already the first sorter, in which case we invert
its order. No column can be in the list more than once.
2020-05-30 19:26:46 -04:00
Matthias Clasen
542829ee81 Add some tests for expression binding
In particular, test that expressios can deal with object == this.
2020-05-30 19:26:46 -04:00
Benjamin Otte
8736343544 columnview: Add listitems for the columns
They are not aligned in columns yet, but they do exist.
2020-05-30 19:26:46 -04:00
Matthias Clasen
d1b2ded7e2 sorter: Add tests
Some basic tests for GtkSorter.
2020-05-30 19:26:44 -04:00
Matthias Clasen
11a1f8f36a Redo sort list model with GtkSorter
Reshuffle the api to take full advantage
of GtkSorter. Update all callers.
2020-05-30 19:26:44 -04:00
Matthias Clasen
115923b2d9 More expression tests
Test type mismatches, and the this pointer
during evaluation.
2020-05-30 17:48:44 -04:00
Benjamin Otte
92c359ca09 testsuite: Add expression tests 2020-05-30 17:48:44 -04:00
Benjamin Otte
fde75aa9f6 builder: Add support for parsing expressions 2020-05-30 17:47:47 -04:00
Benjamin Otte
2df3c39e50 filter: Add tests
Some basic tests for GtkFilter
2020-05-30 17:42:09 -04:00
Benjamin Otte
4abdf695e3 filterlistmodel: Rewrite to use GtkFilter 2020-05-30 12:30:23 -04:00
Alexander Larsson
20f15f5111 reftests: Fix frame inhibiting
Actually inhibit snapshotting of frames from reftest_inhibit_snapshot.
We were not ignoring the case where inhibit_count > 0, and then disconnected
the callback meaning we only ever got the first snapshot.
2020-05-28 15:13:13 +02:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Matthias Clasen
105fc16a9a testsuite: Drop the type-hint property from tests
No point in excluding a property that no longer
exists.
2020-05-26 19:31:12 -04:00
Timm Bäder
04b7dd802a compare-render: Fix some memory leaks 2020-05-24 17:14:18 +02:00
Timm Bäder
d5bf3c2cd1 gl renderer: Improve clipping code
don't render a clip to a texture if the new clip does not intersect with
any of the corners of the currently rounded clip.

Fixes #2770
2020-05-24 15:59:05 +02:00
Matthias Clasen
e7a420c40e testsuite: Re-add the sizegroups-evolution reftest
It doesn't seem to cause problems in ci anymore.
2020-05-22 17:10:28 -04:00
Matthias Clasen
e60ea00e8b reftests: Fix the background-origin test
This was broken when I accidentally removed
one of the buttons.
2020-05-22 10:48:33 -04:00
Matthias Clasen
c58d9446f4 Differentiate keypad keysyms in accelerators
When displaying accelerators, differentiate keypad
symbols with a 'KP' prefix. Fixing a 17 year old bug.

Update expected output in accelerator tests.

Fixes: #227
2020-05-21 19:38:19 -04:00
Timm Bäder
388733fe77 testsuite: Remove window decoration nodes from reference results 2020-05-20 17:06:54 +02:00
Timm Bäder
20b906cee8 Build print backends with common_cflags 2020-05-19 08:32:33 +02:00
Timm Bäder
7a768a2581 build: Pass common_cflags to focus-chain test 2020-05-19 08:32:33 +02:00
Timm Bäder
14c3bc542d tetsuite/a11y: Pass common_cflags to build 2020-05-19 08:32:33 +02:00
Timm Bäder
dd370db62a reftests: Pass common_cflags 2020-05-19 08:32:33 +02:00
Timm Bäder
2425d61516 Pass common_cflags to testuite/gsk executables 2020-05-19 08:32:33 +02:00
Matthias Clasen
17dd32da88 testsuite: Remove obsolete test from list
The test was removed in 97d0e8c6e0, but I neglected
to remove the test files from meson.build.

Fixes: #2760
2020-05-18 21:49:34 -04:00
Matthias Clasen
3dafdcbab0 testsuite: Remove GDK_DEBUG=misc
This snuck in by accident in recent ci setup
changes, and breaks the test runs by adding
stray output.
2020-05-18 16:38:11 -04:00
Matthias Clasen
36b4b39619 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1915
2020-05-16 15:03:10 +00:00
Matthias Clasen
350110ad9d testsuite: Add a gsk-compare-broadway suite
We have a Broadway renderer, might as well spell
that out in the tests, and make the suite exclude the
3d tests it can't handle.
2020-05-16 10:14:10 -04:00
Matthias Clasen
d771aa6fee testsuite: Destroy surfaces
If we don't destroy the surface, it leaks.

GDK backends keep an extra reference on the
surface for the external resources associated
with it, and only drop it in destroy().
2020-05-16 09:12:18 -04:00
Matthias Clasen
0232218100 displayclose: Quietly skip if no X available 2020-05-15 14:58:58 -04:00
Matthias Clasen
509db01319 tests: Centralize our test setup a bit
Put all of the constant environment into the
toplevel meson.build file, to reduce repetition
and copy-paste errors.
2020-05-15 14:11:53 -04:00
Matthias Clasen
ff4552c842 testsuite: Add test setups for backends
Add test setups that set the GDK_BACKEND and
TEST_OUTPUT_SUBDIR environment variables.

This lets use run
meson test --setup x11 --suite reftest
meson test --setup wayland --suite reftest
and the output will be nicely separated.

We still need to do compositor / display server
setup from the outside.
2020-05-15 14:11:53 -04: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
8912a6eb75 gtk: Handle seatless displays
If you run weston with the headless backend, you get a Wayland
display with no seat, which is just fine by the protocol.

gdk_display_get_default_seat() returns NULL in this case. Various
widgets assume that we always have a seat with a keyboard and a
pointer, since that is what X guarantees. Make things survive
without that, so we can run the testsuite under a headless
Wayland compositor.
2020-05-15 14:11:53 -04:00
Matthias Clasen
378cca75ea Add a test for a flowbox crash 2020-05-13 21:47:11 -04:00
Timm Bäder
b9ed957af3 gl renderer: Fix nested rounded clip rendering
If the inner clip intersects with the corners of the outer clip, we
potentially need a texture. We should add more fine-grained checks for
this in the future though.

Test case included.
2020-05-13 08:07:55 +02:00
Matthias Clasen
e706d4860e testsuite: Drop a container api use 2020-05-11 22:38:21 -04:00
Matthias Clasen
2a24b8c653 Replace most remaining uses of container api
These are all on GtkBox or enumerating children.
2020-05-11 22:38:21 -04:00
Matthias Clasen
6f170a0cf7 testsuite: Fix listbox tests
When moving from gtk_container_forall to the widget dom
api, we are now iterating over all children of the listbox,
including headers, separators, etc. So, skip everything
that is not a listboxrow, to make the tests work again.
2020-05-11 22:21:39 -04:00
Matthias Clasen
c55aa7e590 testsuite: Redo listbox sort test
This test was relying on gtk_container_forall returning
the visual (ie sorted) order of children, while iterating
with the widget dom api gives the insertion order.

Instead of using gtk_container_forall, use
gtk_list_box_row_get_index to reconstruct the visual
order.
2020-05-11 22:21:39 -04:00
Matthias Clasen
88141103cd Don't use container api on GtkListBox 2020-05-11 22:21:39 -04:00
Matthias Clasen
c0657297d1 grid: Remove a test for grid container functionality
This test was specifically testing how gtk_container_add
behaves on grids. Well, it doesn't anymore.
2020-05-11 22:21:39 -04:00
Matthias Clasen
932aa58237 Avoid container api on grids
GtkContainer is going away.
2020-05-11 22:21:39 -04:00
Matthias Clasen
bc6643f3c2 paned: Redo the api
This commit is porting GtkPaned to be derived
from GtkWidget instead of GtkContainer, while adding
start-child and end-child properties. The existing
properties are renamed to follow the start/end naming
scheme, and we add proper getters and setters.

Update all users.

See #2719
2020-05-11 22:21:33 -04:00
Matthias Clasen
d7b1ecdf52 Cosmetics: Replace GtkContainer in an error message
GtkWidget is not that much better here, unfortunately.

Adapt the testsuite to match.
2020-05-11 15:42:51 -04:00
Timm Bäder
e5d6b493c0 testsuite: add widget refcount test case
Testing toplevels and popovers.
2020-05-11 12:20:59 -04:00
Matthias Clasen
025375ff5f Replace gtk_widget_destroy everywhere
Replace all remaining uses of gtk_widget_destroy
by gtk_container_remove or g_object_unref.
2020-05-11 12:20:59 -04:00
Matthias Clasen
cd0081d08a Use gtk_window_destroy
Replace calls to gtk_widget_destroy on windows
with gtk_window_destroy.
2020-05-11 12:20:57 -04:00
Matthias Clasen
466d2a84de testsuite: Clean up unexpected children
If you call gtk_widget_set_parent on an unsuspecting
parent widget, it is your reponsibility to clean up
before the parent gets finalized.
2020-05-11 12:19:39 -04:00
Matthias Clasen
b8c5bf8af8 testsuite: Enable the remaining template tests
These are no longer failing.
2020-05-11 10:30:03 -04:00
Matthias Clasen
1b8a025a5f Clean up a leak in a test
One of the treeview tests was calling gtk_widget_destroy
on a child instead of the toplevel, which leaks the toplevel
unnecessarily. Plus, we're moving towards allowing destroy
only on toplevels.
2020-05-11 08:15:55 -04:00
Matthias Clasen
caab6ac6e7 testsuite: Add more tests for automated components
Add template tests that show the complex dialogs before
destroying them. This reveals that we are leaking in
several of them. These leaks don't show up if the
dialogs are destroyed right away, as the existing
tests do.

Disable the two failing tests for now:
  /template/GtkFileChooserDialog/show
  /template/GtkPrintUnixDialog/show
2020-05-10 16:25:28 -04:00
Matthias Clasen
9d4b01fff8 testsuite: Use lowercase component in test paths
This is purely cosmetic.
2020-05-10 16:25:28 -04:00
Matthias Clasen
eae4a194b8 Merge branch 'wip/exalm/headerbar-dragging' into 'master'
Extract GtkWindow dragging and titlebar actions

Closes #2689

See merge request GNOME/gtk!1814
2020-05-10 18:15:57 +00:00
Matthias Clasen
fc42a0696e Add a test for refcounts under reordering
It turns out that we have a ref leak at the very
core of our dom model :( gtk_widget_insert_before/after
leak a reference if the widget was already under
the same parent. This is something that GtkBox
frequently does. It shows up e.g. when packing
widgets at the end in a headerbar.
2020-05-09 19:38:19 -04:00
Alexander Mikhaylenko
8d24711567 testsuite: Update bloomfilter test
Add the 2 new css nodes.
2020-05-08 00:03:42 +05:00
Matthias Clasen
17c21513a8 testsuite: Update a testcase
Our testcase for flipping icons used media icons which
were recently changed to not do rtl flipping anymore.
2020-05-04 22:53:08 -04:00
Matthias Clasen
d8e47383cb Add a test for bin child conversion 2020-05-04 22:53:08 -04:00
Matthias Clasen
dec5707ca9 builder-tool: Convert former bin children
Convert from <child> elements to <property name="child">
for former GtkBin subclasses. Update test results
to match.
2020-05-04 22:53:08 -04:00
Matthias Clasen
5d26af06e4 combobox: Add a child property 2020-05-04 22:53:08 -04:00
Matthias Clasen
12ecbd1508 listboxrow: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore.

See #2681
2020-05-04 22:53:08 -04:00
Matthias Clasen
649ae635a7 Use gtk_revealer_set_child throughout
Replace all uses of gtk_container_add on revealers
with gtk_revealer_set_child.
2020-05-04 22:53:08 -04:00
Matthias Clasen
f59f355190 Use gtk_window_set_child throughout
Replace all uses of gtk_container_add on windows
by gtk_window_set_child.
2020-05-04 22:53:08 -04:00
Matthias Clasen
97d0e8c6e0 css testsuite: Remove an obsolete test
This was testing something that shouldn't be possible
anyway: Adding more than one child to a bin. With the
bin removal, this now just overrides the child so
only one child is left in the end.

Just remove the test.
2020-05-04 22:53:07 -04:00
Matthias Clasen
07441ad000 css tests: Update expected results
Now that GtkCheckButton is using a box layout,
we are no longer reordering the css nodes according
to text direction.
2020-05-04 22:53:07 -04:00
Matthias Clasen
67759d4c3e Use gtk_scrolled_window_set_child throughout
Replace all uses of gtk_container_add on popovers
by gtk_scrolled_window_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
8e261056b9 Use gtk_popover_set_child throughout
Replace all uses of gtk_container_add on popovers
by gtk_popover_set_child.
2020-05-04 22:53:07 -04:00
Alexander Mikhaylenko
6b4bed2c7a builder-tool: Rename GtkHeaderBar:custom-title to title-widget
Add a test.
2020-05-01 20:11:19 +05:00
Alexander Mikhaylenko
c2e4e1af73 headerbar: Remove user-settable title
Use window title, or custom title widget if it's set. Remove 'title'
property.

Update demos and tests to set the title on the window instead of
headerbar.
2020-05-01 19:48:05 +05:00
Alexander Mikhaylenko
35d50f88c8 headerbar: Remove subtitle
Also remove the box containing title and subtitle, as there's only one
label now.
2020-05-01 19:48:05 +05:00
Matthias Clasen
2e2121c7ad builder-tool: Replace GtkStack:homogeneous
Replace this property by h/vhomogeneous.

Add a test.
2020-04-28 20:00:51 -04:00
Matthias Clasen
a8e04ee81d Merge branch 'matthiasc/for-master' into 'master'
More reftest fixes

See merge request GNOME/gtk!1765
2020-04-26 14:30:10 +00:00
Matthias Clasen
fa2a8ac1bb reftests: Remove window-show-contents-on-map from xfails
This test passes now.
2020-04-26 09:18:54 -04:00
Matthias Clasen
56565b12d8 reftests: Fix the window-show-contents-on-map test
Despite the name, the test was not in fact showing
contents on map anymore, since widgets are visible
by default. Setting visible to FALSE makes the test
work as expected again.
2020-04-26 09:16:25 -04:00
Matthias Clasen
7f1e82d1bc Merge branch 'wip/exalm/titlebuttons' into 'master'
GtkWindowControls + GtkHeaderBar cleanups

See merge request GNOME/gtk!1755
2020-04-26 13:09:35 +00:00
Matthias Clasen
99d7130da3 reftests: Remove background-image-multiple from xfails
It no longer fails.
2020-04-25 13:26:14 -04:00
Matthias Clasen
ac3e604bb6 reftests: Use transform syntax
This is supposed to fix the background-image-multiple
reftest, but it doesn't. There's an actual bug here.
2020-04-25 12:47:17 -04:00
Matthias Clasen
1d86a89ccf testsuite: Take textview-border-windows out of xfails
The textview-border-window reftest passes now, so
take it out of the xfails.
2020-04-24 18:35:22 -04:00
Matthias Clasen
c192038027 reftests: Avoid text caret from interfering
We are comparing a transparent label to a transparent
text view, so need to make sure the caret does not show
up in the text view to ruin the comparison.
2020-04-24 18:33:57 -04:00
Matthias Clasen
894e1d0885 testsuite: Take border-color-transparent out of xfails
The border-color-transparent reftest passes now, so
take it out of the xfails.
2020-04-24 15:20:58 -04:00
Matthias Clasen
c8d4a48c03 reftests: Avoid theme influence
Reset to defaults in background-color-transparent,
to avoid theme influence in the results.
2020-04-24 15:19:24 -04:00
Matthias Clasen
7ce964a455 reftests: Avoid decorations
Window decorations always cause trouble between ci
and local test runs, so turn them off for the
background-color-transparent reftest.
2020-04-24 15:18:02 -04:00
Alexander Mikhaylenko
197fe80857 testsuite: Fix swapped params in notify test
The expected and counted params are swapped in literally every call, so
swapping the params to match them.
2020-04-24 23:54:07 +05:00
Matthias Clasen
96f9f9585f reftests: Stop using shadow-type 2020-04-17 11:06:16 -04:00
Matthias Clasen
12d5fdd457 menubutton: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
df1816a29c button: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
285aa226e5 scrolledwindow: Drop shadow-type
We were only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Emmanuele Bassi
f28aa1ba02 Restructure the GdkEvent type hierarchy
GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
2020-04-16 19:54:02 +01:00
Matthias Clasen
5095e87bb7 testsuite: Add some checks for focus states
This is some opportunistic checking in a test that
is really about focus chains, but better than nothing.
2020-04-16 12:31:17 -04:00
Matthias Clasen
e3dba28666 Merge branch 'arnaudb/better-substitution' into 'master'
Fix some gtk-builder-tool substitutions.

See merge request GNOME/gtk!1675
2020-04-12 22:53:54 +00:00
Arnaud Bonatti
e76dee07c5 Fix tests for margin-left and margin-right. 2020-04-12 19:28:33 +02:00
Arnaud Bonatti
a7218da202 Fix tests for hexpand and vexpand. 2020-04-12 19:28:29 +02:00
Arnaud Bonatti
ed362fcc5b Fix --3to4 tests for margin substitution. 2020-04-12 19:28:29 +02:00
Matthias Clasen
7233a70d47 reftest: get backtraces
In the hope of making ci-only failures less of a black hole,
add a backtrace to the messsage for criticals.

This could eventually go into GLib (pass backtrace symbols along
as a log field for criticals), but for now this will do.
2020-04-12 11:44:13 -04:00
Matthias Clasen
b09b2dd2cd testsuite: Make actions test order-independent
We only want to check that the actions are what we
expect, not that they are registered in a particular
order.
2020-04-11 10:07:31 -04:00
Matthias Clasen
394ea32e93 Use gtk_widget_add/remove_css_class more
Replace most uses of gtk_style_context_add/remove_class
by the new APIs. The only remaining uses of the old API
are in save/restore situations.
2020-04-10 12:09:57 -04:00
Matthias Clasen
822c2aba36 scalebutton: Don't derive from GtkButton
Make GtkScaleButton a widget that has a toggle button
as a child, just like all the other button widgets now.
The immediate benefit of this arrangement is to avoid
the "double focus" problem when we pop up the popup.

Update accessible, demos and tests to match.
2020-04-09 20:43:45 -04:00
Matthias Clasen
35ba24d2e8 Update a11y test results 2020-04-09 18:26:10 -04:00
Matthias Clasen
b9a76ddd75 Fix the tools tests to not set can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen
038190c5a8 Disable focus-chain test that depends on the environment
The color editor shows a color picker button only if it
finds a suitable implementation, which it does not in ci.
So disable the focus-chain test for page 3.
2020-04-09 17:50:29 -04:00
Matthias Clasen
99eed078bd Remove focusable-container tests
Like the previous commit, these tests were relying
on setting :can-focus to make an unsuspecting container
focusable, which does not work anymore.
2020-04-09 17:50:29 -04:00
Matthias Clasen
6720552afd Remove the focus test
This test was expecting to make existing widgets like
GtkBox focusable by setting :can-focus. That just doesn't
work anymore.

The focus chain testing that is done here is already
better covered by test-focus-chain, so lets just remove this.
2020-04-09 17:50:29 -04:00
Matthias Clasen
6f01508aa8 Fix up focus chain result
The notebook grab_focus change in the previous commit made
backwards tabbing work as expected, and thereby changed the
output of one of the focus-chain tests.
2020-04-09 17:50:29 -04:00
Matthias Clasen
9416856420 testsuite: Stop setting :has-focus
This is not necessary, whenever we want to set the initial
focus in a ui file, we can set GtkWindow:focus-widget.
2020-04-09 17:50:29 -04:00
Matthias Clasen
4fe8c037c7 reftests: Stop using can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen
b1afe5ff23 a11y tests: Stop using can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen
bbd4fb8798 testsuite: Stop using can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen
ff8217db40 Add more focus chain tests
Test page 2 and 3 of widget-factory as well, and try other directions.
2020-04-09 17:50:28 -04:00
Matthias Clasen
a3861bf9a0 Fix running focus-chain tests in ci
The widget-factory ui files require geettings
(for the color chooser), so set GSETTINGS_SCHEMA_DIR.
2020-04-09 17:50:28 -04:00
Matthias Clasen
c03b7e4d45 reftests: Comment out a test that fails only in ci
Fixing such only-in-ci failures is just too hard,
unfortunately.
2020-04-06 16:32:03 -04:00
Matthias Clasen
c297d45b8a gtk: Stop using modifier intents
Reviewing the existing settings, the only backend with
some differences in the modifier intent settings is OS X,
and we would rather have that implemented by interpreting
the existing modifiers in the appropriate way.

                X11      Wayland  Win32    OS X

primary         ctrl     ctrl     ctrl     mod2
mnemonic        alt      alt      alt      alt
context menu    -        -        -        ctrl
extend sel      shift    shift    shift    shift
modify sel      ctrl     ctrl     ctrl     mod2
no text         alt|ctrl alt|ctrl alt|ctrl mod2|ctrl
shift group     varies   -        -        alt

GTK now uses the following modifiers:

primary         ctrl
mnemonic        alt
extend sel      shift
modify sel      ctrl
no text         alt|ctrl

The context menu and shift group intents were not used
in GTK at all.

Update tests to no longer expect <Primary> to roundtrip
through the accelerator parsing and formatting code.
2020-04-06 16:32:03 -04:00
Matthias Clasen
0a96a483c6 gdk: Redo key events
Add all of the keyboard translation results in the key event,
so we can translate the keyboard state at the time the event
is created, and avoid doing state translation at match time.

We actually need to carry two sets of translation results,
since we ignore CapsLock when matching accelerators, in
gdk_event_matches().

At the same time, drop the scancode field - it is only ever
set on win32, and is basically unused in GTK.

Update all callers.
2020-04-06 15:13:54 -04:00
Matthias Clasen
b02db72e17 Rename GDK_MOD1_MASK to GDK_ALT_MASK
We've hardcoded Mod1 = Alt for a long time, there is
no need to keep the confusing naming around anymore.
2020-04-06 01:40:49 -04:00
Matthias Clasen
6eaadba008 testsuite: Stop using keymap apis 2020-04-06 01:40:49 -04:00
Matthias Clasen
e8330c5eec Add gdk_event_matches
Move the elaborate key event matching code from
GtkShortcutTrigger to GdkEvent, which greatly reduces
the amount of keymap api use outside of GDK.
2020-04-05 23:37:13 -04:00
Matthias Clasen
8991275fbd colorbutton: Fix focus
The colorbutton contains a button which contains a colorswatch.
We want the focus to go straight to the button, nowhere else,
so mark the swatch as !can-focus.

Adapt tests to match.
2020-04-04 00:28:45 -04:00
Matthias Clasen
e43eb951d6 Merge branch 'scrollbar-a11y' into 'master'
Add GtkScrollbarAccessible

See merge request GNOME/gtk!1623
2020-04-04 04:03:40 +00:00
Matthias Clasen
6b292af6ac testsuite: Add tests for parsing shortcut actions 2020-04-03 22:42:00 -04:00
Matthias Clasen
339d3e41b0 Add GtkScrollbarAccessible
When GtkScrollbar stopped being a GtkRange,
GtkRangeAccessible stopped working for scrollbars.

Update a11y tests to match.
2020-04-03 15:20:27 -04:00
Matthias Clasen
d662512c44 testsuite: Add a big focus chain testcase 2020-04-03 11:35:34 -04:00
Matthias Clasen
324af2f701 testsuite: Try harder to record a full focus chain
It is hard to avoid widgets with the same name in a
large ui file - try harder to record a full focus chain
before decide that we've wrapped, by including the widget
address in the comparison. Note that we don't include
the addresses in the generated output, since that would
make expected output vary from run to run.
2020-04-03 11:35:26 -04:00
Matthias Clasen
14166b09b5 a11y tests: Update for focus state changes 2020-04-02 17:35:15 -04:00
Matthias Clasen
199a539ae7 Update the settings test 2020-04-01 00:24:56 -04:00
Matthias Clasen
b92b7f45b5 testsuite: Add a test for transforms in builder files 2020-03-31 16:49:51 -04:00