Commit Graph

730 Commits

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