[gtk/wip/otte/listview: 6/13] testsuite: Add tests for sections to filterlistmodel
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/listview: 6/13] testsuite: Add tests for sections to filterlistmodel
- Date: Mon, 28 Feb 2022 03:44:07 +0000 (UTC)
commit e5dbadb96e08ccac1171cec8e124092976fcc3d1
Author: Benjamin Otte <otte redhat com>
Date: Sat Feb 26 21:46:42 2022 +0100
testsuite: Add tests for sections to filterlistmodel
testsuite/gtk/filterlistmodel-exhaustive.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/testsuite/gtk/filterlistmodel-exhaustive.c b/testsuite/gtk/filterlistmodel-exhaustive.c
index b7366f4fb6..3407ecde01 100644
--- a/testsuite/gtk/filterlistmodel-exhaustive.c
+++ b/testsuite/gtk/filterlistmodel-exhaustive.c
@@ -43,6 +43,23 @@
} \
}G_STMT_END
+#define assert_sections_equal(model1, model2) G_STMT_START{ \
+ guint _i, _n, _start1, _end1, _start2, _end2; \
+ g_assert_cmpint (g_list_model_get_n_items (G_LIST_MODEL (model1)), ==, g_list_model_get_n_items
(G_LIST_MODEL (model2))); \
+ _n = g_list_model_get_n_items (G_LIST_MODEL (model1)); \
+ for (_i = 0; _i < _n; _i = _end1) \
+ { \
+ gtk_section_model_get_section (model1, i, &_start1, &_end1); \
+ gtk_section_model_get_section (model2, i, &_start2, &_end2); \
+ g_assert_cmpint (_start1, <, _end1); \
+ g_assert_cmpint (_start2, <, _end2); \
+ g_assert_cmpint (_start1, ==, _start2); \
+ g_assert_cmpint (_end1, ==, _end2); \
+ g_assert_cmpint (_i, ==, _start1); \
+ g_assert_cmpint (_end1, <=, _n); \
+ } \
+}G_STMT_END
+
G_GNUC_UNUSED static char *
model_to_string (GListModel *model)
{
@@ -441,6 +458,7 @@ test_model_changes (gconstpointer model_id)
{
ensure_updated ();
assert_model_equal (G_LIST_MODEL (flatten1), G_LIST_MODEL (model2));
+ assert_sections_equal (GTK_SECTION_MODEL (flatten1), GTK_SECTION_MODEL (model2));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]