diff options
| author | Matthias Clasen <mclasen@redhat.com> | 2020-07-24 19:28:21 -0400 |
|---|---|---|
| committer | Matthias Clasen <mclasen@redhat.com> | 2020-07-24 19:28:54 -0400 |
| commit | bacaa5eb9a88cf8529c07d866a5609ce5218b8ef (patch) | |
| tree | d862676036c7ab82ab5943d2130d8acd973251b3 | |
| parent | 9a297516ba4f554b9aa3f0bc9f857ee30c194a72 (diff) | |
| download | gtk+-bacaa5eb9a88cf8529c07d866a5609ce5218b8ef.tar.gz | |
Add another sortlistmodel test
This tests the crash fix in f7b73b2e010960975.
| -rw-r--r-- | testsuite/gtk/sortlistmodel.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/gtk/sortlistmodel.c b/testsuite/gtk/sortlistmodel.c index 1da5c3d815..8f323a5fb8 100644 --- a/testsuite/gtk/sortlistmodel.c +++ b/testsuite/gtk/sortlistmodel.c @@ -518,6 +518,23 @@ test_incremental_remove (void) g_object_unref (removed); } +static void +test_out_of_bounds_access (void) +{ + GtkSortListModel *sort; + GListStore *store; + gpointer item; + + store = new_store ((guint[]) { 4, 8, 2, 6, 10, 0 }); + sort = new_model (store); + + item = g_list_model_get_item (G_LIST_MODEL (sort), GTK_INVALID_LIST_POSITION); + g_assert_null (item); + + g_object_unref (store); + g_object_unref (sort); +} + int main (int argc, char *argv[]) { @@ -537,6 +554,7 @@ main (int argc, char *argv[]) #endif g_test_add_func ("/sortlistmodel/stability", test_stability); g_test_add_func ("/sortlistmodel/incremental/remove", test_incremental_remove); + g_test_add_func ("/sortlistmodel/oob-access", test_out_of_bounds_access); return g_test_run (); } |
