summaryrefslogtreecommitdiff
path: root/testsuite/gtk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2023-04-11 04:45:30 +0200
committerBenjamin Otte <otte@redhat.com>2023-05-09 17:00:40 +0200
commit46adfbef4f3285d0e810adc4910e59a46b629435 (patch)
treebfe6bffe69aa3763e19933f9a98864305ed4de48 /testsuite/gtk
parent53bfcf7f0ae8098c1ae3a29a322c32d545667849 (diff)
downloadgtk+-46adfbef4f3285d0e810adc4910e59a46b629435.tar.gz
listitemmanager: Create header items for sections
Now, finally, listitemmanager has all the necessary support to make section headers work.
Diffstat (limited to 'testsuite/gtk')
-rw-r--r--testsuite/gtk/listitemmanager.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/testsuite/gtk/listitemmanager.c b/testsuite/gtk/listitemmanager.c
index d883aca063..ba5fbd54ba 100644
--- a/testsuite/gtk/listitemmanager.c
+++ b/testsuite/gtk/listitemmanager.c
@@ -97,12 +97,15 @@ check_list_item_manager (GtkListItemManager *items,
GtkListTile *tile;
guint n_items = 0;
guint i;
+ gboolean has_sections;
enum {
NO_SECTION,
MATCHED_SECTION,
UNMATCHED_SECTION
} section_state = NO_SECTION;
+ has_sections = gtk_list_item_manager_get_has_sections (items);
+
for (tile = gtk_list_item_manager_get_first (items);
tile != NULL;
tile = gtk_rb_tree_node_get_next (tile))
@@ -112,7 +115,8 @@ check_list_item_manager (GtkListItemManager *items,
case GTK_LIST_TILE_HEADER:
g_assert_cmpint (section_state, ==, NO_SECTION);
g_assert_cmpint (tile->n_items, ==, 0);
- g_assert_false (tile->widget);
+ g_assert_true (has_sections);
+ g_assert_true (tile->widget);
section_state = MATCHED_SECTION;
break;
@@ -126,6 +130,7 @@ check_list_item_manager (GtkListItemManager *items,
case GTK_LIST_TILE_FOOTER:
g_assert_cmpint (section_state, ==, MATCHED_SECTION);
g_assert_cmpint (tile->n_items, ==, 0);
+ g_assert_true (has_sections);
g_assert_false (tile->widget);
section_state = NO_SECTION;
break;
@@ -142,7 +147,10 @@ check_list_item_manager (GtkListItemManager *items,
if (tile->widget)
{
GObject *item = g_list_model_get_item (model, n_items);
- g_assert_cmpint (section_state, ==, MATCHED_SECTION);
+ if (has_sections)
+ g_assert_cmpint (section_state, ==, MATCHED_SECTION);
+ else
+ g_assert_cmpint (section_state, ==, UNMATCHED_SECTION);
g_assert_cmphex (GPOINTER_TO_SIZE (item), ==, GPOINTER_TO_SIZE (gtk_list_item_base_get_item (GTK_LIST_ITEM_BASE (tile->widget))));
g_object_unref (item);
g_assert_cmpint (n_items, ==, gtk_list_item_base_get_position (GTK_LIST_ITEM_BASE (tile->widget)));
@@ -200,7 +208,8 @@ check_list_item_manager (GtkListItemManager *items,
case GTK_LIST_TILE_HEADER:
g_assert_cmpint (section_state, ==, NO_SECTION);
g_assert_cmpint (tile->n_items, ==, 0);
- g_assert_false (tile->widget);
+ g_assert_true (has_sections);
+ g_assert_true (tile->widget);
section_state = MATCHED_SECTION;
break;
@@ -214,6 +223,7 @@ check_list_item_manager (GtkListItemManager *items,
case GTK_LIST_TILE_FOOTER:
g_assert_cmpint (section_state, ==, MATCHED_SECTION);
g_assert_cmpint (tile->n_items, ==, 0);
+ g_assert_true (has_sections);
g_assert_false (tile->widget);
section_state = NO_SECTION;
break;