forked from AuroraMiddleware/gtk
Move asserts to gtktreemodelrefcount.h for other unit tests to use
This commit is contained in:
parent
bda09159c3
commit
d241323b08
@ -62,4 +62,82 @@ gboolean gtk_tree_model_ref_count_check_node (GtkTreeModelRefCount *ref_mo
|
|||||||
GtkTreeIter *iter,
|
GtkTreeIter *iter,
|
||||||
gint expected_ref_count);
|
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__ */
|
#endif /* __GTK_TREE_MODEL_REF_COUNT_H__ */
|
||||||
|
@ -20,80 +20,6 @@
|
|||||||
#include "gtktreemodelrefcount.h"
|
#include "gtktreemodelrefcount.h"
|
||||||
#include "treemodel.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 */
|
/* And the tests themselves */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user