summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-08-03 15:54:42 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-09-05 21:50:15 -0400
commit24389a0ef5063944aa9909a40239658c4eedb230 (patch)
tree7daba4b0cca5a7dbc9e892325815f651d4ecc88b /testsuite
parentdfabe74c593b876f50e56903e6c5f7f11f332781 (diff)
downloadgtk+-24389a0ef5063944aa9909a40239658c4eedb230.tar.gz
Make sorter constructors return exact typesfilter-constructors
Make functions like gtk_custom_sorter_new() return the actual type they construct. Update all callers.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gtk/sorter.c36
-rw-r--r--testsuite/gtk/sortlistmodel-exhaustive.c6
-rw-r--r--testsuite/gtk/sortlistmodel.c10
-rw-r--r--testsuite/gtk/treesorter.c8
4 files changed, 30 insertions, 30 deletions
diff --git a/testsuite/gtk/sorter.c b/testsuite/gtk/sorter.c
index e7a299dfcb..ad6d94ebbb 100644
--- a/testsuite/gtk/sorter.c
+++ b/testsuite/gtk/sorter.c
@@ -274,7 +274,7 @@ test_simple (void)
model = new_model (20, NULL);
assert_not_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- sorter = gtk_custom_sorter_new (compare_numbers, NULL, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare_numbers, NULL, NULL));
gtk_sort_list_model_set_sorter (model, sorter);
g_object_unref (sorter);
@@ -296,7 +296,7 @@ test_string (void)
model = new_model (20, NULL);
assert_not_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- sorter = gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback)get_string, NULL, NULL));
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback)get_string, NULL, NULL)));
gtk_sort_list_model_set_sorter (model, sorter);
g_object_unref (sorter);
@@ -330,7 +330,7 @@ test_change (void)
GtkExpression *expression;
int counter = 0;
- sorter = gtk_string_sorter_new (NULL);
+ sorter = GTK_SORTER (gtk_string_sorter_new (NULL));
g_signal_connect (sorter, "changed", G_CALLBACK (inc_counter), &counter);
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback)get_string, NULL, NULL);
@@ -360,7 +360,7 @@ test_numeric (void)
model = new_model (20, NULL);
assert_not_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- sorter = gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL));
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL)));
gtk_sort_list_model_set_sorter (model, sorter);
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
@@ -409,7 +409,7 @@ test_multi (void)
model = new_model (20, NULL);
assert_not_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- sorter2 = gtk_numeric_sorter_new (NULL);
+ sorter2 = GTK_SORTER (gtk_numeric_sorter_new (NULL));
gtk_sort_list_model_set_sorter (model, sorter2);
expression = gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL);
gtk_numeric_sorter_set_expression (GTK_NUMERIC_SORTER (sorter2), expression);
@@ -417,10 +417,10 @@ test_multi (void)
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- sorter = gtk_multi_sorter_new ();
+ sorter = GTK_SORTER (gtk_multi_sorter_new ());
gtk_sort_list_model_set_sorter (model, sorter);
- sorter1 = gtk_custom_sorter_new (compare_even, NULL, NULL);
+ sorter1 = GTK_SORTER (gtk_custom_sorter_new (compare_even, NULL, NULL));
gtk_multi_sorter_append (GTK_MULTI_SORTER (sorter), sorter1);
gtk_multi_sorter_append (GTK_MULTI_SORTER (sorter), sorter2);
@@ -446,8 +446,8 @@ test_multi_destruct (void)
{
GtkSorter *multi, *sorter;
- multi = gtk_multi_sorter_new ();
- sorter = gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL));
+ multi = GTK_SORTER (gtk_multi_sorter_new ());
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL)));
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), g_object_ref (sorter));
g_object_unref (multi);
@@ -470,13 +470,13 @@ test_multi_changes (void)
model = gtk_sort_list_model_new (G_LIST_MODEL (new_store (1, 20, 1)), NULL);
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- multi = gtk_multi_sorter_new ();
+ multi = GTK_SORTER (gtk_multi_sorter_new ());
g_signal_connect (multi, "changed", G_CALLBACK (inc_counter), &counter);
gtk_sort_list_model_set_sorter (model, multi);
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
g_assert_cmpint (counter, ==, 0);
- sorter1 = gtk_numeric_sorter_new (NULL);
+ sorter1 = GTK_SORTER (gtk_numeric_sorter_new (NULL));
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), sorter1);
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
g_assert_cmpint (counter, ==, 1);
@@ -491,7 +491,7 @@ test_multi_changes (void)
assert_model (model, "4 9 14 19 3 8 13 18 2 7 12 17 1 6 11 16 5 10 15 20");
g_assert_cmpint (counter, ==, 3);
- sorter2 = gtk_custom_sorter_new (compare_even, NULL, NULL);
+ sorter2 = GTK_SORTER (gtk_custom_sorter_new (compare_even, NULL, NULL));
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), sorter2);
assert_model (model, "4 14 9 19 8 18 3 13 2 12 7 17 6 16 1 11 10 20 5 15");
g_assert_cmpint (counter, ==, 4);
@@ -500,7 +500,7 @@ test_multi_changes (void)
assert_model (model, "10 20 5 15 6 16 1 11 2 12 7 17 8 18 3 13 4 14 9 19");
g_assert_cmpint (counter, ==, 5);
- sorter3 = gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback)get_spelled_out, NULL, NULL));
+ sorter3 = GTK_SORTER (gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback)get_spelled_out, NULL, NULL)));
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), sorter3);
assert_model (model, "10 20 15 5 6 16 11 1 12 2 7 17 8 18 13 3 4 14 9 19");
g_assert_cmpint (counter, ==, 6);
@@ -524,13 +524,13 @@ test_multi_changes (void)
static GtkSorter *
even_odd_sorter_new (void)
{
- return gtk_custom_sorter_new (compare_even, NULL, NULL);
+ return GTK_SORTER (gtk_custom_sorter_new (compare_even, NULL, NULL));
}
static GtkSorter *
numeric_sorter_new (void)
{
- return gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL));
+ return GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL)));
}
static void
@@ -615,8 +615,8 @@ test_stable (void)
GtkSorter *multi, *a, *b;
guint i;
- a = gtk_multi_sorter_new ();
- b = gtk_multi_sorter_new ();
+ a = GTK_SORTER (gtk_multi_sorter_new ());
+ b = GTK_SORTER (gtk_multi_sorter_new ());
/* We create 2 setups:
* 1. sortmodel (multisorter [a, b])
* 2. sortmodel (b) => sortmodel (a)
@@ -627,7 +627,7 @@ test_stable (void)
* All we do is make a and b random sorters and assert that the 2 setups
* produce the same order every time.
*/
- multi = gtk_multi_sorter_new ();
+ multi = GTK_SORTER (gtk_multi_sorter_new ());
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), a);
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), b);
model1 = new_model (20, multi);
diff --git a/testsuite/gtk/sortlistmodel-exhaustive.c b/testsuite/gtk/sortlistmodel-exhaustive.c
index 9b4fd7f20f..4b8e2bacbb 100644
--- a/testsuite/gtk/sortlistmodel-exhaustive.c
+++ b/testsuite/gtk/sortlistmodel-exhaustive.c
@@ -252,12 +252,12 @@ create_sorter (gsize id)
switch (id)
{
case 0:
- return gtk_string_sorter_new (NULL);
+ return GTK_SORTER (gtk_string_sorter_new (NULL));
case 1:
case 2:
/* match all As, Bs and nothing */
- sorter = gtk_string_sorter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string"));
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string")));
if (id == 1)
gtk_string_sorter_set_ignore_case (GTK_STRING_SORTER (sorter), TRUE);
return sorter;
@@ -304,7 +304,7 @@ test_two_sorters (gconstpointer model_id)
model2 = create_sort_list_model (model_id, TRUE, source, NULL);
/* can't track changes from a sortmodel, where the same items get reordered */
model1 = create_sort_list_model (model_id, FALSE, G_LIST_MODEL (model2), NULL);
- every = gtk_multi_sorter_new ();
+ every = GTK_SORTER (gtk_multi_sorter_new ());
compare = create_sort_list_model (model_id, TRUE, source, every);
g_object_unref (every);
g_object_unref (source);
diff --git a/testsuite/gtk/sortlistmodel.c b/testsuite/gtk/sortlistmodel.c
index 4a84b36a88..5c63cff27d 100644
--- a/testsuite/gtk/sortlistmodel.c
+++ b/testsuite/gtk/sortlistmodel.c
@@ -219,7 +219,7 @@ new_model (gpointer model)
{
GtkSorter *sorter;
- sorter = gtk_custom_sorter_new (compare, NULL, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare, NULL, NULL));
result = gtk_sort_list_model_new (g_object_ref (model), sorter);
}
else
@@ -312,7 +312,7 @@ test_set_sorter (void)
assert_model (sort, "2 4 6 8 10");
assert_changes (sort, "");
- sorter = gtk_custom_sorter_new (compare_modulo, GUINT_TO_POINTER (5), NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare_modulo, GUINT_TO_POINTER (5), NULL));
gtk_sort_list_model_set_sorter (sort, sorter);
g_object_unref (sorter);
assert_model (sort, "10 6 2 8 4");
@@ -322,7 +322,7 @@ test_set_sorter (void)
assert_model (sort, "4 8 2 6 10");
assert_changes (sort, "0-5+5");
- sorter = gtk_custom_sorter_new (compare, NULL, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare, NULL, NULL));
gtk_sort_list_model_set_sorter (sort, sorter);
g_object_unref (sorter);
assert_model (sort, "2 4 6 8 10");
@@ -424,7 +424,7 @@ test_stability (void)
assert_model (sort, "1 11 21 31");
assert_changes (sort, "");
- sorter = gtk_custom_sorter_new (compare_modulo, GUINT_TO_POINTER (5), NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare_modulo, GUINT_TO_POINTER (5), NULL));
gtk_sort_list_model_set_sorter (sort, sorter);
g_object_unref (sorter);
assert_model (sort, "11 31 21 1");
@@ -467,7 +467,7 @@ test_incremental_remove (void)
gtk_sort_list_model_set_model (model, G_LIST_MODEL (store));
- sorter = gtk_custom_sorter_new (compare, NULL, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare, NULL, NULL));
gtk_sort_list_model_set_sorter (model, sorter);
g_object_unref (sorter);
diff --git a/testsuite/gtk/treesorter.c b/testsuite/gtk/treesorter.c
index 25d43a3d40..650cfa39fb 100644
--- a/testsuite/gtk/treesorter.c
+++ b/testsuite/gtk/treesorter.c
@@ -175,7 +175,7 @@ test_simple (void)
model = new_model (3);
assert_model (model, "1 2 21 3 31 32 321");
- sorter = gtk_tree_list_row_sorter_new (NULL);
+ sorter = GTK_SORTER (gtk_tree_list_row_sorter_new (NULL));
sort = gtk_sort_list_model_new (model, sorter);
assert_model (sort, "1 2 21 3 31 32 321");
@@ -185,7 +185,7 @@ test_simple (void)
static GtkSorter *
new_numeric_sorter (void)
{
- return gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL));
+ return GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL)));
}
static void
@@ -198,7 +198,7 @@ test_compare_total_order (void)
model = new_model (3);
assert_model (model, "1 2 21 3 31 32 321");
- sorter = gtk_tree_list_row_sorter_new (new_numeric_sorter ());
+ sorter = GTK_SORTER (gtk_tree_list_row_sorter_new (new_numeric_sorter ()));
n = g_list_model_get_n_items (model);
for (i = 0; i < n; i++)
@@ -228,7 +228,7 @@ test_compare_no_order (void)
model = new_model (3);
assert_model (model, "1 2 21 3 31 32 321");
- sorter = gtk_tree_list_row_sorter_new (NULL);
+ sorter = GTK_SORTER (gtk_tree_list_row_sorter_new (NULL));
n = g_list_model_get_n_items (model);
for (i = 0; i < n; i++)