1 /* Extensive GtkTreeModelFilter tests.
2 * Copyright (C) 2009 Kristian Rietveld <kris@gtk.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
24 * - Proper coverage checking to see if the unit tests cover
26 * - Verify if the ref counting is done properly for both the
27 * normal ref_count and the zero_ref_count. One way to test
28 * this area is by collapsing/expanding branches on the view
29 * that is connected to the filter model.
30 * - Check if the iterator stamp is incremented at the correct times.
38 #define LEVEL_LENGTH 5
41 create_tree_store_set_values (GtkTreeStore *store,
48 path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), iter);
49 path_string = gtk_tree_path_to_string (path);
51 gtk_tree_store_set (store, iter,
56 gtk_tree_path_free (path);
61 create_tree_store_recurse (int depth,
68 for (i = 0; i < LEVEL_LENGTH; i++)
72 gtk_tree_store_insert (store, &iter, parent, i);
73 create_tree_store_set_values (store, &iter, visible);
76 create_tree_store_recurse (depth - 1, store, &iter, visible);
81 create_tree_store (int depth,
86 store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN);
88 create_tree_store_recurse (depth, store, NULL, visible);
102 ROW_HAS_CHILD_TOGGLED,
109 signal_name_to_string (SignalName signal)
114 return "row-inserted";
117 return "row-deleted";
120 return "row-changed";
122 case ROW_HAS_CHILD_TOGGLED:
123 return "row-has-child-toggled";
126 return "rows-reordered";
145 signal_new (SignalName signal, GtkTreePath *path)
149 s = g_new0 (Signal, 1);
151 s->path = gtk_tree_path_copy (path);
157 signal_free (Signal *s)
160 gtk_tree_path_free (s->path);
169 GtkTreeModel *client;
170 gulong signal_ids[LAST_SIGNAL];
176 signal_monitor_generic_handler (SignalMonitor *m,
183 if (g_queue_is_empty (m->queue))
187 path_str = gtk_tree_path_to_string (path);
188 g_error ("Signal queue empty, got signal %s path %s\n",
189 signal_name_to_string (signal), path_str);
192 g_assert_not_reached ();
195 if (m->client != model)
197 g_error ("Model mismatch; expected %p, got %p\n",
199 g_assert_not_reached ();
202 s = g_queue_peek_tail (m->queue);
205 /* For debugging: output signals that are coming in. Leaks memory. */
206 g_print ("signal=%s path=%s\n", signal_name_to_string (signal),
207 gtk_tree_path_to_string (path));
210 if (s->signal != signal
211 || gtk_tree_path_compare (s->path, path) != 0)
213 gchar *path_str, *s_path_str;
215 s_path_str = gtk_tree_path_to_string (s->path);
216 path_str = gtk_tree_path_to_string (path);
218 g_error ("Signals don't match; expected signal %s path %s, got signal %s path %s\n",
219 signal_name_to_string (s->signal), s_path_str,
220 signal_name_to_string (signal), path_str);
225 g_assert_not_reached ();
228 s = g_queue_pop_tail (m->queue);
234 signal_monitor_row_inserted (GtkTreeModel *model,
239 signal_monitor_generic_handler (data, ROW_INSERTED,
244 signal_monitor_row_deleted (GtkTreeModel *model,
248 signal_monitor_generic_handler (data, ROW_DELETED,
253 signal_monitor_row_changed (GtkTreeModel *model,
258 signal_monitor_generic_handler (data, ROW_CHANGED,
263 signal_monitor_row_has_child_toggled (GtkTreeModel *model,
268 signal_monitor_generic_handler (data, ROW_HAS_CHILD_TOGGLED,
273 signal_monitor_rows_reordered (GtkTreeModel *model,
279 signal_monitor_generic_handler (data, ROWS_REORDERED,
283 static SignalMonitor *
284 signal_monitor_new (GtkTreeModel *client)
288 m = g_new0 (SignalMonitor, 1);
289 m->client = g_object_ref (client);
290 m->queue = g_queue_new ();
292 m->signal_ids[ROW_INSERTED] = g_signal_connect (client,
294 G_CALLBACK (signal_monitor_row_inserted),
296 m->signal_ids[ROW_DELETED] = g_signal_connect (client,
298 G_CALLBACK (signal_monitor_row_deleted),
300 m->signal_ids[ROW_CHANGED] = g_signal_connect (client,
302 G_CALLBACK (signal_monitor_row_changed),
304 m->signal_ids[ROW_HAS_CHILD_TOGGLED] = g_signal_connect (client,
305 "row-has-child-toggled",
306 G_CALLBACK (signal_monitor_row_has_child_toggled),
308 m->signal_ids[ROWS_REORDERED] = g_signal_connect (client,
310 G_CALLBACK (signal_monitor_rows_reordered),
317 signal_monitor_free (SignalMonitor *m)
321 for (i = 0; i < LAST_SIGNAL; i++)
322 g_signal_handler_disconnect (m->client, m->signal_ids[i]);
324 g_object_unref (m->client);
327 g_queue_free (m->queue);
333 signal_monitor_assert_is_empty (SignalMonitor *m)
335 g_assert (g_queue_is_empty (m->queue));
339 signal_monitor_append_signal_path (SignalMonitor *m,
345 s = signal_new (signal, path);
346 g_queue_push_head (m->queue, s);
350 signal_monitor_append_signal (SignalMonitor *m,
352 const gchar *path_string)
357 path = gtk_tree_path_new_from_string (path_string);
359 s = signal_new (signal, path);
360 g_queue_push_head (m->queue, s);
362 gtk_tree_path_free (path);
371 GtkWidget *tree_view;
374 GtkTreeModelFilter *filter;
376 SignalMonitor *monitor;
378 guint block_signals : 1;
383 filter_test_store_signal (FilterTest *fixture)
385 if (fixture->block_signals)
386 g_signal_stop_emission_by_name (fixture->store, "row-changed");
391 filter_test_setup_generic (FilterTest *fixture,
392 gconstpointer test_data,
397 const GtkTreePath *vroot = test_data;
398 GtkTreeModel *filter;
400 fixture->store = create_tree_store (depth, !empty);
402 g_signal_connect_swapped (fixture->store, "row-changed",
403 G_CALLBACK (filter_test_store_signal), fixture);
405 /* Please forgive me for casting const away. */
406 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (fixture->store),
407 (GtkTreePath *)vroot);
408 fixture->filter = GTK_TREE_MODEL_FILTER (filter);
411 gtk_tree_model_filter_set_visible_column (fixture->filter, 1);
413 /* We need a tree view that's listening to get ref counting from that
416 fixture->tree_view = gtk_tree_view_new_with_model (filter);
418 fixture->monitor = signal_monitor_new (filter);
422 filter_test_setup (FilterTest *fixture,
423 gconstpointer test_data)
425 filter_test_setup_generic (fixture, test_data, 3, FALSE, FALSE);
429 filter_test_setup_empty (FilterTest *fixture,
430 gconstpointer test_data)
432 filter_test_setup_generic (fixture, test_data, 3, TRUE, FALSE);
436 filter_test_setup_unfiltered (FilterTest *fixture,
437 gconstpointer test_data)
439 filter_test_setup_generic (fixture, test_data, 3, FALSE, TRUE);
443 filter_test_setup_empty_unfiltered (FilterTest *fixture,
444 gconstpointer test_data)
446 filter_test_setup_generic (fixture, test_data, 3, TRUE, TRUE);
450 strip_virtual_root (GtkTreePath *path,
451 GtkTreePath *root_path)
453 GtkTreePath *real_path;
458 int depth = gtk_tree_path_get_depth (path);
459 int root_depth = gtk_tree_path_get_depth (root_path);
461 real_path = gtk_tree_path_new ();
463 for (j = 0; j < depth - root_depth; j++)
464 gtk_tree_path_append_index (real_path,
465 gtk_tree_path_get_indices (path)[root_depth + j]);
468 real_path = gtk_tree_path_copy (path);
474 filter_test_append_refilter_signals_recurse (FilterTest *fixture,
475 GtkTreePath *store_path,
476 GtkTreePath *filter_path,
478 GtkTreePath *root_path)
481 int rows_deleted = 0;
484 gtk_tree_path_down (store_path);
485 gtk_tree_path_down (filter_path);
487 gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store),
490 for (i = 0; i < LEVEL_LENGTH; i++)
493 GtkTreePath *real_path;
495 gtk_tree_model_get (GTK_TREE_MODEL (fixture->store), &iter,
500 (!gtk_tree_path_is_descendant (store_path, root_path)
501 || !gtk_tree_path_compare (store_path, root_path)))
503 if (!gtk_tree_path_compare (store_path, root_path))
506 && gtk_tree_model_iter_has_child (GTK_TREE_MODEL (fixture->store),
509 GtkTreePath *store_copy;
510 GtkTreePath *filter_copy;
512 store_copy = gtk_tree_path_copy (store_path);
513 filter_copy = gtk_tree_path_copy (filter_path);
514 filter_test_append_refilter_signals_recurse (fixture,
519 gtk_tree_path_free (store_copy);
520 gtk_tree_path_free (filter_copy);
524 gtk_tree_path_next (store_path);
525 gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &iter);
528 gtk_tree_path_next (filter_path);
533 real_path = strip_virtual_root (filter_path, root_path);
537 /* This row will be inserted */
538 signal_monitor_append_signal_path (fixture->monitor, ROW_CHANGED,
540 signal_monitor_append_signal_path (fixture->monitor,
541 ROW_HAS_CHILD_TOGGLED,
545 && gtk_tree_model_iter_has_child (GTK_TREE_MODEL (fixture->store),
548 GtkTreePath *store_copy;
549 GtkTreePath *filter_copy;
551 store_copy = gtk_tree_path_copy (store_path);
552 filter_copy = gtk_tree_path_copy (filter_path);
553 filter_test_append_refilter_signals_recurse (fixture,
558 gtk_tree_path_free (store_copy);
559 gtk_tree_path_free (filter_copy);
562 gtk_tree_path_next (filter_path);
566 /* This row will be deleted */
568 signal_monitor_append_signal_path (fixture->monitor, ROW_DELETED,
572 gtk_tree_path_free (real_path);
574 gtk_tree_path_next (store_path);
575 gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &iter);
578 if (rows_deleted == LEVEL_LENGTH
579 && gtk_tree_path_get_depth (filter_path) > 1)
581 GtkTreePath *real_path;
583 gtk_tree_path_up (store_path);
584 gtk_tree_path_up (filter_path);
586 /* A row-has-child-toggled will be emitted on the parent */
589 && gtk_tree_path_is_descendant (store_path, root_path)
590 && gtk_tree_path_compare (store_path, root_path)))
592 real_path = strip_virtual_root (filter_path, root_path);
593 signal_monitor_append_signal_path (fixture->monitor,
594 ROW_HAS_CHILD_TOGGLED,
597 gtk_tree_path_free (real_path);
603 filter_test_append_refilter_signals (FilterTest *fixture,
606 /* A special function that walks the tree store like the
607 * model validation functions below.
610 GtkTreePath *filter_path;
612 path = gtk_tree_path_new ();
613 filter_path = gtk_tree_path_new ();
614 filter_test_append_refilter_signals_recurse (fixture,
619 gtk_tree_path_free (path);
620 gtk_tree_path_free (filter_path);
624 filter_test_append_refilter_signals_with_vroot (FilterTest *fixture,
626 GtkTreePath *root_path)
628 /* A special function that walks the tree store like the
629 * model validation functions below.
632 GtkTreePath *filter_path;
634 path = gtk_tree_path_new ();
635 filter_path = gtk_tree_path_new ();
636 filter_test_append_refilter_signals_recurse (fixture,
641 gtk_tree_path_free (path);
642 gtk_tree_path_free (filter_path);
646 filter_test_enable_filter (FilterTest *fixture)
648 gtk_tree_model_filter_set_visible_column (fixture->filter, 1);
649 gtk_tree_model_filter_refilter (fixture->filter);
653 filter_test_block_signals (FilterTest *fixture)
655 fixture->block_signals = TRUE;
659 filter_test_unblock_signals (FilterTest *fixture)
661 fixture->block_signals = FALSE;
665 filter_test_teardown (FilterTest *fixture,
666 gconstpointer test_data)
668 signal_monitor_free (fixture->monitor);
670 g_object_unref (fixture->filter);
671 g_object_unref (fixture->store);
675 * Model structure validation
679 check_filter_model_recurse (FilterTest *fixture,
680 GtkTreePath *store_parent_path,
681 GtkTreePath *filter_parent_path)
684 GtkTreeIter store_iter;
685 GtkTreeIter filter_iter;
686 gboolean store_has_next, filter_has_next;
688 gtk_tree_path_down (store_parent_path);
689 gtk_tree_path_down (filter_parent_path);
691 store_has_next = gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store),
692 &store_iter, store_parent_path);
693 filter_has_next = gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->filter),
694 &filter_iter, filter_parent_path);
696 for (i = 0; i < LEVEL_LENGTH; i++)
700 g_return_if_fail (store_has_next == TRUE);
702 gtk_tree_model_get (GTK_TREE_MODEL (fixture->store),
710 gchar *filter_str, *store_str;
712 g_return_if_fail (filter_has_next == TRUE);
715 tmp = gtk_tree_model_get_path (GTK_TREE_MODEL (fixture->filter),
717 g_return_if_fail (gtk_tree_path_compare (tmp, filter_parent_path) == 0);
719 /* Verify model content */
720 gtk_tree_model_get (GTK_TREE_MODEL (fixture->store),
724 gtk_tree_model_get (GTK_TREE_MODEL (fixture->filter),
729 g_return_if_fail (g_strcmp0 (store_str, filter_str) == 0);
734 if (gtk_tree_model_iter_has_child (GTK_TREE_MODEL (fixture->filter),
737 g_return_if_fail (gtk_tree_model_iter_has_child (GTK_TREE_MODEL (fixture->store), &store_iter));
739 check_filter_model_recurse (fixture,
740 gtk_tree_path_copy (store_parent_path),
744 gtk_tree_path_next (filter_parent_path);
745 filter_has_next = gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->filter), &filter_iter);
748 gtk_tree_path_next (store_parent_path);
749 store_has_next = gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &store_iter);
752 /* Both models should have no more content! */
753 g_return_if_fail (store_has_next == FALSE);
754 g_return_if_fail (filter_has_next == FALSE);
756 gtk_tree_path_free (store_parent_path);
757 gtk_tree_path_free (filter_parent_path);
761 check_filter_model (FilterTest *fixture)
765 if (fixture->monitor)
766 signal_monitor_assert_is_empty (fixture->monitor);
768 path = gtk_tree_path_new ();
770 check_filter_model_recurse (fixture, path, gtk_tree_path_copy (path));
774 check_filter_model_with_root (FilterTest *fixture,
777 if (fixture->monitor)
778 signal_monitor_assert_is_empty (fixture->monitor);
780 check_filter_model_recurse (fixture,
781 gtk_tree_path_copy (path),
782 gtk_tree_path_new ());
788 check_level_length (GtkTreeModelFilter *filter,
790 const int expected_length)
796 model_length = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (filter), NULL);
797 g_assert_cmpint (model_length, ==, expected_length);
802 gboolean retrieved_iter = FALSE;
805 retrieved_iter = gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (filter),
807 g_return_if_fail (retrieved_iter);
808 model_length = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (filter), &iter);
809 g_assert_cmpint (model_length, ==, expected_length);
814 set_path_visibility (FilterTest *fixture,
818 GtkTreeIter store_iter;
820 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store),
822 gtk_tree_store_set (fixture->store, &store_iter,
829 insert_path_with_visibility (FilterTest *fixture,
830 const gchar *path_string,
835 GtkTreeIter parent, iter;
837 path = gtk_tree_path_new_from_string (path_string);
838 position = gtk_tree_path_get_indices (path)[gtk_tree_path_get_depth (path)];
839 gtk_tree_path_up (path);
841 if (gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store), &parent, path))
843 gtk_tree_store_insert (fixture->store, &iter, &parent, position);
844 create_tree_store_set_values (fixture->store, &iter, visible);
846 gtk_tree_path_free (path);
855 verify_test_suite (FilterTest *fixture,
856 gconstpointer user_data)
858 check_filter_model (fixture);
862 verify_test_suite_vroot (FilterTest *fixture,
863 gconstpointer user_data)
865 check_filter_model_with_root (fixture, (GtkTreePath *)user_data);
870 filled_hide_root_level (FilterTest *fixture,
871 gconstpointer user_data)
873 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "2");
874 set_path_visibility (fixture, "2", FALSE);
875 check_filter_model (fixture);
876 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 1);
878 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
879 set_path_visibility (fixture, "0", FALSE);
880 check_filter_model (fixture);
881 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 2);
883 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "2");
884 set_path_visibility (fixture, "4", FALSE);
885 check_filter_model (fixture);
886 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 3);
890 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
891 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
893 set_path_visibility (fixture, "1", FALSE);
894 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 4);
896 set_path_visibility (fixture, "3", FALSE);
897 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 5);
899 check_filter_model (fixture);
902 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
903 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
904 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "1");
905 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "1");
907 set_path_visibility (fixture, "1", TRUE);
908 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 4);
910 set_path_visibility (fixture, "3", TRUE);
911 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 3);
913 check_filter_model (fixture);
917 filled_hide_child_levels (FilterTest *fixture,
918 gconstpointer user_data)
920 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0:2");
921 set_path_visibility (fixture, "0:2", FALSE);
922 check_filter_model (fixture);
923 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
924 check_level_length (fixture->filter, "0", LEVEL_LENGTH - 1);
926 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0:3");
927 set_path_visibility (fixture, "0:4", FALSE);
928 check_filter_model (fixture);
929 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
930 check_level_length (fixture->filter, "0", LEVEL_LENGTH - 2);
932 set_path_visibility (fixture, "0:4:3", FALSE);
933 check_filter_model (fixture);
934 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
935 check_level_length (fixture->filter, "0", LEVEL_LENGTH - 2);
937 set_path_visibility (fixture, "0:4:0", FALSE);
938 set_path_visibility (fixture, "0:4:1", FALSE);
939 set_path_visibility (fixture, "0:4:2", FALSE);
940 set_path_visibility (fixture, "0:4:4", FALSE);
941 check_filter_model (fixture);
942 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
943 check_level_length (fixture->filter, "0", LEVEL_LENGTH - 2);
945 /* Since "0:2" is hidden, "0:4" must be "0:3" in the filter model */
946 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0:3");
947 /* FIXME: Actually, the filter model should not be emitted the
948 * row-has-child-toggled signal here. *However* an extraneous emission
949 * of this signal does not hurt and is allowed.
951 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0:3");
952 set_path_visibility (fixture, "0:4", TRUE);
953 check_filter_model (fixture);
954 check_level_length (fixture->filter, "0:3", 0);
956 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0:2");
957 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0:2");
958 set_path_visibility (fixture, "0:2", TRUE);
959 check_filter_model (fixture);
960 check_level_length (fixture->filter, "0:2", LEVEL_LENGTH);
961 check_level_length (fixture->filter, "0:3", LEVEL_LENGTH);
962 check_level_length (fixture->filter, "0:4", 0);
964 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0:4:0");
965 /* Once 0:4:0 got inserted, 0:4 became a parent */
966 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0:4");
967 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0:4:0");
968 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0:4:1");
969 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0:4:1");
971 set_path_visibility (fixture, "0:4:2", TRUE);
972 set_path_visibility (fixture, "0:4:4", TRUE);
973 signal_monitor_assert_is_empty (fixture->monitor);
974 check_level_length (fixture->filter, "0:4", 2);
979 filled_vroot_hide_root_level (FilterTest *fixture,
980 gconstpointer user_data)
982 GtkTreePath *path = (GtkTreePath *)user_data;
984 /* These changes do not affect the filter's root level */
985 set_path_visibility (fixture, "0", FALSE);
986 check_filter_model_with_root (fixture, path);
987 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
988 check_level_length (fixture->filter, "0", LEVEL_LENGTH);
990 set_path_visibility (fixture, "4", FALSE);
991 check_filter_model_with_root (fixture, path);
992 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
993 check_level_length (fixture->filter, "0", LEVEL_LENGTH);
995 /* Even though we set the virtual root parent node to FALSE,
996 * the virtual root contents remain.
998 set_path_visibility (fixture, "2", FALSE);
999 check_filter_model_with_root (fixture, path);
1000 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1001 check_level_length (fixture->filter, "0", LEVEL_LENGTH);
1004 set_path_visibility (fixture, "1", FALSE);
1005 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1006 check_level_length (fixture->filter, "0", LEVEL_LENGTH);
1008 set_path_visibility (fixture, "3", FALSE);
1009 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1010 check_level_length (fixture->filter, "0", LEVEL_LENGTH);
1012 check_filter_model_with_root (fixture, path);
1015 set_path_visibility (fixture, "2", TRUE);
1016 check_filter_model_with_root (fixture, path);
1017 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1018 check_level_length (fixture->filter, "0", LEVEL_LENGTH);
1020 set_path_visibility (fixture, "1", TRUE);
1021 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1022 check_level_length (fixture->filter, "0", LEVEL_LENGTH);
1024 set_path_visibility (fixture, "3", TRUE);
1025 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1026 check_level_length (fixture->filter, "0", LEVEL_LENGTH);
1028 check_filter_model_with_root (fixture, path);
1030 /* Now test changes in the virtual root level */
1031 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "2");
1032 set_path_visibility (fixture, "2:2", FALSE);
1033 check_filter_model_with_root (fixture, path);
1034 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 1);
1036 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "3");
1037 set_path_visibility (fixture, "2:4", FALSE);
1038 check_filter_model_with_root (fixture, path);
1039 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 2);
1041 set_path_visibility (fixture, "1:4", FALSE);
1042 check_filter_model_with_root (fixture, path);
1043 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 2);
1045 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "3");
1046 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "3");
1047 set_path_visibility (fixture, "2:4", TRUE);
1048 check_filter_model_with_root (fixture, path);
1049 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 1);
1051 set_path_visibility (fixture, "2", FALSE);
1052 check_filter_model_with_root (fixture, path);
1053 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 1);
1055 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
1056 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
1057 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
1058 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
1059 set_path_visibility (fixture, "2:0", FALSE);
1060 set_path_visibility (fixture, "2:1", FALSE);
1061 set_path_visibility (fixture, "2:2", FALSE);
1062 set_path_visibility (fixture, "2:3", FALSE);
1063 set_path_visibility (fixture, "2:4", FALSE);
1064 check_filter_model_with_root (fixture, path);
1065 check_level_length (fixture->filter, NULL, 0);
1067 set_path_visibility (fixture, "2", TRUE);
1068 check_filter_model_with_root (fixture, path);
1069 check_level_length (fixture->filter, NULL, 0);
1071 set_path_visibility (fixture, "1:4", FALSE);
1072 check_filter_model_with_root (fixture, path);
1073 check_level_length (fixture->filter, NULL, 0);
1075 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1076 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1077 set_path_visibility (fixture, "2:4", TRUE);
1078 check_filter_model_with_root (fixture, path);
1079 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 4);
1081 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
1082 set_path_visibility (fixture, "2:4", FALSE);
1083 check_filter_model_with_root (fixture, path);
1084 check_level_length (fixture->filter, NULL, 0);
1086 set_path_visibility (fixture, "2", FALSE);
1087 check_filter_model_with_root (fixture, path);
1088 check_level_length (fixture->filter, NULL, 0);
1090 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1091 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1092 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "1");
1093 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "1");
1094 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "2");
1095 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2");
1096 set_path_visibility (fixture, "2:0", TRUE);
1097 set_path_visibility (fixture, "2:1", TRUE);
1098 set_path_visibility (fixture, "2:2", TRUE);
1099 check_filter_model_with_root (fixture, path);
1100 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 2);
1102 set_path_visibility (fixture, "2", TRUE);
1103 check_filter_model_with_root (fixture, path);
1104 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 2);
1108 filled_vroot_hide_child_levels (FilterTest *fixture,
1109 gconstpointer user_data)
1111 GtkTreePath *path = (GtkTreePath *)user_data;
1113 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0:2");
1114 set_path_visibility (fixture, "2:0:2", FALSE);
1115 check_filter_model_with_root (fixture, path);
1116 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1117 check_level_length (fixture->filter, "0", LEVEL_LENGTH - 1);
1119 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0:3");
1120 set_path_visibility (fixture, "2:0:4", FALSE);
1121 check_filter_model_with_root (fixture, path);
1122 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1123 check_level_length (fixture->filter, "0", LEVEL_LENGTH - 2);
1125 set_path_visibility (fixture, "2:0:4:3", FALSE);
1126 check_filter_model_with_root (fixture, path);
1127 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1128 check_level_length (fixture->filter, "0", LEVEL_LENGTH - 2);
1130 set_path_visibility (fixture, "2:0:4:0", FALSE);
1131 set_path_visibility (fixture, "2:0:4:1", FALSE);
1132 set_path_visibility (fixture, "2:0:4:2", FALSE);
1133 set_path_visibility (fixture, "2:0:4:4", FALSE);
1134 check_filter_model_with_root (fixture, path);
1135 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1136 check_level_length (fixture->filter, "0", LEVEL_LENGTH - 2);
1138 /* Since "0:2" is hidden, "0:4" must be "0:3" in the filter model */
1139 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0:3");
1140 /* FIXME: Actually, the filter model should not be emitted the
1141 * row-has-child-toggled signal here. *However* an extraneous emission
1142 * of this signal does not hurt and is allowed.
1144 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0:3");
1145 set_path_visibility (fixture, "2:0:4", TRUE);
1146 check_filter_model_with_root (fixture, path);
1147 check_level_length (fixture->filter, "0:3", 0);
1149 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0:2");
1150 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0:2");
1151 set_path_visibility (fixture, "2:0:2", TRUE);
1152 check_filter_model_with_root (fixture, path);
1153 check_level_length (fixture->filter, "0:2", LEVEL_LENGTH);
1154 check_level_length (fixture->filter, "0:3", LEVEL_LENGTH);
1155 check_level_length (fixture->filter, "0:4", 0);
1157 /* FIXME: Inconsistency! For the non-vroot case we also receive two
1158 * row-has-child-toggled signals here.
1160 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0:4:0");
1161 /* Once 0:4:0 got inserted, 0:4 became a parent */
1162 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0:4");
1163 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0:4:1");
1164 set_path_visibility (fixture, "2:0:4:2", TRUE);
1165 set_path_visibility (fixture, "2:0:4:4", TRUE);
1166 check_level_length (fixture->filter, "0:4", 2);
1171 empty_show_nodes (FilterTest *fixture,
1172 gconstpointer user_data)
1174 check_filter_model (fixture);
1175 check_level_length (fixture->filter, NULL, 0);
1177 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1178 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1179 set_path_visibility (fixture, "3", TRUE);
1180 check_filter_model (fixture);
1181 check_level_length (fixture->filter, NULL, 1);
1182 check_level_length (fixture->filter, "0", 0);
1184 set_path_visibility (fixture, "3:2:2", TRUE);
1185 check_filter_model (fixture);
1186 check_level_length (fixture->filter, NULL, 1);
1187 check_level_length (fixture->filter, "0", 0);
1189 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0:0");
1190 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1191 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0:0");
1192 set_path_visibility (fixture, "3:2", TRUE);
1193 check_filter_model (fixture);
1194 check_level_length (fixture->filter, NULL, 1);
1195 check_level_length (fixture->filter, "0", 1);
1196 check_level_length (fixture->filter, "0:0", 1);
1197 check_level_length (fixture->filter, "0:0:0", 0);
1199 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
1200 set_path_visibility (fixture, "3", FALSE);
1201 check_filter_model (fixture);
1202 check_level_length (fixture->filter, NULL, 0);
1204 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1205 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1206 set_path_visibility (fixture, "3:2:1", TRUE);
1207 set_path_visibility (fixture, "3", TRUE);
1208 check_filter_model (fixture);
1209 check_level_length (fixture->filter, NULL, 1);
1210 check_level_length (fixture->filter, "0", 1);
1211 check_level_length (fixture->filter, "0:0", 2);
1212 check_level_length (fixture->filter, "0:0:0", 0);
1216 empty_show_multiple_nodes (FilterTest *fixture,
1217 gconstpointer user_data)
1220 GtkTreePath *changed_path;
1222 check_filter_model (fixture);
1223 check_level_length (fixture->filter, NULL, 0);
1225 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1226 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1227 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "1");
1228 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "1");
1229 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "1");
1230 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "1");
1232 /* We simulate a change in visible func condition with this. The
1233 * visibility state of multiple nodes changes at once, we emit row-changed
1234 * for these nodes (and others) after that.
1236 filter_test_block_signals (fixture);
1237 set_path_visibility (fixture, "3", TRUE);
1238 set_path_visibility (fixture, "4", TRUE);
1239 filter_test_unblock_signals (fixture);
1241 changed_path = gtk_tree_path_new ();
1242 gtk_tree_path_append_index (changed_path, 2);
1243 gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store),
1244 &iter, changed_path);
1245 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1246 changed_path, &iter);
1248 gtk_tree_path_next (changed_path);
1249 gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &iter);
1250 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1251 changed_path, &iter);
1253 gtk_tree_path_next (changed_path);
1254 gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &iter);
1255 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1256 changed_path, &iter);
1258 gtk_tree_path_free (changed_path);
1260 check_filter_model (fixture);
1261 check_level_length (fixture->filter, NULL, 2);
1262 check_level_length (fixture->filter, "0", 0);
1264 set_path_visibility (fixture, "3:2:2", TRUE);
1265 check_filter_model (fixture);
1266 check_level_length (fixture->filter, NULL, 2);
1267 check_level_length (fixture->filter, "0", 0);
1269 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0:0");
1270 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1271 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0:0");
1272 set_path_visibility (fixture, "3:2", TRUE);
1273 check_filter_model (fixture);
1274 check_level_length (fixture->filter, NULL, 2);
1275 check_level_length (fixture->filter, "0", 1);
1276 check_level_length (fixture->filter, "0:0", 1);
1277 check_level_length (fixture->filter, "0:0:0", 0);
1279 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
1280 set_path_visibility (fixture, "3", FALSE);
1281 check_filter_model (fixture);
1282 check_level_length (fixture->filter, NULL, 1);
1284 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1285 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1286 set_path_visibility (fixture, "3:2:1", TRUE);
1287 set_path_visibility (fixture, "3", TRUE);
1288 check_filter_model (fixture);
1289 check_level_length (fixture->filter, NULL, 2);
1290 check_level_length (fixture->filter, "0", 1);
1291 check_level_length (fixture->filter, "0:0", 2);
1292 check_level_length (fixture->filter, "0:0:0", 0);
1296 empty_vroot_show_nodes (FilterTest *fixture,
1297 gconstpointer user_data)
1299 GtkTreePath *path = (GtkTreePath *)user_data;
1301 check_filter_model_with_root (fixture, path);
1302 check_level_length (fixture->filter, NULL, 0);
1304 set_path_visibility (fixture, "2", TRUE);
1305 check_filter_model_with_root (fixture, path);
1306 check_level_length (fixture->filter, NULL, 0);
1308 set_path_visibility (fixture, "2:2:2", TRUE);
1309 check_filter_model_with_root (fixture, path);
1310 check_level_length (fixture->filter, NULL, 0);
1312 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1313 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1314 set_path_visibility (fixture, "2:2", TRUE);
1315 check_filter_model_with_root (fixture, path);
1316 check_level_length (fixture->filter, NULL, 1);
1317 check_level_length (fixture->filter, "0", 1);
1318 check_level_length (fixture->filter, "0:0", 0);
1320 set_path_visibility (fixture, "3", TRUE);
1321 check_filter_model_with_root (fixture, path);
1322 check_level_length (fixture->filter, NULL, 1);
1324 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
1325 set_path_visibility (fixture, "2:2", FALSE);
1326 check_filter_model_with_root (fixture, path);
1327 check_level_length (fixture->filter, NULL, 0);
1329 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1330 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1331 set_path_visibility (fixture, "2:2:1", TRUE);
1332 set_path_visibility (fixture, "2:2", TRUE);
1333 check_filter_model_with_root (fixture, path);
1334 check_level_length (fixture->filter, NULL, 1);
1335 check_level_length (fixture->filter, "0", 2);
1336 check_level_length (fixture->filter, "0:1", 0);
1340 empty_vroot_show_multiple_nodes (FilterTest *fixture,
1341 gconstpointer user_data)
1344 GtkTreePath *changed_path;
1345 GtkTreePath *path = (GtkTreePath *)user_data;
1347 check_filter_model_with_root (fixture, path);
1348 check_level_length (fixture->filter, NULL, 0);
1350 /* We simulate a change in visible func condition with this. The
1351 * visibility state of multiple nodes changes at once, we emit row-changed
1352 * for these nodes (and others) after that.
1354 filter_test_block_signals (fixture);
1355 set_path_visibility (fixture, "2", TRUE);
1356 set_path_visibility (fixture, "3", TRUE);
1357 filter_test_unblock_signals (fixture);
1359 changed_path = gtk_tree_path_new ();
1360 gtk_tree_path_append_index (changed_path, 1);
1361 gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store),
1362 &iter, changed_path);
1363 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1364 changed_path, &iter);
1366 gtk_tree_path_next (changed_path);
1367 gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &iter);
1368 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1369 changed_path, &iter);
1371 gtk_tree_path_next (changed_path);
1372 gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &iter);
1373 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1374 changed_path, &iter);
1376 gtk_tree_path_next (changed_path);
1377 gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &iter);
1378 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1379 changed_path, &iter);
1381 gtk_tree_path_free (changed_path);
1383 check_filter_model_with_root (fixture, path);
1384 check_level_length (fixture->filter, NULL, 0);
1386 set_path_visibility (fixture, "2:2:2", TRUE);
1387 check_filter_model_with_root (fixture, path);
1388 check_level_length (fixture->filter, NULL, 0);
1390 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1391 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1392 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "1");
1393 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "1");
1395 /* Again, we simulate a call to refilter */
1396 filter_test_block_signals (fixture);
1397 set_path_visibility (fixture, "2:2", TRUE);
1398 set_path_visibility (fixture, "2:3", TRUE);
1399 filter_test_unblock_signals (fixture);
1401 changed_path = gtk_tree_path_new ();
1402 gtk_tree_path_append_index (changed_path, 2);
1403 gtk_tree_path_append_index (changed_path, 1);
1404 gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store),
1405 &iter, changed_path);
1406 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1407 changed_path, &iter);
1409 gtk_tree_path_next (changed_path);
1410 gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &iter);
1411 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1412 changed_path, &iter);
1414 gtk_tree_path_next (changed_path);
1415 gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &iter);
1416 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1417 changed_path, &iter);
1419 gtk_tree_path_next (changed_path);
1420 gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store), &iter);
1421 gtk_tree_model_row_changed (GTK_TREE_MODEL (fixture->store),
1422 changed_path, &iter);
1424 gtk_tree_path_free (changed_path);
1426 check_filter_model_with_root (fixture, path);
1427 check_level_length (fixture->filter, NULL, 2);
1428 check_level_length (fixture->filter, "0", 1);
1429 check_level_length (fixture->filter, "0:0", 0);
1431 set_path_visibility (fixture, "3", TRUE);
1432 check_filter_model_with_root (fixture, path);
1433 check_level_length (fixture->filter, NULL, 2);
1435 signal_monitor_append_signal (fixture->monitor, ROW_DELETED, "0");
1436 set_path_visibility (fixture, "2:2", FALSE);
1437 check_filter_model_with_root (fixture, path);
1438 check_level_length (fixture->filter, NULL, 1);
1440 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1441 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1442 set_path_visibility (fixture, "2:2:1", TRUE);
1443 set_path_visibility (fixture, "2:2", TRUE);
1444 check_filter_model_with_root (fixture, path);
1445 check_level_length (fixture->filter, NULL, 2);
1446 check_level_length (fixture->filter, "0", 2);
1447 check_level_length (fixture->filter, "0:1", 0);
1452 unfiltered_hide_single (FilterTest *fixture,
1453 gconstpointer user_data)
1456 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2");
1457 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2");
1458 set_path_visibility (fixture, "2", FALSE);
1460 signal_monitor_assert_is_empty (fixture->monitor);
1461 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1463 /* The view only shows the root level, so the filter model only has
1464 * the first two levels cached.
1466 filter_test_append_refilter_signals (fixture, 2);
1467 filter_test_enable_filter (fixture);
1469 check_filter_model (fixture);
1470 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 1);
1474 unfiltered_hide_single_child (FilterTest *fixture,
1475 gconstpointer user_data)
1478 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2:2");
1479 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2:2");
1480 set_path_visibility (fixture, "2:2", FALSE);
1482 signal_monitor_assert_is_empty (fixture->monitor);
1483 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1484 check_level_length (fixture->filter, "2", LEVEL_LENGTH);
1486 /* The view only shows the root level, so the filter model only has
1487 * the first two levels cached.
1489 filter_test_append_refilter_signals (fixture, 2);
1490 filter_test_enable_filter (fixture);
1492 check_filter_model (fixture);
1493 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1494 check_level_length (fixture->filter, "2", LEVEL_LENGTH - 1);
1498 unfiltered_hide_single_multi_level (FilterTest *fixture,
1499 gconstpointer user_data)
1502 /* This row is not shown, so its signal is not propagated */
1503 set_path_visibility (fixture, "2:2:2", FALSE);
1505 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2:2");
1506 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2:2");
1507 set_path_visibility (fixture, "2:2", FALSE);
1509 signal_monitor_assert_is_empty (fixture->monitor);
1510 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1511 check_level_length (fixture->filter, "2", LEVEL_LENGTH);
1512 check_level_length (fixture->filter, "2:2", LEVEL_LENGTH);
1514 /* The view only shows the root level, so the filter model only has
1515 * the first two levels cached.
1517 filter_test_append_refilter_signals (fixture, 2);
1518 filter_test_enable_filter (fixture);
1520 check_filter_model (fixture);
1521 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1522 check_level_length (fixture->filter, "2", LEVEL_LENGTH - 1);
1524 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "2:2");
1525 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2:2");
1526 set_path_visibility (fixture, "2:2", TRUE);
1528 check_filter_model (fixture);
1529 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1530 check_level_length (fixture->filter, "2", LEVEL_LENGTH);
1531 check_level_length (fixture->filter, "2:2", LEVEL_LENGTH - 1);
1536 unfiltered_vroot_hide_single (FilterTest *fixture,
1537 gconstpointer user_data)
1540 GtkTreePath *path = (GtkTreePath *)user_data;
1542 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2");
1543 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2");
1544 set_path_visibility (fixture, "2:2", FALSE);
1546 signal_monitor_assert_is_empty (fixture->monitor);
1547 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1549 /* The view only shows the root level, so the filter model only has
1550 * the first two levels cached. (We add an additional level to
1551 * take the virtual root into account).
1553 filter_test_append_refilter_signals_with_vroot (fixture, 3, path);
1554 filter_test_enable_filter (fixture);
1556 check_filter_model_with_root (fixture, path);
1557 check_level_length (fixture->filter, NULL, LEVEL_LENGTH - 1);
1561 unfiltered_vroot_hide_single_child (FilterTest *fixture,
1562 gconstpointer user_data)
1565 GtkTreePath *path = (GtkTreePath *)user_data;
1567 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2:2");
1568 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2:2");
1569 set_path_visibility (fixture, "2:2:2", FALSE);
1571 signal_monitor_assert_is_empty (fixture->monitor);
1572 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1573 check_level_length (fixture->filter, "2", LEVEL_LENGTH);
1575 /* The view only shows the root level, so the filter model only has
1576 * the first two levels cached. (We add an additional level to take
1577 * the virtual root into account).
1579 filter_test_append_refilter_signals_with_vroot (fixture, 3, path);
1580 filter_test_enable_filter (fixture);
1582 check_filter_model_with_root (fixture, path);
1583 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1584 check_level_length (fixture->filter, "2", LEVEL_LENGTH - 1);
1588 unfiltered_vroot_hide_single_multi_level (FilterTest *fixture,
1589 gconstpointer user_data)
1592 GtkTreePath *path = (GtkTreePath *)user_data;
1594 /* This row is not shown, so its signal is not propagated */
1595 set_path_visibility (fixture, "2:2:2:2", FALSE);
1597 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2:2");
1598 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2:2");
1599 set_path_visibility (fixture, "2:2:2", FALSE);
1601 signal_monitor_assert_is_empty (fixture->monitor);
1602 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1603 check_level_length (fixture->filter, "2", LEVEL_LENGTH);
1604 check_level_length (fixture->filter, "2:2", LEVEL_LENGTH);
1606 /* The view only shows the root level, so the filter model only has
1607 * the first two levels cached.
1609 filter_test_append_refilter_signals_with_vroot (fixture, 3, path);
1610 filter_test_enable_filter (fixture);
1612 check_filter_model_with_root (fixture, path);
1613 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1614 check_level_length (fixture->filter, "2", LEVEL_LENGTH - 1);
1616 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "2:2");
1617 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2:2");
1618 set_path_visibility (fixture, "2:2:2", TRUE);
1620 check_filter_model_with_root (fixture, path);
1621 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1622 check_level_length (fixture->filter, "2", LEVEL_LENGTH);
1623 check_level_length (fixture->filter, "2:2", LEVEL_LENGTH - 1);
1629 unfiltered_show_single (FilterTest *fixture,
1630 gconstpointer user_data)
1633 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2");
1634 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2");
1635 set_path_visibility (fixture, "2", TRUE);
1637 signal_monitor_assert_is_empty (fixture->monitor);
1638 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1640 /* The view only shows the root level, so the filter model only has
1641 * the first two levels cached.
1643 filter_test_append_refilter_signals (fixture, 2);
1644 filter_test_enable_filter (fixture);
1646 check_filter_model (fixture);
1647 check_level_length (fixture->filter, NULL, 1);
1651 unfiltered_show_single_child (FilterTest *fixture,
1652 gconstpointer user_data)
1655 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2:2");
1656 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2:2");
1657 set_path_visibility (fixture, "2:2", TRUE);
1659 signal_monitor_assert_is_empty (fixture->monitor);
1660 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1661 check_level_length (fixture->filter, "2", LEVEL_LENGTH);
1663 /* The view only shows the root level, so the filter model only has
1664 * the first two levels cached.
1666 filter_test_append_refilter_signals (fixture, 3);
1667 filter_test_enable_filter (fixture);
1669 check_filter_model (fixture);
1670 check_level_length (fixture->filter, NULL, 0);
1672 /* From here we are filtered, "2" in the real model is "0" in the filter
1675 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1676 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1677 set_path_visibility (fixture, "2", TRUE);
1678 signal_monitor_assert_is_empty (fixture->monitor);
1679 check_level_length (fixture->filter, NULL, 1);
1680 check_level_length (fixture->filter, "0", 1);
1684 unfiltered_show_single_multi_level (FilterTest *fixture,
1685 gconstpointer user_data)
1688 /* The view is not showing this row (collapsed state), so it is not
1689 * referenced. The signal should not go through.
1691 set_path_visibility (fixture, "2:2:2", TRUE);
1693 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2:2");
1694 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2:2");
1695 set_path_visibility (fixture, "2:2", TRUE);
1697 signal_monitor_assert_is_empty (fixture->monitor);
1698 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1699 check_level_length (fixture->filter, "2", LEVEL_LENGTH);
1700 check_level_length (fixture->filter, "2:2", LEVEL_LENGTH);
1702 /* The view only shows the root level, so the filter model only has
1703 * the first two levels cached.
1705 filter_test_append_refilter_signals (fixture, 3);
1706 filter_test_enable_filter (fixture);
1708 check_filter_model (fixture);
1709 check_level_length (fixture->filter, NULL, 0);
1711 /* From here we are filtered, "2" in the real model is "0" in the filter
1714 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1715 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1716 set_path_visibility (fixture, "2", TRUE);
1717 check_filter_model (fixture);
1718 check_level_length (fixture->filter, NULL, 1);
1719 check_level_length (fixture->filter, "0", 1);
1720 check_level_length (fixture->filter, "0:0", 1);
1725 unfiltered_vroot_show_single (FilterTest *fixture,
1726 gconstpointer user_data)
1729 GtkTreePath *path = (GtkTreePath *)user_data;
1731 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2");
1732 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2");
1733 set_path_visibility (fixture, "2:2", TRUE);
1735 signal_monitor_assert_is_empty (fixture->monitor);
1736 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1738 /* The view only shows the root level, so the filter model only has
1739 * the first two levels cached.
1741 filter_test_append_refilter_signals_with_vroot (fixture, 3, path);
1742 filter_test_enable_filter (fixture);
1744 check_filter_model_with_root (fixture, path);
1745 check_level_length (fixture->filter, NULL, 1);
1749 unfiltered_vroot_show_single_child (FilterTest *fixture,
1750 gconstpointer user_data)
1753 GtkTreePath *path = (GtkTreePath *)user_data;
1755 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2:2");
1756 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2:2");
1757 set_path_visibility (fixture, "2:2:2", TRUE);
1759 signal_monitor_assert_is_empty (fixture->monitor);
1760 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1761 check_level_length (fixture->filter, "2", LEVEL_LENGTH);
1763 /* The view only shows the root level, so the filter model only has
1764 * the first two levels cached.
1766 filter_test_append_refilter_signals_with_vroot (fixture, 2, path);
1767 filter_test_enable_filter (fixture);
1769 check_filter_model_with_root (fixture, path);
1770 check_level_length (fixture->filter, NULL, 0);
1772 /* From here we are filtered, "2" in the real model is "0" in the filter
1775 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1776 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1777 set_path_visibility (fixture, "2:2", TRUE);
1778 signal_monitor_assert_is_empty (fixture->monitor);
1779 check_level_length (fixture->filter, NULL, 1);
1780 check_level_length (fixture->filter, "0", 1);
1784 unfiltered_vroot_show_single_multi_level (FilterTest *fixture,
1785 gconstpointer user_data)
1788 GtkTreePath *path = (GtkTreePath *)user_data;
1790 /* The view is not showing this row (collapsed state), so it is not
1791 * referenced. The signal should not go through.
1793 set_path_visibility (fixture, "2:2:2:2", TRUE);
1795 signal_monitor_append_signal (fixture->monitor, ROW_CHANGED, "2:2");
1796 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "2:2");
1797 set_path_visibility (fixture, "2:2:2", TRUE);
1799 signal_monitor_assert_is_empty (fixture->monitor);
1800 check_level_length (fixture->filter, NULL, LEVEL_LENGTH);
1801 check_level_length (fixture->filter, "2", LEVEL_LENGTH);
1802 check_level_length (fixture->filter, "2:2", LEVEL_LENGTH);
1804 /* The view only shows the root level, so the filter model only has
1805 * the first two levels cached.
1807 filter_test_append_refilter_signals_with_vroot (fixture, 4, path);
1808 filter_test_enable_filter (fixture);
1810 check_filter_model_with_root (fixture, path);
1811 check_level_length (fixture->filter, NULL, 0);
1813 /* From here we are filtered, "2" in the real model is "0" in the filter
1816 signal_monitor_append_signal (fixture->monitor, ROW_INSERTED, "0");
1817 signal_monitor_append_signal (fixture->monitor, ROW_HAS_CHILD_TOGGLED, "0");
1818 set_path_visibility (fixture, "2:2", TRUE);
1819 check_filter_model_with_root (fixture, path);
1820 check_level_length (fixture->filter, NULL, 1);
1821 check_level_length (fixture->filter, "0", 1);
1822 check_level_length (fixture->filter, "0:0", 1);
1827 insert_before (void)
1829 GtkTreeStore *store;
1830 GtkTreeModel *filter;
1831 GtkWidget *tree_view;
1832 SignalMonitor *monitor;
1834 GtkTreeIter last_iter;
1837 /* This tests two aspects of the row-inserted handling:
1838 * 1) If the newly inserted node was already handled by building
1839 * the root level, don't handle it a second time.
1840 * 2) Offsets of existing nodes must be updated when a new
1844 store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN);
1845 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL);
1846 gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (filter),
1849 tree_view = gtk_tree_view_new_with_model (filter);
1850 monitor = signal_monitor_new (filter);
1852 check_level_length (GTK_TREE_MODEL_FILTER (filter), NULL, 0);
1855 path = gtk_tree_path_new_from_indices (0, -1);
1856 signal_monitor_append_signal_path (monitor, ROW_INSERTED, path);
1857 gtk_tree_path_free (path);
1859 gtk_tree_store_insert_with_values (store, &iter, NULL, 0,
1860 0, "Foo", 1, TRUE, -1);
1862 signal_monitor_assert_is_empty (monitor);
1863 check_level_length (GTK_TREE_MODEL_FILTER (filter), NULL, 1);
1866 path = gtk_tree_path_new_from_indices (1, -1);
1867 signal_monitor_append_signal_path (monitor, ROW_INSERTED, path);
1868 gtk_tree_path_free (path);
1870 gtk_tree_store_insert_with_values (store, &iter, NULL, 1,
1871 0, "Foo", 1, TRUE, -1);
1874 signal_monitor_assert_is_empty (monitor);
1875 check_level_length (GTK_TREE_MODEL_FILTER (filter), NULL, 2);
1877 /* Insert on 1 again -- invisible */
1878 gtk_tree_store_insert_with_values (store, &iter, NULL, 1,
1879 0, "Foo", 1, FALSE, -1);
1881 signal_monitor_assert_is_empty (monitor);
1882 check_level_length (GTK_TREE_MODEL_FILTER (filter), NULL, 2);
1884 /* Insert on 1 again -- visible */
1885 path = gtk_tree_path_new_from_indices (1, -1);
1886 signal_monitor_append_signal_path (monitor, ROW_INSERTED, path);
1887 gtk_tree_path_free (path);
1889 gtk_tree_store_insert_with_values (store, &iter, NULL, 1,
1890 0, "Foo", 1, TRUE, -1);
1892 signal_monitor_assert_is_empty (monitor);
1893 check_level_length (GTK_TREE_MODEL_FILTER (filter), NULL, 3);
1895 /* Modify the iter that should be at the last position and check the
1898 path = gtk_tree_path_new_from_indices (2, -1);
1899 signal_monitor_append_signal_path (monitor, ROW_CHANGED, path);
1900 gtk_tree_path_free (path);
1902 gtk_tree_store_set (store, &last_iter, 0, "Foo changed", -1);
1904 signal_monitor_assert_is_empty (monitor);
1905 check_level_length (GTK_TREE_MODEL_FILTER (filter), NULL, 3);
1911 GtkTreeStore *store;
1912 GtkTreeModel *filter;
1913 GtkWidget *tree_view;
1914 SignalMonitor *monitor;
1915 GtkTreeIter parent, iter;
1918 store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN);
1920 gtk_tree_store_insert_with_values (store, &parent, NULL, 0,
1921 0, "Parent", 1, TRUE, -1);
1924 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL);
1925 gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (filter),
1928 tree_view = gtk_tree_view_new_with_model (filter);
1929 monitor = signal_monitor_new (filter);
1931 /* Insert child -- invisible */
1932 path = gtk_tree_path_new_from_indices (0, -1);
1933 signal_monitor_append_signal_path (monitor, ROW_HAS_CHILD_TOGGLED, path);
1934 /* The signal is received twice, once a pass through from GtkTreeStore
1935 * and one generated by GtkTreeModelFilter. Not accurate, but cannot
1938 signal_monitor_append_signal_path (monitor, ROW_HAS_CHILD_TOGGLED, path);
1939 gtk_tree_path_free (path);
1941 gtk_tree_store_insert_with_values (store, &iter, &parent, 1,
1942 0, "Child", 1, FALSE, -1);
1944 signal_monitor_assert_is_empty (monitor);
1945 check_level_length (GTK_TREE_MODEL_FILTER (filter), NULL, 1);
1948 path = gtk_tree_path_new_from_indices (0, 0, -1);
1949 signal_monitor_append_signal_path (monitor, ROW_INSERTED, path);
1950 gtk_tree_path_up (path); /* 0 */
1951 signal_monitor_append_signal_path (monitor, ROW_HAS_CHILD_TOGGLED, path);
1952 gtk_tree_path_free (path);
1954 gtk_tree_store_insert_with_values (store, &iter, &parent, 0,
1955 0, "Child", 1, TRUE, -1);
1957 signal_monitor_assert_is_empty (monitor);
1958 check_level_length (GTK_TREE_MODEL_FILTER (filter), NULL, 1);
1960 /* Insert child -- invisible */
1961 gtk_tree_store_insert_with_values (store, &iter, &parent, 1,
1962 0, "Child", 1, FALSE, -1);
1964 signal_monitor_assert_is_empty (monitor);
1965 check_level_length (GTK_TREE_MODEL_FILTER (filter), NULL, 1);
1973 GtkTreeIter iter, iter1, iter2, iter3;
1975 GtkTreeModel *filter;
1976 GtkWidget *view G_GNUC_UNUSED;
1978 list = gtk_list_store_new (1, G_TYPE_INT);
1979 gtk_list_store_insert_with_values (list, &iter1, 0, 0, 1, -1);
1980 gtk_list_store_insert_with_values (list, &iter, 1, 0, 2, -1);
1981 gtk_list_store_insert_with_values (list, &iter, 2, 0, 3, -1);
1982 gtk_list_store_insert_with_values (list, &iter, 3, 0, 4, -1);
1983 gtk_list_store_insert_with_values (list, &iter, 4, 0, 5, -1);
1984 gtk_list_store_insert_with_values (list, &iter, 5, 0, 6, -1);
1985 gtk_list_store_insert_with_values (list, &iter2, 6, 0, 7, -1);
1986 gtk_list_store_insert_with_values (list, &iter3, 7, 0, 8, -1);
1988 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (list), NULL);
1989 view = gtk_tree_view_new_with_model (filter);
1991 gtk_list_store_remove (list, &iter1);
1992 gtk_list_store_remove (list, &iter3);
1993 gtk_list_store_remove (list, &iter2);
1997 remove_node_vroot (void)
1999 GtkTreeIter parent, root;
2000 GtkTreeIter iter, iter1, iter2, iter3;
2002 GtkTreeModel *filter;
2004 GtkWidget *view G_GNUC_UNUSED;
2006 tree = gtk_tree_store_new (1, G_TYPE_INT);
2007 gtk_tree_store_insert_with_values (tree, &parent, NULL, 0, 0, 0, -1);
2008 gtk_tree_store_insert_with_values (tree, &root, &parent, 0, 0, 0, -1);
2010 gtk_tree_store_insert_with_values (tree, &iter1, &root, 0, 0, 1, -1);
2011 gtk_tree_store_insert_with_values (tree, &iter, &root, 1, 0, 2, -1);
2012 gtk_tree_store_insert_with_values (tree, &iter, &root, 2, 0, 3, -1);
2013 gtk_tree_store_insert_with_values (tree, &iter, &root, 3, 0, 4, -1);
2014 gtk_tree_store_insert_with_values (tree, &iter, &root, 4, 0, 5, -1);
2015 gtk_tree_store_insert_with_values (tree, &iter, &root, 5, 0, 6, -1);
2016 gtk_tree_store_insert_with_values (tree, &iter2, &root, 6, 0, 7, -1);
2017 gtk_tree_store_insert_with_values (tree, &iter3, &root, 7, 0, 8, -1);
2019 path = gtk_tree_path_new_from_indices (0, 0, -1);
2020 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (tree), path);
2021 gtk_tree_path_free (path);
2023 view = gtk_tree_view_new_with_model (filter);
2025 gtk_tree_store_remove (tree, &iter1);
2026 gtk_tree_store_remove (tree, &iter3);
2027 gtk_tree_store_remove (tree, &iter2);
2031 remove_vroot_ancestor (void)
2033 GtkTreeIter parent, root;
2034 GtkTreeIter iter, iter1, iter2, iter3;
2036 GtkTreeModel *filter;
2038 GtkWidget *view G_GNUC_UNUSED;
2040 tree = gtk_tree_store_new (1, G_TYPE_INT);
2041 gtk_tree_store_insert_with_values (tree, &parent, NULL, 0, 0, 0, -1);
2042 gtk_tree_store_insert_with_values (tree, &root, &parent, 0, 0, 0, -1);
2044 gtk_tree_store_insert_with_values (tree, &iter1, &root, 0, 0, 1, -1);
2045 gtk_tree_store_insert_with_values (tree, &iter, &root, 1, 0, 2, -1);
2046 gtk_tree_store_insert_with_values (tree, &iter, &root, 2, 0, 3, -1);
2047 gtk_tree_store_insert_with_values (tree, &iter, &root, 3, 0, 4, -1);
2048 gtk_tree_store_insert_with_values (tree, &iter, &root, 4, 0, 5, -1);
2049 gtk_tree_store_insert_with_values (tree, &iter, &root, 5, 0, 6, -1);
2050 gtk_tree_store_insert_with_values (tree, &iter2, &root, 6, 0, 7, -1);
2051 gtk_tree_store_insert_with_values (tree, &iter3, &root, 7, 0, 8, -1);
2053 path = gtk_tree_path_new_from_indices (0, 0, -1);
2054 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (tree), path);
2055 gtk_tree_path_free (path);
2057 view = gtk_tree_view_new_with_model (filter);
2059 gtk_tree_store_remove (tree, &parent);
2064 specific_path_dependent_filter_func (GtkTreeModel *model,
2070 path = gtk_tree_model_get_path (model, iter);
2071 if (gtk_tree_path_get_indices (path)[0] < 4)
2078 specific_path_dependent_filter (void)
2084 GtkTreeModel *filter;
2086 list = gtk_list_store_new (1, G_TYPE_INT);
2087 gtk_list_store_insert_with_values (list, &iter, 0, 0, 1, -1);
2088 gtk_list_store_insert_with_values (list, &iter, 1, 0, 2, -1);
2089 gtk_list_store_insert_with_values (list, &iter, 2, 0, 3, -1);
2090 gtk_list_store_insert_with_values (list, &iter, 3, 0, 4, -1);
2091 gtk_list_store_insert_with_values (list, &iter, 4, 0, 5, -1);
2092 gtk_list_store_insert_with_values (list, &iter, 5, 0, 6, -1);
2093 gtk_list_store_insert_with_values (list, &iter, 6, 0, 7, -1);
2094 gtk_list_store_insert_with_values (list, &iter, 7, 0, 8, -1);
2096 sort = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (list));
2097 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (sort), NULL);
2098 gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
2099 specific_path_dependent_filter_func,
2102 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort), 0,
2103 GTK_SORT_DESCENDING);
2105 for (i = 0; i < 4; i++)
2107 if (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (list), &iter,
2109 gtk_list_store_remove (list, &iter);
2111 if (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (list), &iter,
2113 gtk_list_store_remove (list, &iter);
2119 specific_append_after_collapse_visible_func (GtkTreeModel *model,
2124 gboolean hide_negative_numbers;
2126 gtk_tree_model_get (model, iter, 1, &number, -1);
2127 hide_negative_numbers = GPOINTER_TO_INT (g_object_get_data (data, "private-hide-negative-numbers"));
2129 return (number >= 0 || !hide_negative_numbers);
2133 specific_append_after_collapse (void)
2135 /* This test is based on one of the test cases I found in my
2136 * old test cases directory. I unfortunately do not have a record
2137 * from who this test case originated. -Kris.
2141 * - Show tree, expand, collapse.
2146 GtkTreeIter child_iter;
2147 GtkTreeIter child_iter2;
2148 GtkTreePath *append_path;
2149 GtkTreeStore *store;
2150 GtkTreeModel *filter;
2154 GtkWidget *tree_view;
2156 store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_INT);
2158 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL);
2159 g_object_set_data (G_OBJECT (filter), "private-hide-negative-numbers",
2160 GINT_TO_POINTER (FALSE));
2161 gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
2162 specific_append_after_collapse_visible_func,
2165 sort = gtk_tree_model_sort_new_with_model (filter);
2167 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
2168 tree_view = gtk_tree_view_new_with_model (sort);
2169 gtk_container_add (GTK_CONTAINER (window), tree_view);
2170 gtk_widget_realize (tree_view);
2172 while (gtk_events_pending ())
2173 gtk_main_iteration ();
2175 gtk_tree_store_prepend (store, &iter, NULL);
2176 gtk_tree_store_set (store, &iter,
2177 0, "hallo", 1, 1, -1);
2179 gtk_tree_store_append (store, &child_iter, &iter);
2180 gtk_tree_store_set (store, &child_iter,
2181 0, "toemaar", 1, 1, -1);
2183 gtk_tree_store_append (store, &child_iter2, &child_iter);
2184 gtk_tree_store_set (store, &child_iter2,
2185 0, "very deep", 1, 1, -1);
2187 append_path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &child_iter2);
2189 gtk_tree_store_append (store, &child_iter, &iter);
2190 gtk_tree_store_set (store, &child_iter,
2191 0, "sja", 1, 1, -1);
2193 gtk_tree_store_append (store, &child_iter, &iter);
2194 gtk_tree_store_set (store, &child_iter,
2195 0, "some word", 1, -1, -1);
2197 /* Expand and collapse the tree */
2198 gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
2199 while (gtk_events_pending ())
2200 gtk_main_iteration ();
2202 gtk_tree_view_collapse_all (GTK_TREE_VIEW (tree_view));
2203 while (gtk_events_pending ())
2204 gtk_main_iteration ();
2206 /* Add another it */
2207 g_object_set_data (G_OBJECT (filter), "private-hide-negative-numbers",
2208 GINT_TO_POINTER (TRUE));
2210 if (gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, append_path))
2212 gtk_tree_store_append (store, &child_iter, &iter);
2213 gtk_tree_store_set (store, &child_iter,
2214 0, "new new new !!", 1, 1, -1);
2216 gtk_tree_path_free (append_path);
2219 gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
2220 while (gtk_events_pending ())
2221 gtk_main_iteration ();
2226 specific_sort_filter_remove_node_compare_func (GtkTreeModel *model,
2235 specific_sort_filter_remove_node_visible_func (GtkTreeModel *model,
2241 /* Do reference the model */
2242 gtk_tree_model_get (model, iter, 0, &item, -1);
2249 specific_sort_filter_remove_node (void)
2251 /* This test is based on one of the test cases I found in my
2252 * old test cases directory. I unfortunately do not have a record
2253 * from who this test case originated. -Kris.
2256 * - Create tree store, sort, filter models. The sort model has
2257 * a default sort func that is enabled, filter model a visible func
2258 * that defaults to returning FALSE.
2259 * - Remove a node from the tree store.
2263 GtkTreeStore *store;
2264 GtkTreeModel *filter;
2268 GtkWidget *tree_view;
2270 store = gtk_tree_store_new (1, G_TYPE_STRING);
2271 gtk_tree_store_append (store, &iter, NULL);
2272 gtk_tree_store_set (store, &iter, 0, "Hello1", -1);
2274 gtk_tree_store_append (store, &iter, NULL);
2275 gtk_tree_store_set (store, &iter, 0, "Hello2", -1);
2277 sort = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
2278 gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (sort),
2279 specific_sort_filter_remove_node_compare_func, NULL, NULL);
2281 filter = gtk_tree_model_filter_new (sort, NULL);
2282 gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
2283 specific_sort_filter_remove_node_visible_func,
2287 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
2288 tree_view = gtk_tree_view_new_with_model (filter);
2289 gtk_container_add (GTK_CONTAINER (window), tree_view);
2290 gtk_widget_realize (tree_view);
2292 while (gtk_events_pending ())
2293 gtk_main_iteration ();
2296 gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
2297 gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);
2298 gtk_tree_store_remove (store, &iter);
2300 while (gtk_events_pending ())
2301 gtk_main_iteration ();
2306 specific_sort_filter_remove_root (void)
2308 /* This test is based on one of the test cases I found in my
2309 * old test cases directory. I unfortunately do not have a record
2310 * from who this test case originated. -Kris.
2313 GtkTreeModel *model, *sort, *filter;
2314 GtkTreeIter root, mid, leaf;
2317 model = GTK_TREE_MODEL (gtk_tree_store_new (1, G_TYPE_INT));
2318 gtk_tree_store_append (GTK_TREE_STORE (model), &root, NULL);
2319 gtk_tree_store_append (GTK_TREE_STORE (model), &mid, &root);
2320 gtk_tree_store_append (GTK_TREE_STORE (model), &leaf, &mid);
2322 path = gtk_tree_model_get_path (model, &mid);
2324 sort = gtk_tree_model_sort_new_with_model (model);
2325 filter = gtk_tree_model_filter_new (sort, path);
2327 gtk_tree_store_remove (GTK_TREE_STORE (model), &root);
2329 g_object_unref (filter);
2330 g_object_unref (sort);
2331 g_object_unref (model);
2336 specific_root_mixed_visibility (void)
2339 GtkTreeModel *filter;
2340 /* A bit nasty, apologies */
2343 fixture.store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN);
2345 for (i = 0; i < LEVEL_LENGTH; i++)
2349 gtk_tree_store_insert (fixture.store, &iter, NULL, i);
2351 create_tree_store_set_values (fixture.store, &iter, TRUE);
2353 create_tree_store_set_values (fixture.store, &iter, FALSE);
2356 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (fixture.store), NULL);
2357 fixture.filter = GTK_TREE_MODEL_FILTER (filter);
2358 fixture.monitor = NULL;
2360 gtk_tree_model_filter_set_visible_column (fixture.filter, 1);
2362 /* In order to trigger the potential bug, we should not access
2363 * the filter model here (so don't call the check functions).
2366 /* Change visibility of an odd row to TRUE */
2367 set_path_visibility (&fixture, "3", TRUE);
2368 check_filter_model (&fixture);
2369 check_level_length (fixture.filter, NULL, 4);
2375 specific_has_child_filter_filter_func (GtkTreeModel *model,
2379 return gtk_tree_model_iter_has_child (model, iter);
2383 specific_has_child_filter (void)
2385 GtkTreeModel *filter;
2386 GtkTreeIter iter, root;
2387 FilterTest fixture; /* This is not how it should be done */
2388 GtkWidget *tree_view;
2390 fixture.store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN);
2391 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (fixture.store), NULL);
2392 fixture.filter = GTK_TREE_MODEL_FILTER (filter);
2393 fixture.monitor = signal_monitor_new (filter);
2395 tree_view = gtk_tree_view_new_with_model (filter);
2397 /* We will filter on parent state using a filter function. We will
2398 * manually keep the boolean column in sync, so that we can use
2399 * check_filter_model() to check the consistency of the model.
2401 /* FIXME: We need a check_filter_model() that is not tied to LEVEL_LENGTH
2402 * to be able to check the structure here. We keep the calls to
2403 * check_filter_model() commented out until then.
2405 gtk_tree_model_filter_set_visible_func (fixture.filter,
2406 specific_has_child_filter_filter_func,
2409 /* The first node will be initially invisible: no signals */
2410 gtk_tree_store_append (fixture.store, &root, NULL);
2411 create_tree_store_set_values (fixture.store, &root, FALSE);
2413 /* check_filter_model (&fixture); */
2414 check_level_length (fixture.filter, NULL, 0);
2415 signal_monitor_assert_is_empty (fixture.monitor);
2417 /* Insert a child node. This will cause the parent to become visible
2418 * since there is a child now.
2420 signal_monitor_append_signal (fixture.monitor, ROW_INSERTED, "0");
2421 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "0");
2422 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "0");
2424 gtk_tree_store_append (fixture.store, &iter, &root);
2425 create_tree_store_set_values (fixture.store, &iter, TRUE);
2427 /* Parent must now be visible. Do the level length check first,
2428 * to avoid modifying the child model triggering a row-changed to
2431 check_level_length (fixture.filter, NULL, 1);
2432 check_level_length (fixture.filter, "0", 0);
2433 signal_monitor_assert_is_empty (fixture.monitor);
2435 /* This should propagate row-changed */
2436 signal_monitor_append_signal (fixture.monitor, ROW_CHANGED, "0");
2437 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "0");
2439 set_path_visibility (&fixture, "0", TRUE);
2440 /* check_filter_model (&fixture); */
2441 signal_monitor_assert_is_empty (fixture.monitor);
2443 /* New root node, no child, so no signal */
2444 gtk_tree_store_append (fixture.store, &root, NULL);
2445 check_level_length (fixture.filter, NULL, 1);
2446 signal_monitor_assert_is_empty (fixture.monitor);
2448 /* When the child comes in, this node will become visible */
2449 signal_monitor_append_signal (fixture.monitor, ROW_INSERTED, "1");
2450 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "1");
2451 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "1");
2452 signal_monitor_append_signal (fixture.monitor, ROW_CHANGED, "1");
2453 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "1");
2455 gtk_tree_store_append (fixture.store, &iter, &root);
2456 check_level_length (fixture.filter, NULL, 2);
2457 check_level_length (fixture.filter, "1", 0);
2459 create_tree_store_set_values (fixture.store, &root, TRUE);
2460 create_tree_store_set_values (fixture.store, &iter, TRUE);
2462 /* check_filter_model (&fixture); */
2463 signal_monitor_assert_is_empty (fixture.monitor);
2465 /* Add another child for 1 */
2466 gtk_tree_store_append (fixture.store, &iter, &root);
2467 create_tree_store_set_values (fixture.store, &iter, TRUE);
2468 check_level_length (fixture.filter, NULL, 2);
2469 check_level_length (fixture.filter, "0", 0);
2470 check_level_length (fixture.filter, "1", 0);
2471 signal_monitor_assert_is_empty (fixture.monitor);
2473 /* Now remove one of the remaining child rows */
2474 signal_monitor_append_signal (fixture.monitor, ROW_DELETED, "0");
2476 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture.store),
2478 gtk_tree_store_remove (fixture.store, &iter);
2480 check_level_length (fixture.filter, NULL, 1);
2481 check_level_length (fixture.filter, "0", 0);
2483 set_path_visibility (&fixture, "0", FALSE);
2484 /* check_filter_model (&fixture); */
2485 signal_monitor_assert_is_empty (fixture.monitor);
2490 specific_root_has_child_filter_filter_func (GtkTreeModel *model,
2497 path = gtk_tree_model_get_path (model, iter);
2498 depth = gtk_tree_path_get_depth (path);
2499 gtk_tree_path_free (path);
2504 return gtk_tree_model_iter_has_child (model, iter);
2508 specific_root_has_child_filter (void)
2510 GtkTreeModel *filter;
2511 GtkTreeIter iter, root;
2512 FilterTest fixture; /* This is not how it should be done ... */
2513 GtkWidget *tree_view;
2515 /* This is a variation on the above test case, specific has-child-filter,
2516 * herein the has-child check for visibility only applies to root level
2517 * nodes. In this test, children are always visible because we
2518 * only filter based on the "has child" criterion.
2521 fixture.store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN);
2522 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (fixture.store), NULL);
2523 fixture.filter = GTK_TREE_MODEL_FILTER (filter);
2524 fixture.monitor = signal_monitor_new (filter);
2526 tree_view = gtk_tree_view_new_with_model (filter);
2528 /* We will filter on parent state using a filter function. We will
2529 * manually keep the boolean column in sync, so that we can use
2530 * check_filter_model() to check the consistency of the model.
2532 /* FIXME: We need a check_filter_model() that is not tied to LEVEL_LENGTH
2533 * to be able to check the structure here. We keep the calls to
2534 * check_filter_model() commented out until then.
2536 gtk_tree_model_filter_set_visible_func (fixture.filter,
2537 specific_root_has_child_filter_filter_func,
2540 /* Add a first node, this will be invisible initially, so no signal
2541 * should be emitted.
2543 gtk_tree_store_append (fixture.store, &root, NULL);
2544 create_tree_store_set_values (fixture.store, &root, FALSE);
2546 signal_monitor_assert_is_empty (fixture.monitor);
2547 /* check_filter_model (&fixture); */
2548 check_level_length (fixture.filter, NULL, 0);
2550 /* Add a child node. This will cause the parent to become visible,
2551 * so we expect row-inserted signals for both.
2553 signal_monitor_append_signal (fixture.monitor, ROW_INSERTED, "0");
2554 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "0");
2555 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "0");
2557 gtk_tree_store_append (fixture.store, &iter, &root);
2558 signal_monitor_assert_is_empty (fixture.monitor);
2560 check_level_length (fixture.filter, NULL, 1);
2561 check_level_length (fixture.filter, "0", 1);
2563 /* Modify the content of iter, yields row-changed signals */
2564 signal_monitor_append_signal (fixture.monitor, ROW_CHANGED, "0:0");
2566 create_tree_store_set_values (fixture.store, &iter, TRUE);
2567 signal_monitor_assert_is_empty (fixture.monitor);
2569 /* Parent must now be visible. Do the level length check first,
2570 * to avoid modifying the child model triggering a row-changed to
2573 check_level_length (fixture.filter, NULL, 1);
2574 check_level_length (fixture.filter, "0", 1);
2577 signal_monitor_append_signal (fixture.monitor, ROW_CHANGED, "0");
2578 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "0");
2580 set_path_visibility (&fixture, "0", TRUE);
2581 /* check_filter_model (&fixture); */
2583 signal_monitor_assert_is_empty (fixture.monitor);
2585 /* Insert another node in the root level. Initially invisible, so
2586 * not expecting any signal.
2588 gtk_tree_store_append (fixture.store, &root, NULL);
2589 check_level_length (fixture.filter, NULL, 1);
2591 signal_monitor_assert_is_empty (fixture.monitor);
2593 /* Adding a child node which also makes parent at path 1 visible. */
2594 signal_monitor_append_signal (fixture.monitor, ROW_INSERTED, "1");
2595 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "1");
2596 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "1");
2598 gtk_tree_store_append (fixture.store, &iter, &root);
2599 check_level_length (fixture.filter, NULL, 2);
2600 check_level_length (fixture.filter, "1", 1);
2602 signal_monitor_assert_is_empty (fixture.monitor);
2604 /* Check if row-changed is propagated */
2605 signal_monitor_append_signal (fixture.monitor, ROW_CHANGED, "1");
2606 /* is row-has-child-toggled really necessary? */
2607 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "1");
2608 signal_monitor_append_signal (fixture.monitor, ROW_CHANGED, "1:0");
2610 create_tree_store_set_values (fixture.store, &root, TRUE);
2611 create_tree_store_set_values (fixture.store, &iter, TRUE);
2612 /* check_filter_model (&fixture); */
2613 signal_monitor_assert_is_empty (fixture.monitor);
2615 /* Insert another child under node 1 */
2616 signal_monitor_append_signal (fixture.monitor, ROW_INSERTED, "1:1");
2617 signal_monitor_append_signal (fixture.monitor, ROW_CHANGED, "1:1");
2619 gtk_tree_store_append (fixture.store, &iter, &root);
2620 create_tree_store_set_values (fixture.store, &iter, TRUE);
2621 check_level_length (fixture.filter, NULL, 2);
2622 check_level_length (fixture.filter, "0", 1);
2623 check_level_length (fixture.filter, "1", 2);
2624 signal_monitor_assert_is_empty (fixture.monitor);
2626 /* Set a child node to invisible. This should not yield any
2627 * change, because filtering is only done on whether the root
2628 * node has a child, which it still has.
2630 signal_monitor_append_signal (fixture.monitor, ROW_CHANGED, "0:0");
2632 set_path_visibility (&fixture, "0:0", FALSE);
2633 signal_monitor_assert_is_empty (fixture.monitor);
2635 /* Now remove one of the remaining child rows */
2636 signal_monitor_append_signal (fixture.monitor, ROW_DELETED, "0:0");
2637 signal_monitor_append_signal (fixture.monitor, ROW_HAS_CHILD_TOGGLED, "0");
2638 signal_monitor_append_signal (fixture.monitor, ROW_DELETED, "0");
2640 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture.store),
2642 gtk_tree_store_remove (fixture.store, &iter);
2644 check_level_length (fixture.filter, NULL, 1);
2645 check_level_length (fixture.filter, "0", 2);
2646 signal_monitor_assert_is_empty (fixture.monitor);
2648 /* Set visibility of 0 to FALSE, no-op for filter model since
2649 * the child 0:0 is already gone
2651 set_path_visibility (&fixture, "0", FALSE);
2652 /* check_filter_model (&fixture); */
2653 signal_monitor_assert_is_empty (fixture.monitor);
2658 specific_filter_add_child (void)
2660 /* This test is based on one of the test cases I found in my
2661 * old test cases directory. I unfortunately do not have a record
2662 * from who this test case originated. -Kris.
2666 GtkTreeIter iter_first;
2668 GtkTreeStore *store;
2669 GtkTreeModel *filter G_GNUC_UNUSED;
2671 store = gtk_tree_store_new (1, G_TYPE_STRING);
2673 gtk_tree_store_append (store, &iter_first, NULL);
2674 gtk_tree_store_set (store, &iter_first, 0, "Hello", -1);
2676 gtk_tree_store_append (store, &iter, NULL);
2677 gtk_tree_store_set (store, &iter, 0, "Hello", -1);
2679 gtk_tree_store_append (store, &iter, NULL);
2680 gtk_tree_store_set (store, &iter, 0, "Hello", -1);
2682 gtk_tree_store_append (store, &iter, NULL);
2683 gtk_tree_store_set (store, &iter, 0, "Hello", -1);
2685 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL);
2687 gtk_tree_store_set (store, &iter, 0, "Hello", -1);
2688 gtk_tree_store_append (store, &child, &iter_first);
2689 gtk_tree_store_set (store, &child, 0, "Hello", -1);
2693 specific_list_store_clear (void)
2697 GtkTreeModel *filter;
2698 GtkWidget *view G_GNUC_UNUSED;
2700 list = gtk_list_store_new (1, G_TYPE_INT);
2701 gtk_list_store_insert_with_values (list, &iter, 0, 0, 1, -1);
2702 gtk_list_store_insert_with_values (list, &iter, 1, 0, 2, -1);
2703 gtk_list_store_insert_with_values (list, &iter, 2, 0, 3, -1);
2704 gtk_list_store_insert_with_values (list, &iter, 3, 0, 4, -1);
2705 gtk_list_store_insert_with_values (list, &iter, 4, 0, 5, -1);
2706 gtk_list_store_insert_with_values (list, &iter, 5, 0, 6, -1);
2707 gtk_list_store_insert_with_values (list, &iter, 6, 0, 7, -1);
2708 gtk_list_store_insert_with_values (list, &iter, 7, 0, 8, -1);
2710 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (list), NULL);
2711 view = gtk_tree_view_new_with_model (filter);
2713 gtk_list_store_clear (list);
2717 specific_sort_ref_leaf_and_remove_ancestor (void)
2719 GtkTreeIter iter, child, child2, child3;
2723 GtkTreeRowReference *rowref;
2724 GtkWidget *view G_GNUC_UNUSED;
2726 tree = gtk_tree_store_new (1, G_TYPE_INT);
2727 gtk_tree_store_insert_with_values (tree, &iter, NULL, 0, 0, 1, -1);
2728 gtk_tree_store_insert_with_values (tree, &iter, NULL, 1, 0, 2, -1);
2729 gtk_tree_store_insert_with_values (tree, &iter, NULL, 2, 0, 3, -1);
2730 gtk_tree_store_insert_with_values (tree, &iter, NULL, 3, 0, 4, -1);
2732 gtk_tree_store_insert_with_values (tree, &child, &iter, 0, 0, 50, -1);
2733 gtk_tree_store_insert_with_values (tree, &child2, &child, 0, 0, 6, -1);
2734 gtk_tree_store_insert_with_values (tree, &child3, &child2, 0, 0, 7, -1);
2736 sort = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (tree));
2737 view = gtk_tree_view_new_with_model (sort);
2738 gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
2740 path = gtk_tree_path_new_from_indices (3, 0, 0, 0, -1);
2741 rowref = gtk_tree_row_reference_new (sort, path);
2742 gtk_tree_path_free (path);
2744 path = gtk_tree_path_new_from_indices (3, 0, 0, 0, -1);
2745 rowref = gtk_tree_row_reference_new (sort, path);
2746 gtk_tree_path_free (path);
2748 path = gtk_tree_path_new_from_indices (3, 0, -1);
2749 rowref = gtk_tree_row_reference_new (sort, path);
2750 gtk_tree_path_free (path);
2752 path = gtk_tree_path_new_from_indices (3, -1);
2753 rowref = gtk_tree_row_reference_new (sort, path);
2754 gtk_tree_path_free (path);
2756 /* Deleting a parent */
2757 path = gtk_tree_path_new_from_indices (3, 0, -1);
2758 gtk_tree_model_get_iter (GTK_TREE_MODEL (tree), &iter, path);
2759 gtk_tree_store_remove (tree, &iter);
2760 gtk_tree_path_free (path);
2762 gtk_tree_row_reference_free (rowref);
2766 specific_ref_leaf_and_remove_ancestor (void)
2768 GtkTreeIter iter, child, child2, child3;
2770 GtkTreeModel *filter;
2772 GtkTreeRowReference *rowref;
2773 GtkWidget *view G_GNUC_UNUSED;
2775 tree = gtk_tree_store_new (1, G_TYPE_INT);
2776 gtk_tree_store_insert_with_values (tree, &iter, NULL, 0, 0, 1, -1);
2777 gtk_tree_store_insert_with_values (tree, &iter, NULL, 1, 0, 2, -1);
2778 gtk_tree_store_insert_with_values (tree, &iter, NULL, 2, 0, 3, -1);
2779 gtk_tree_store_insert_with_values (tree, &iter, NULL, 3, 0, 4, -1);
2781 gtk_tree_store_insert_with_values (tree, &child, &iter, 0, 0, 50, -1);
2782 gtk_tree_store_insert_with_values (tree, &child2, &child, 0, 0, 6, -1);
2783 gtk_tree_store_insert_with_values (tree, &child3, &child2, 0, 0, 7, -1);
2785 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (tree), NULL);
2786 view = gtk_tree_view_new_with_model (filter);
2787 gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
2789 path = gtk_tree_path_new_from_indices (3, 0, 0, 0, -1);
2790 rowref = gtk_tree_row_reference_new (filter, path);
2791 gtk_tree_path_free (path);
2793 path = gtk_tree_path_new_from_indices (3, 0, 0, 0, -1);
2794 rowref = gtk_tree_row_reference_new (filter, path);
2795 gtk_tree_path_free (path);
2797 path = gtk_tree_path_new_from_indices (3, 0, -1);
2798 rowref = gtk_tree_row_reference_new (filter, path);
2799 gtk_tree_path_free (path);
2801 path = gtk_tree_path_new_from_indices (3, -1);
2802 rowref = gtk_tree_row_reference_new (filter, path);
2803 gtk_tree_path_free (path);
2805 /* Deleting a parent */
2806 path = gtk_tree_path_new_from_indices (3, 0, -1);
2807 gtk_tree_model_get_iter (GTK_TREE_MODEL (tree), &iter, path);
2808 gtk_tree_store_remove (tree, &iter);
2809 gtk_tree_path_free (path);
2811 gtk_tree_row_reference_free (rowref);
2815 specific_virtual_ref_leaf_and_remove_ancestor (void)
2817 GtkTreeIter iter, child, child2, child3;
2819 GtkTreeModel *filter;
2821 GtkTreeRowReference *rowref;
2822 GtkWidget *view G_GNUC_UNUSED;
2824 tree = gtk_tree_store_new (1, G_TYPE_INT);
2825 gtk_tree_store_insert_with_values (tree, &iter, NULL, 0, 0, 1, -1);
2826 gtk_tree_store_insert_with_values (tree, &iter, NULL, 1, 0, 2, -1);
2827 gtk_tree_store_insert_with_values (tree, &iter, NULL, 2, 0, 3, -1);
2828 gtk_tree_store_insert_with_values (tree, &iter, NULL, 3, 0, 4, -1);
2830 gtk_tree_store_insert_with_values (tree, &child, &iter, 0, 0, 50, -1);
2831 gtk_tree_store_insert_with_values (tree, &child2, &child, 0, 0, 6, -1);
2832 gtk_tree_store_insert_with_values (tree, &child3, &child2, 0, 0, 7, -1);
2834 /* Set a virtual root of 3:0 */
2835 path = gtk_tree_path_new_from_indices (3, 0, -1);
2836 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (tree), path);
2837 gtk_tree_path_free (path);
2839 view = gtk_tree_view_new_with_model (filter);
2840 gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
2842 path = gtk_tree_path_new_from_indices (0, 0, -1);
2843 rowref = gtk_tree_row_reference_new (filter, path);
2844 gtk_tree_path_free (path);
2846 path = gtk_tree_path_new_from_indices (0, 0, -1);
2847 rowref = gtk_tree_row_reference_new (filter, path);
2848 gtk_tree_path_free (path);
2850 path = gtk_tree_path_new_from_indices (0, -1);
2851 rowref = gtk_tree_row_reference_new (filter, path);
2852 gtk_tree_path_free (path);
2854 /* Deleting the virtual root */
2855 path = gtk_tree_path_new_from_indices (3, 0, -1);
2856 gtk_tree_model_get_iter (GTK_TREE_MODEL (tree), &iter, path);
2857 gtk_tree_store_remove (tree, &iter);
2858 gtk_tree_path_free (path);
2860 gtk_tree_row_reference_free (rowref);
2865 specific_bug_301558_sort_func (GtkTreeModel *model,
2872 gtk_tree_model_get (model, a, 0, &i, -1);
2873 gtk_tree_model_get (model, b, 0, &j, -1);
2879 specific_bug_301558 (void)
2881 /* Test case for GNOME Bugzilla bug 301558 provided by
2885 GtkTreeModel *filter;
2887 GtkTreeIter root, iter, iter2;
2888 GtkWidget *view G_GNUC_UNUSED;
2892 g_test_bug ("301558");
2894 tree = gtk_tree_store_new (2, G_TYPE_INT, G_TYPE_BOOLEAN);
2895 gtk_tree_store_append (tree, &iter, NULL);
2896 gtk_tree_store_set (tree, &iter, 0, 123, 1, TRUE, -1);
2897 gtk_tree_store_append (tree, &iter2, &iter);
2898 gtk_tree_store_set (tree, &iter2, 0, 73, 1, TRUE, -1);
2900 sort = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (tree));
2901 gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (sort),
2902 specific_bug_301558_sort_func,
2905 filter = gtk_tree_model_filter_new (sort, NULL);
2906 gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (filter), 1);
2908 view = gtk_tree_view_new_with_model (filter);
2910 while (gtk_events_pending ())
2911 gtk_main_iteration ();
2915 for (i = 0; i < 10; i++)
2917 if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (tree), &root))
2918 g_assert_not_reached ();
2922 gtk_tree_store_append (tree, &iter, &root);
2923 gtk_tree_store_set (tree, &iter, 0, 456, 1, TRUE, -1);
2928 n = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (tree), &root);
2929 gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (tree), &iter,
2931 gtk_tree_store_remove (tree, &iter);
2940 specific_bug_311955_filter_func (GtkTreeModel *model,
2946 gtk_tree_model_get (model, iter, 0, &value, -1);
2948 return (value != 0);
2952 specific_bug_311955 (void)
2954 /* This is a test case for GNOME Bugzilla bug 311955. It was written
2957 GtkTreeIter iter, child, root;
2958 GtkTreeStore *store;
2960 GtkTreeModel *filter;
2962 GtkWidget *window G_GNUC_UNUSED;
2963 GtkWidget *tree_view;
2967 g_test_bug ("311955");
2969 store = gtk_tree_store_new (1, G_TYPE_INT);
2971 gtk_tree_store_append (store, &root, NULL);
2972 gtk_tree_store_set (store, &root, 0, 33, -1);
2974 gtk_tree_store_append (store, &iter, &root);
2975 gtk_tree_store_set (store, &iter, 0, 50, -1);
2977 gtk_tree_store_append (store, &iter, NULL);
2978 gtk_tree_store_set (store, &iter, 0, 22, -1);
2980 sort = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
2981 filter = gtk_tree_model_filter_new (sort, NULL);
2983 gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
2984 specific_bug_311955_filter_func,
2987 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
2988 tree_view = gtk_tree_view_new_with_model (filter);
2989 g_object_unref (store);
2991 gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
2993 while (gtk_events_pending ())
2994 gtk_main_iteration ();
2997 for (i = 0; i < 4; i++)
2999 gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &root);
3001 gtk_tree_store_append (store, &iter, &root);
3004 gtk_tree_store_set (store, &iter, 0, i, -1);
3008 gtk_tree_store_append (store, &child, &iter);
3009 gtk_tree_store_set (store, &child, 0, 10, -1);
3013 while (gtk_events_pending ())
3014 gtk_main_iteration ();
3016 /* Remove bottommost child from the tree. */
3017 gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &root);
3018 n = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), &root);
3020 if (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter, &root, n - 2))
3022 if (gtk_tree_model_iter_children (GTK_TREE_MODEL (store), &child, &iter))
3023 gtk_tree_store_remove (store, &child);
3026 g_assert_not_reached ();
3030 specific_bug_346800 (void)
3032 /* This is a test case for GNOME Bugzilla bug 346800. It was written
3033 * by Jonathan Matthew.
3036 GtkTreeIter node_iters[50];
3037 GtkTreeIter child_iters[50];
3038 GtkTreeModel *model;
3039 GtkTreeModelFilter *filter;
3040 GtkTreeStore *store;
3044 columns = g_new (GType, 2);
3045 columns[0] = G_TYPE_STRING;
3046 columns[1] = G_TYPE_BOOLEAN;
3047 store = gtk_tree_store_newv (2, columns);
3048 model = GTK_TREE_MODEL (store);
3050 g_test_bug ("346800");
3052 filter = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (model, NULL));
3053 gtk_tree_model_filter_set_visible_column (filter, 1);
3055 for (i=0; i<items; i++)
3057 /* allocate random amounts of junk, otherwise the filter model's arrays can expand without moving */
3060 gtk_tree_store_append (store, &node_iters[i], NULL);
3061 gtk_tree_store_set (store, &node_iters[i],
3063 1, ((i%6) == 0) ? FALSE : TRUE,
3067 gtk_tree_store_append (store, &child_iters[i], &node_iters[i]);
3068 gtk_tree_store_set (store, &child_iters[i],
3069 0, "something else",
3072 gtk_tree_model_filter_refilter (filter);
3076 gtk_tree_store_set (GTK_TREE_STORE (model), &child_iters[i-1], 1,
3077 (i & 1) ? TRUE : FALSE, -1);
3078 gtk_tree_model_filter_refilter (filter);
3080 gtk_tree_store_set (GTK_TREE_STORE (model), &child_iters[i-2], 1,
3081 (i & 1) ? FALSE: TRUE, -1);
3082 gtk_tree_model_filter_refilter (filter);
3088 specific_bug_464173_visible_func (GtkTreeModel *model,
3092 gboolean *visible = (gboolean *)data;
3098 specific_bug_464173 (void)
3100 /* Test case for GNOME Bugzilla bug 464173, test case written
3101 * by Andreas Koehler.
3103 GtkTreeStore *model;
3104 GtkTreeModelFilter *f_model;
3105 GtkTreeIter iter1, iter2;
3106 GtkWidget *view G_GNUC_UNUSED;
3107 gboolean visible = TRUE;
3109 g_test_bug ("464173");
3111 model = gtk_tree_store_new (1, G_TYPE_STRING);
3112 gtk_tree_store_append (model, &iter1, NULL);
3113 gtk_tree_store_set (model, &iter1, 0, "Foo", -1);
3114 gtk_tree_store_append (model, &iter2, &iter1);
3115 gtk_tree_store_set (model, &iter2, 0, "Bar", -1);
3117 f_model = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (GTK_TREE_MODEL(model), NULL));
3118 gtk_tree_model_filter_set_visible_func (f_model,
3119 specific_bug_464173_visible_func,
3122 view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (f_model));
3125 gtk_tree_model_filter_refilter (f_model);
3130 specific_bug_540201_filter_func (GtkTreeModel *model,
3134 gboolean has_children;
3136 has_children = gtk_tree_model_iter_has_child (model, iter);
3138 return has_children;
3142 specific_bug_540201 (void)
3144 /* Test case for GNOME Bugzilla bug 540201, steps provided by
3147 GtkTreeIter iter, root;
3148 GtkTreeStore *store;
3149 GtkTreeModel *filter;
3151 GtkWidget *tree_view G_GNUC_UNUSED;
3153 g_test_bug ("540201");
3155 store = gtk_tree_store_new (1, G_TYPE_INT);
3157 gtk_tree_store_append (store, &root, NULL);
3158 gtk_tree_store_set (store, &root, 0, 33, -1);
3160 filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL);
3161 tree_view = gtk_tree_view_new_with_model (filter);
3163 gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
3164 specific_bug_540201_filter_func,
3167 gtk_tree_store_append (store, &iter, &root);
3168 gtk_tree_store_set (store, &iter, 0, 50, -1);
3170 gtk_tree_store_append (store, &iter, &root);
3171 gtk_tree_store_set (store, &iter, 0, 22, -1);
3174 gtk_tree_store_append (store, &root, NULL);
3175 gtk_tree_store_set (store, &root, 0, 33, -1);
3177 gtk_tree_store_append (store, &iter, &root);
3178 gtk_tree_store_set (store, &iter, 0, 22, -1);
3183 specific_bug_549287_visible_func (GtkTreeModel *model,
3187 gboolean result = FALSE;
3189 result = gtk_tree_model_iter_has_child (model, iter);
3195 specific_bug_549287 (void)
3197 /* Test case for GNOME Bugzilla bug 529287, provided by Julient Puydt */
3200 GtkTreeStore *store;
3201 GtkTreeModel *filtered;
3202 GtkWidget *view G_GNUC_UNUSED;
3204 GtkTreeIter *swap, *parent, *child;
3206 g_test_bug ("529287");
3208 store = gtk_tree_store_new (1, G_TYPE_STRING);
3209 filtered = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL);
3210 gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filtered),
3211 specific_bug_549287_visible_func,
3214 view = gtk_tree_view_new_with_model (filtered);
3216 for (i = 0; i < 4; i++)
3218 if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter))
3220 parent = gtk_tree_iter_copy (&iter);
3221 child = gtk_tree_iter_copy (&iter);
3223 while (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store),
3232 gtk_tree_store_append (store, child, parent);
3233 gtk_tree_store_set (store, child,
3237 gtk_tree_iter_free (parent);
3238 gtk_tree_iter_free (child);
3242 gtk_tree_store_append (store, &iter, NULL);
3243 gtk_tree_store_set (store, &iter,
3248 /* since we inserted something, we changed the visibility conditions: */
3249 gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filtered));
3256 register_filter_model_tests (void)
3258 g_test_add ("/TreeModelFilter/self/verify-test-suite",
3262 filter_test_teardown);
3264 g_test_add ("/TreeModelFilter/self/verify-test-suite/vroot/depth-1",
3265 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3267 verify_test_suite_vroot,
3268 filter_test_teardown);
3269 g_test_add ("/TreeModelFilter/self/verify-test-suite/vroot/depth-2",
3270 FilterTest, gtk_tree_path_new_from_indices (2, 3, -1),
3272 verify_test_suite_vroot,
3273 filter_test_teardown);
3276 g_test_add ("/TreeModelFilter/filled/hide-root-level",
3279 filled_hide_root_level,
3280 filter_test_teardown);
3281 g_test_add ("/TreeModelFilter/filled/hide-child-levels",
3284 filled_hide_child_levels,
3285 filter_test_teardown);
3287 g_test_add ("/TreeModelFilter/filled/hide-root-level/vroot",
3288 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3290 filled_vroot_hide_root_level,
3291 filter_test_teardown);
3292 g_test_add ("/TreeModelFilter/filled/hide-child-levels/vroot",
3293 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3295 filled_vroot_hide_child_levels,
3296 filter_test_teardown);
3299 g_test_add ("/TreeModelFilter/empty/show-nodes",
3301 filter_test_setup_empty,
3303 filter_test_teardown);
3304 g_test_add ("/TreeModelFilter/empty/show-multiple-nodes",
3306 filter_test_setup_empty,
3307 empty_show_multiple_nodes,
3308 filter_test_teardown);
3310 g_test_add ("/TreeModelFilter/empty/show-nodes/vroot",
3311 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3312 filter_test_setup_empty,
3313 empty_vroot_show_nodes,
3314 filter_test_teardown);
3315 g_test_add ("/TreeModelFilter/empty/show-multiple-nodes/vroot",
3316 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3317 filter_test_setup_empty,
3318 empty_vroot_show_multiple_nodes,
3319 filter_test_teardown);
3322 g_test_add ("/TreeModelFilter/unfiltered/hide-single",
3324 filter_test_setup_unfiltered,
3325 unfiltered_hide_single,
3326 filter_test_teardown);
3327 g_test_add ("/TreeModelFilter/unfiltered/hide-single-child",
3329 filter_test_setup_unfiltered,
3330 unfiltered_hide_single_child,
3331 filter_test_teardown);
3332 g_test_add ("/TreeModelFilter/unfiltered/hide-single-multi-level",
3334 filter_test_setup_unfiltered,
3335 unfiltered_hide_single_multi_level,
3336 filter_test_teardown);
3338 g_test_add ("/TreeModelFilter/unfiltered/hide-single/vroot",
3339 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3340 filter_test_setup_unfiltered,
3341 unfiltered_vroot_hide_single,
3342 filter_test_teardown);
3343 g_test_add ("/TreeModelFilter/unfiltered/hide-single-child/vroot",
3344 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3345 filter_test_setup_unfiltered,
3346 unfiltered_vroot_hide_single_child,
3347 filter_test_teardown);
3348 g_test_add ("/TreeModelFilter/unfiltered/hide-single-multi-level/vroot",
3349 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3350 filter_test_setup_unfiltered,
3351 unfiltered_vroot_hide_single_multi_level,
3352 filter_test_teardown);
3356 g_test_add ("/TreeModelFilter/unfiltered/show-single",
3358 filter_test_setup_empty_unfiltered,
3359 unfiltered_show_single,
3360 filter_test_teardown);
3361 g_test_add ("/TreeModelFilter/unfiltered/show-single-child",
3363 filter_test_setup_empty_unfiltered,
3364 unfiltered_show_single_child,
3365 filter_test_teardown);
3366 g_test_add ("/TreeModelFilter/unfiltered/show-single-multi-level",
3368 filter_test_setup_empty_unfiltered,
3369 unfiltered_show_single_multi_level,
3370 filter_test_teardown);
3372 g_test_add ("/TreeModelFilter/unfiltered/show-single/vroot",
3373 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3374 filter_test_setup_empty_unfiltered,
3375 unfiltered_vroot_show_single,
3376 filter_test_teardown);
3377 g_test_add ("/TreeModelFilter/unfiltered/show-single-child/vroot",
3378 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3379 filter_test_setup_empty_unfiltered,
3380 unfiltered_vroot_show_single_child,
3381 filter_test_teardown);
3382 g_test_add ("/TreeModelFilter/unfiltered/show-single-multi-level/vroot",
3383 FilterTest, gtk_tree_path_new_from_indices (2, -1),
3384 filter_test_setup_empty_unfiltered,
3385 unfiltered_vroot_show_single_multi_level,
3386 filter_test_teardown);
3388 /* Inserts in child models after creation of filter model */
3389 g_test_add_func ("/TreeModelFilter/insert/before",
3391 g_test_add_func ("/TreeModelFilter/insert/child",
3394 /* Removals from child model after creating of filter model */
3395 g_test_add_func ("/TreeModelFilter/remove/node",
3397 g_test_add_func ("/TreeModelFilter/remove/node-vroot",
3399 g_test_add_func ("/TreeModelFilter/remove/vroot-ancestor",
3400 remove_vroot_ancestor);
3403 g_test_add_func ("/TreeModelFilter/specific/path-dependent-filter",
3404 specific_path_dependent_filter);
3405 g_test_add_func ("/TreeModelFilter/specific/append-after-collapse",
3406 specific_append_after_collapse);
3407 g_test_add_func ("/TreeModelFilter/specific/sort-filter-remove-node",
3408 specific_sort_filter_remove_node);
3409 g_test_add_func ("/TreeModelFilter/specific/sort-filter-remove-root",
3410 specific_sort_filter_remove_root);
3411 g_test_add_func ("/TreeModelFilter/specific/root-mixed-visibility",
3412 specific_root_mixed_visibility);
3413 g_test_add_func ("/TreeModelFilter/specific/has-child-filter",
3414 specific_has_child_filter);
3415 g_test_add_func ("/TreeModelFilter/specific/root-has-child-filter",
3416 specific_root_has_child_filter);
3417 g_test_add_func ("/TreeModelFilter/specific/filter-add-child",
3418 specific_filter_add_child);
3419 g_test_add_func ("/TreeModelFilter/specific/list-store-clear",
3420 specific_list_store_clear);
3421 g_test_add_func ("/TreeModelFilter/specific/sort-ref-leaf-and-remove-ancestor",
3422 specific_sort_ref_leaf_and_remove_ancestor);
3423 g_test_add_func ("/TreeModelFilter/specific/ref-leaf-and-remove-ancestor",
3424 specific_ref_leaf_and_remove_ancestor);
3425 g_test_add_func ("/TreeModelFilter/specific/virtual-ref-leaf-and-remove-ancestor",
3426 specific_virtual_ref_leaf_and_remove_ancestor);
3428 g_test_add_func ("/TreeModelFilter/specific/bug-301558",
3429 specific_bug_301558);
3430 g_test_add_func ("/TreeModelFilter/specific/bug-311955",
3431 specific_bug_311955);
3432 g_test_add_func ("/TreeModelFilter/specific/bug-346800",
3433 specific_bug_346800);
3434 g_test_add_func ("/TreeModelFilter/specific/bug-464173",
3435 specific_bug_464173);
3436 g_test_add_func ("/TreeModelFilter/specific/bug-540201",
3437 specific_bug_540201);
3438 g_test_add_func ("/TreeModelFilter/specific/bug-549287",
3439 specific_bug_549287);