diff options
Diffstat (limited to 'gobject/tests/type.c')
-rw-r--r-- | gobject/tests/type.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gobject/tests/type.c b/gobject/tests/type.c index 30e138a77..458bb6bf1 100644 --- a/gobject/tests/type.c +++ b/gobject/tests/type.c @@ -185,7 +185,7 @@ test_interface_check (void) check_called = 0; g_type_add_interface_check (&check_called, check_func); - o = g_object_new (bazo_get_type (), NULL); + o = g_object_ref_sink (g_object_new (bazo_get_type (), NULL)); g_object_unref (o); g_assert_cmpint (check_called, ==, 1); g_type_remove_interface_check (&check_called, check_func); @@ -201,6 +201,20 @@ test_next_base (void) g_assert (type == G_TYPE_INITIALLY_UNOWNED); } +/* Test that the macro an function versions of g_type_is_a + * work the same + */ +static void +test_is_a (void) +{ + g_assert_true (g_type_is_a (G_TYPE_OBJECT, G_TYPE_OBJECT)); + g_assert_true ((g_type_is_a) (G_TYPE_OBJECT, G_TYPE_OBJECT)); + g_assert_true (g_type_is_a (bar_get_type (), G_TYPE_OBJECT)); + g_assert_true ((g_type_is_a) (bar_get_type (), G_TYPE_OBJECT)); + g_assert_false (g_type_is_a (bar_get_type (), bibi_get_type ())); + g_assert_false ((g_type_is_a) (bar_get_type (), bibi_get_type ())); +} + int main (int argc, char *argv[]) { @@ -210,6 +224,7 @@ main (int argc, char *argv[]) g_test_add_func ("/type/interface-prerequisite", test_interface_prerequisite); g_test_add_func ("/type/interface-check", test_interface_check); g_test_add_func ("/type/next-base", test_next_base); + g_test_add_func ("/type/is-a", test_is_a); return g_test_run (); } |