diff options
author | Benjamin Otte <otte@redhat.com> | 2022-02-26 21:46:42 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2023-05-09 17:00:39 +0200 |
commit | 7856c52882b256f89eec09a313dec3899c50a049 (patch) | |
tree | cd70b2bd73d1234a5a7432e85a8e3f7b4cba2096 /testsuite | |
parent | 568023e6e63c2a9489efb2aa20389798524a3891 (diff) | |
download | gtk+-7856c52882b256f89eec09a313dec3899c50a049.tar.gz |
testsuite: Add tests for sections to filterlistmodel
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/gtk/filterlistmodel-exhaustive.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/gtk/filterlistmodel-exhaustive.c b/testsuite/gtk/filterlistmodel-exhaustive.c index 084f1d301d..2af32072f5 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) { @@ -469,6 +486,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)); } } |