[gtk+] Update filtermodel ref count unit tests to new cache depth



commit 04885f1c2922ac735b771e76b025182939503d0f
Author: Kristian Rietveld <kris gtk org>
Date:   Sat Aug 20 10:55:27 2011 +0200

    Update filtermodel ref count unit tests to new cache depth

 gtk/tests/filtermodel.c |   49 ++++++++++++++++++++--------------------------
 1 files changed, 21 insertions(+), 28 deletions(-)
---
diff --git a/gtk/tests/filtermodel.c b/gtk/tests/filtermodel.c
index 13f96af..41ed858 100644
--- a/gtk/tests/filtermodel.c
+++ b/gtk/tests/filtermodel.c
@@ -2680,11 +2680,10 @@ ref_count_two_levels (void)
 
   gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
 
-  /* The first two levels should not be cleared, these are used to
-   * monitor whether or not the parent must become (in)visible.
-   */
-  assert_root_level_referenced (ref_model, 1);
-  assert_node_ref_count (ref_model, &iter_first, 1);
+  /* Only the reference on the first node of the root level is kept. */
+  assert_node_ref_count (ref_model, &parent1, 1);
+  assert_node_ref_count (ref_model, &parent2, 0);
+  assert_node_ref_count (ref_model, &iter_first, 0);
   assert_node_ref_count (ref_model, &iter, 0);
 
   g_object_unref (filter_model);
@@ -2774,10 +2773,10 @@ ref_count_three_levels (void)
 
   assert_node_ref_count (ref_model, &grandparent1, 2);
   assert_node_ref_count (ref_model, &grandparent2, 2);
-  assert_node_ref_count (ref_model, &parent1, 2);
-  assert_node_ref_count (ref_model, &parent2, 1);
-  assert_node_ref_count (ref_model, &iter_parent1, 1);
-  assert_node_ref_count (ref_model, &iter_parent2_first, 1);
+  assert_node_ref_count (ref_model, &parent1, 1);
+  assert_node_ref_count (ref_model, &parent2, 0);
+  assert_node_ref_count (ref_model, &iter_parent1, 0);
+  assert_node_ref_count (ref_model, &iter_parent2_first, 0);
   assert_node_ref_count (ref_model, &iter_parent2, 0);
 
   gtk_tree_view_expand_row (GTK_TREE_VIEW (tree_view), path, FALSE);
@@ -2837,22 +2836,20 @@ ref_count_three_levels (void)
 
   assert_node_ref_count (ref_model, &grandparent1, 2);
   assert_node_ref_count (ref_model, &grandparent2, 2);
-  assert_node_ref_count (ref_model, &parent1, 2);
-  assert_node_ref_count (ref_model, &parent2, 1);
-  assert_node_ref_count (ref_model, &iter_parent1, 1);
-  assert_node_ref_count (ref_model, &iter_parent2_first, 1);
+  assert_node_ref_count (ref_model, &parent1, 1);
+  assert_node_ref_count (ref_model, &parent2, 0);
+  assert_node_ref_count (ref_model, &iter_parent1, 0);
+  assert_node_ref_count (ref_model, &iter_parent2_first, 0);
   assert_node_ref_count (ref_model, &iter_parent2, 0);
 
   gtk_widget_destroy (tree_view);
 
   gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
 
-  /* The first two levels should not be cleared, these are used to
-   * monitor whether or not the parent must become (in)visible.
-   */
+  /* Only the reference on the first node of the root level is kept. */
   assert_node_ref_count (ref_model, &grandparent1, 1);
-  assert_node_ref_count (ref_model, &grandparent2, 1);
-  assert_node_ref_count (ref_model, &parent1, 1);
+  assert_node_ref_count (ref_model, &grandparent2, 0);
+  assert_node_ref_count (ref_model, &parent1, 0);
   assert_node_ref_count (ref_model, &parent2, 0);
   assert_node_ref_count (ref_model, &iter_parent1, 0);
   assert_node_ref_count (ref_model, &iter_parent2_first, 0);
@@ -3006,12 +3003,10 @@ ref_count_cleanup (void)
 
   gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
 
-  /* The first two levels should not be cleared, these are used to
-   * monitor whether or not the parent must become (in)visible.
-   */
+  /* Only the reference on the first node of the root level is kept. */
   assert_node_ref_count (ref_model, &grandparent1, 1);
-  assert_node_ref_count (ref_model, &grandparent2, 1);
-  assert_node_ref_count (ref_model, &parent1, 1);
+  assert_node_ref_count (ref_model, &grandparent2, 0);
+  assert_node_ref_count (ref_model, &parent1, 0);
   assert_node_ref_count (ref_model, &parent2, 0);
   assert_node_ref_count (ref_model, &iter_parent1, 0);
   assert_node_ref_count (ref_model, &iter_parent2_first, 0);
@@ -3108,12 +3103,10 @@ ref_count_row_ref (void)
 
   gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
 
-  /* The first two levels should not be cleared, these are used to
-   * monitor whether or not the parent must become (in)visible.
-   */
+  /* Only the reference on the first node of the root level is kept. */
   assert_node_ref_count (ref_model, &grandparent1, 1);
-  assert_node_ref_count (ref_model, &grandparent2, 1);
-  assert_node_ref_count (ref_model, &parent1, 1);
+  assert_node_ref_count (ref_model, &grandparent2, 0);
+  assert_node_ref_count (ref_model, &parent1, 0);
 
   g_object_unref (filter_model);
   g_object_unref (ref_model);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]