diff --git a/gtk/tests/gtktreemodelrefcount.h b/gtk/tests/gtktreemodelrefcount.h index c8c8e89dfd..5d457622b8 100644 --- a/gtk/tests/gtktreemodelrefcount.h +++ b/gtk/tests/gtktreemodelrefcount.h @@ -62,4 +62,82 @@ gboolean gtk_tree_model_ref_count_check_node (GtkTreeModelRefCount *ref_mo GtkTreeIter *iter, gint expected_ref_count); +/* A couple of helpers for the tests. Since this model will never be used + * outside of unit tests anyway, it is probably fine to have these here + * without namespacing. + */ + +static inline void +assert_entire_model_unreferenced (GtkTreeModelRefCount *ref_model) +{ + g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, 0, + TRUE), + ==, TRUE); +} + +static inline void +assert_root_level_unreferenced (GtkTreeModelRefCount *ref_model) +{ + g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, 0, + FALSE), + ==, TRUE); +} + +static inline void +assert_level_unreferenced (GtkTreeModelRefCount *ref_model, + GtkTreeIter *iter) +{ + g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, iter, + 0, FALSE), + ==, TRUE); +} + +static inline void +assert_entire_model_referenced (GtkTreeModelRefCount *ref_model, + gint ref_count) +{ + g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, + ref_count, TRUE), + ==, TRUE); +} + +static inline void +assert_not_entire_model_referenced (GtkTreeModelRefCount *ref_model, + gint ref_count) +{ + g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, + ref_count, TRUE), + ==, FALSE); +} + +static inline void +assert_root_level_referenced (GtkTreeModelRefCount *ref_model, + gint ref_count) +{ + g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, + ref_count, FALSE), + ==, TRUE); +} + +static inline void +assert_level_referenced (GtkTreeModelRefCount *ref_model, + gint ref_count, + GtkTreeIter *iter) +{ + g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, iter, + ref_count, FALSE), + ==, TRUE); +} + +static inline void +assert_node_ref_count (GtkTreeModelRefCount *ref_model, + GtkTreeIter *iter, + gint ref_count) +{ + g_assert_cmpint (gtk_tree_model_ref_count_check_node (ref_model, iter, + ref_count), + ==, TRUE); +} + + #endif /* __GTK_TREE_MODEL_REF_COUNT_H__ */ diff --git a/gtk/tests/modelrefcount.c b/gtk/tests/modelrefcount.c index c94d60f7e6..f1c9d7ac83 100644 --- a/gtk/tests/modelrefcount.c +++ b/gtk/tests/modelrefcount.c @@ -20,80 +20,6 @@ #include "gtktreemodelrefcount.h" #include "treemodel.h" -/* A couple of helpers for the tests */ - -static inline void -assert_entire_model_unreferenced (GtkTreeModelRefCount *ref_model) -{ - g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, 0, - TRUE), - ==, TRUE); -} - -static inline void -assert_root_level_unreferenced (GtkTreeModelRefCount *ref_model) -{ - g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, 0, - FALSE), - ==, TRUE); -} - -static inline void -assert_level_unreferenced (GtkTreeModelRefCount *ref_model, - GtkTreeIter *iter) -{ - g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, iter, - 0, FALSE), - ==, TRUE); -} - -static inline void -assert_entire_model_referenced (GtkTreeModelRefCount *ref_model, - gint ref_count) -{ - g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, - ref_count, TRUE), - ==, TRUE); -} - - static inline void -assert_not_entire_model_referenced (GtkTreeModelRefCount *ref_model, - gint ref_count) -{ - g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, - ref_count, TRUE), - ==, FALSE); -} - -static inline void -assert_root_level_referenced (GtkTreeModelRefCount *ref_model, - gint ref_count) -{ - g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, - ref_count, FALSE), - ==, TRUE); -} - -static inline void -assert_level_referenced (GtkTreeModelRefCount *ref_model, - gint ref_count, - GtkTreeIter *iter) -{ - g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, iter, - ref_count, FALSE), - ==, TRUE); -} - -static inline void -assert_node_ref_count (GtkTreeModelRefCount *ref_model, - GtkTreeIter *iter, - gint ref_count) -{ - g_assert_cmpint (gtk_tree_model_ref_count_check_node (ref_model, iter, - ref_count), - ==, TRUE); -} - /* And the tests themselves */ static void