&path, NULL) == FALSE);
}
+static void
+test_select_collapsed_row (void)
+{
+ GtkTreeIter child, parent;
+ GtkTreePath *path;
+ GtkTreeStore *tree_store;
+ GtkTreeSelection *selection;
+ GtkWidget *view;
+
+ /* Reported by Michael Natterer */
+ tree_store = gtk_tree_store_new (1, G_TYPE_STRING);
+ view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (tree_store));
+
+ gtk_tree_store_insert_with_values (tree_store, &parent, NULL, 0,
+ 0, "Parent",
+ -1);
+
+ gtk_tree_store_insert_with_values (tree_store, &child, &parent, 0,
+ 0, "Child",
+ -1);
+ gtk_tree_store_insert_with_values (tree_store, &child, &parent, 0,
+ 0, "Child",
+ -1);
+
+
+ /* Try to select a child path. */
+ path = gtk_tree_path_new_from_indices (0, 1, -1);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, NULL, FALSE);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+
+ /* Check that the parent is not selected. */
+ gtk_tree_path_up (path);
+ g_return_if_fail (gtk_tree_selection_path_is_selected (selection, path) == FALSE);
+
+ /* Nothing should be selected at this point. */
+ g_return_if_fail (gtk_tree_selection_count_selected_rows (selection) == 0);
+
+ /* Check that selection really still works. */
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, NULL, FALSE);
+ g_return_if_fail (gtk_tree_selection_path_is_selected (selection, path) == TRUE);
+ g_return_if_fail (gtk_tree_selection_count_selected_rows (selection) == 1);
+
+ /* Expand and select child node now. */
+ gtk_tree_path_append_index (path, 1);
+ gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
+
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, NULL, FALSE);
+ g_return_if_fail (gtk_tree_selection_path_is_selected (selection, path) == TRUE);
+ g_return_if_fail (gtk_tree_selection_count_selected_rows (selection) == 1);
+
+ gtk_tree_path_free (path);
+}
+
int
main (int argc,
char **argv)
g_test_add_func ("/TreeView/cursor/bug-546005", test_bug_546005);
g_test_add_func ("/TreeView/cursor/bug-539377", test_bug_539377);
+ g_test_add_func ("/TreeView/cursor/select-collapsed_row",
+ test_select_collapsed_row);
return g_test_run ();
}