diff options
author | Kristian Rietveld <kris@gtk.org> | 2010-10-14 15:07:06 +0200 |
---|---|---|
committer | Kristian Rietveld <kris@gtk.org> | 2010-10-14 16:47:00 +0200 |
commit | 4fc31dd87a91398aa92e3ecd9702ca1487352cc3 (patch) | |
tree | 142f4a5022818f25fb9c2d300e7ec23753b95404 | |
parent | 51820d3e3413ff369a766ca6d420446884c9e799 (diff) | |
download | gtk+-4fc31dd87a91398aa92e3ecd9702ca1487352cc3.tar.gz |
Add test for bug 163214
-rw-r--r-- | gtk/tests/treeview-scrolling.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/gtk/tests/treeview-scrolling.c b/gtk/tests/treeview-scrolling.c index e81b9dfdb2..ade22289ad 100644 --- a/gtk/tests/treeview-scrolling.c +++ b/gtk/tests/treeview-scrolling.c @@ -1149,6 +1149,66 @@ test_bug111500_mixed (ScrollFixture *fixture, gtk_tree_path_free (path); } +/* Test for GNOME bugzilla bug 163214. Invalidate a couple of rows, + * then scroll to one of these. + */ +static void +test_bug163214 (ScrollFixture *fixture, + gconstpointer test_data) +{ + int i; + GtkListStore *store; + GtkTreePath *path; + + g_test_bug ("163214"); + + gtk_widget_show_all (fixture->window); + + /* Make sure all events have been processed and the window + * is visible. + */ + while (gtk_events_pending ()) + gtk_main_iteration (); + + store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fixture->tree_view))); + + /* Invalidate a page of rows */ + for (i = 100; i < 110; i++) { + GtkTreeIter iter; + + gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter, + NULL, i); + gtk_list_store_set (store, &iter, 0, "Row", -1); + } + + /* Then scroll to that page. */ + path = gtk_tree_path_new_from_indices (105, -1); + scroll (fixture, path, TRUE, 0.5); + gtk_tree_path_free (path); + + /* Make sure all events have been processed and the window + * is visible. + */ + while (gtk_events_pending ()) + gtk_main_iteration (); + + store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fixture->tree_view))); + + /* Invalidate a page of rows */ + for (i = 300; i < 310; i++) { + GtkTreeIter iter; + + gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter, + NULL, i); + gtk_list_store_set (store, &iter, 0, "Row", -1); + } + + /* Then scroll to the first row */ + path = gtk_tree_path_new_from_indices (0, -1); + scroll (fixture, path, TRUE, 0.5); + gtk_tree_path_free (path); +} + /* Infrastructure for automatically adding tests */ enum { @@ -1440,6 +1500,10 @@ main (int argc, char **argv) ScrollFixture, NULL, scroll_fixture_mixed_tree_setup, test_bug111500_mixed, scroll_fixture_teardown); + g_test_add ("/TreeView/scrolling/specific/bug-163214", + ScrollFixture, NULL, + scroll_fixture_constant_setup, test_bug163214, + scroll_fixture_teardown); return g_test_run (); } |