Commit Graph

1675 Commits

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