static void scroll_both_realize (ScrollFixture *fixture, GtkTreePath *path, gboolean use_align, gdouble row_align) { GtkTreePath *end; gtk_widget_show_all (fixture->window); /* Scroll to end */ end = gtk_tree_path_new_from_indices (999, -1); gtk_tree_view_set_cursor (GTK_TREE_VIEW (fixture->tree_view), end, NULL, FALSE); gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (fixture->tree_view), end, NULL, use_align, row_align, 0.0); gtk_tree_path_free (end); while (gtk_events_pending ()) gtk_main_iteration (); /* Scroll to final position */ gtk_tree_view_set_cursor (GTK_TREE_VIEW (fixture->tree_view), path, NULL, FALSE); gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (fixture->tree_view), path, NULL, use_align, row_align, 0.0); ensure_layout (); test_position (GTK_TREE_VIEW (fixture->tree_view), path, use_align, row_align); }
static void on_move_timeline_new_frame (ClutterTimeline *timeline, gint frame, AstroAppview *view) { g_return_if_fail (ASTRO_IS_APPVIEW (view)); ensure_layout (view); }
static void scroll_new_row (ScrollFixture *fixture, gconstpointer test_data) { GtkTreeIter scroll_iter; GtkTreePath *scroll_path; GtkTreeModel *model; GList *renderers; GtkTreeViewColumn *column; GtkWidget *editable; /* The aim of this test is creating a new row at several places, * and immediately put the cursor on it. TreeView should correctly * scroll to the row and show the editable widget. * * See #81627. */ g_test_bug ("81627"); gtk_widget_show_all (fixture->window); while (gtk_events_pending ()) gtk_main_iteration (); /* Create the new row and scroll to it */ model = gtk_tree_view_get_model (GTK_TREE_VIEW (fixture->tree_view)); create_new_row (GTK_LIST_STORE (model), GPOINTER_TO_INT (test_data), &scroll_iter); /* Set up a signal handler to acquire the editable widget */ column = gtk_tree_view_get_column (GTK_TREE_VIEW (fixture->tree_view), 0); renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); g_signal_connect (G_OBJECT (renderers->data), "editing-started", G_CALLBACK (scroll_new_row_editing_started), &editable); /* Now set the cursor on the path and start editing */ scroll_path = gtk_tree_model_get_path (model, &scroll_iter); gtk_tree_view_set_cursor (GTK_TREE_VIEW (fixture->tree_view), scroll_path, column, TRUE); ensure_layout (); /* Test position */ test_position (GTK_TREE_VIEW (fixture->tree_view), scroll_path, FALSE, 0.0); test_editable_position (fixture->tree_view, editable, scroll_path); gtk_tree_path_free (scroll_path); }
static void scroll_new_row_tree (ScrollFixture *fixture, gconstpointer test_data) { GtkTreeModel *model; GtkAdjustment *vadjustment; int i; /* The goal of this test is to append new rows at the end of a tree * store and immediately scroll to them. If there is a parent * node with a couple of childs in the "area above" to explore, * this used to lead to unexpected results due to a bug. * * This issue has been reported by Miroslav Rajcic on * gtk-app-devel-list: * http://mail.gnome.org/archives/gtk-app-devel-list/2008-December/msg00068.html */ gtk_widget_show_all (fixture->window); gtk_tree_view_expand_all (GTK_TREE_VIEW (fixture->tree_view)); while (gtk_events_pending ()) gtk_main_iteration (); model = gtk_tree_view_get_model (GTK_TREE_VIEW (fixture->tree_view)); vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (fixture->tree_view)); for (i = 0; i < 5; i++) { GtkTreeIter scroll_iter; GtkTreePath *scroll_path; gtk_tree_store_append (GTK_TREE_STORE (model), &scroll_iter, NULL); gtk_tree_store_set (GTK_TREE_STORE (model), &scroll_iter, 0, "New node", -1); scroll_path = gtk_tree_model_get_path (model, &scroll_iter); gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (fixture->tree_view), scroll_path, NULL, FALSE, 0.0, 0.0); gtk_tree_path_free (scroll_path); ensure_layout (); /* Test position, the scroll bar must be at the end */ g_assert (gtk_adjustment_get_value (vadjustment) == gtk_adjustment_get_upper (vadjustment) - gtk_adjustment_get_page_size (vadjustment)); } }
static void scroll (ScrollFixture *fixture, GtkTreePath *path, gboolean use_align, gdouble row_align) { gtk_tree_view_set_cursor (GTK_TREE_VIEW (fixture->tree_view), path, NULL, FALSE); gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (fixture->tree_view), path, NULL, use_align, row_align, 0.0); gtk_widget_show_all (fixture->window); ensure_layout (); test_position (GTK_TREE_VIEW (fixture->tree_view), path, use_align, row_align); }
static void scroll_after_realize (ScrollFixture *fixture, GtkTreePath *path, gboolean use_align, gdouble row_align) { gtk_widget_show_all (fixture->window); while (gtk_events_pending ()) gtk_main_iteration (); gtk_tree_view_set_cursor (GTK_TREE_VIEW (fixture->tree_view), path, NULL, FALSE); gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (fixture->tree_view), path, NULL, use_align, row_align, 0.0); ensure_layout (); test_position (GTK_TREE_VIEW (fixture->tree_view), path, use_align, row_align); }