Improve test coverage for list models
This commit is contained in:
@@ -296,7 +296,8 @@ test_create (void)
|
||||
{
|
||||
GtkSelectionModel *selection;
|
||||
GListStore *store;
|
||||
|
||||
guint start, end;
|
||||
|
||||
store = new_store (1, 5, 2);
|
||||
selection = new_model (store);
|
||||
|
||||
@@ -311,6 +312,12 @@ test_create (void)
|
||||
assert_selection (selection, "");
|
||||
assert_selection_changes (selection, "");
|
||||
|
||||
g_assert_true (g_list_model_get_item_type (G_LIST_MODEL (selection)) == G_TYPE_OBJECT);
|
||||
g_assert_true (gtk_multi_selection_get_model (GTK_MULTI_SELECTION (selection)) == G_LIST_MODEL (store));
|
||||
gtk_section_model_get_section (GTK_SECTION_MODEL (selection), 0, &start, &end);
|
||||
g_assert_cmpint (start, ==, 0);
|
||||
g_assert_cmpint (end, ==, G_MAXUINT);
|
||||
|
||||
g_object_unref (selection);
|
||||
}
|
||||
|
||||
@@ -634,6 +641,9 @@ test_selection_filter (void)
|
||||
assert_model (filter, "2 3 4");
|
||||
assert_changes (filter, "");
|
||||
|
||||
g_assert_true (g_list_model_get_item_type (G_LIST_MODEL (filter)) == G_TYPE_OBJECT);
|
||||
g_assert_true (gtk_selection_filter_model_get_model (filter) == selection);
|
||||
|
||||
g_object_unref (store);
|
||||
g_object_unref (selection);
|
||||
g_object_unref (filter);
|
||||
|
||||
@@ -287,7 +287,8 @@ test_create (void)
|
||||
{
|
||||
GtkSelectionModel *selection;
|
||||
GListStore *store;
|
||||
|
||||
guint start, end;
|
||||
|
||||
if (glib_check_version (2, 59, 0) != NULL)
|
||||
{
|
||||
g_test_skip ("g_list_store_get_item() has overflow issues before GLIB 2.59.0");
|
||||
@@ -310,6 +311,12 @@ test_create (void)
|
||||
assert_selection (selection, "");
|
||||
assert_selection_changes (selection, "");
|
||||
|
||||
g_assert_true (g_list_model_get_item_type (G_LIST_MODEL (selection)) == G_TYPE_OBJECT);
|
||||
g_assert_true (gtk_single_selection_get_model (GTK_SINGLE_SELECTION (selection)) == G_LIST_MODEL (store));
|
||||
gtk_section_model_get_section (GTK_SECTION_MODEL (selection), 0, &start, &end);
|
||||
g_assert_cmpint (start, ==, 0);
|
||||
g_assert_cmpint (end, ==, G_MAXUINT);
|
||||
|
||||
g_object_unref (selection);
|
||||
}
|
||||
|
||||
@@ -701,7 +708,7 @@ test_set_model (void)
|
||||
assert_selection (selection, "");
|
||||
assert_selection_changes (selection, "");
|
||||
|
||||
gtk_single_selection_set_selected (GTK_SINGLE_SELECTION (selection), 4);
|
||||
g_object_set (selection, "selected", 4, NULL);
|
||||
assert_selection (selection, "5");
|
||||
assert_selection_changes (selection, "4:1");
|
||||
|
||||
|
||||
@@ -238,6 +238,8 @@ test_create (void)
|
||||
assert_model (slice, "1 3 5");
|
||||
assert_changes (slice, "");
|
||||
|
||||
g_assert_true (g_list_model_get_item_type (G_LIST_MODEL (slice)) == G_TYPE_OBJECT);
|
||||
|
||||
g_object_unref (slice);
|
||||
}
|
||||
|
||||
@@ -287,6 +289,8 @@ test_set_slice (void)
|
||||
assert_model (slice, "3 5 7");
|
||||
assert_changes (slice, "+2*");
|
||||
|
||||
g_assert_cmpuint (gtk_slice_list_model_get_offset (slice), ==, 1);
|
||||
|
||||
g_object_unref (store);
|
||||
g_object_unref (slice);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user