From 3a01629955bb3cc5691861f0d89091898f0af81a Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Sun, 4 Feb 2024 10:16:31 -0800 Subject: [PATCH] girepository: Fix copy-paste error in type check macro GI_IS_REGISTERED_TYPE_INFO() wasn't working because it was actually defined to be the same as GI_IS_OBJECT_INFO(). Add some desultory type-checking assertions to the repository tests. --- girepository/giregisteredtypeinfo.h | 2 +- girepository/tests/repository.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/girepository/giregisteredtypeinfo.h b/girepository/giregisteredtypeinfo.h index 4ee6455e4..2745fef79 100644 --- a/girepository/giregisteredtypeinfo.h +++ b/girepository/giregisteredtypeinfo.h @@ -58,7 +58,7 @@ G_BEGIN_DECLS * * Since: 2.80 */ -#define GI_IS_REGISTERED_TYPE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_OBJECT_INFO)) +#define GI_IS_REGISTERED_TYPE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_REGISTERED_TYPE_INFO)) GI_AVAILABLE_IN_ALL const char * gi_registered_type_info_get_type_name (GIRegisteredTypeInfo *info); diff --git a/girepository/tests/repository.c b/girepository/tests/repository.c index 48c1def31..822eb2ff9 100644 --- a/girepository/tests/repository.c +++ b/girepository/tests/repository.c @@ -90,6 +90,9 @@ test_repository_info (RepositoryFixture *fx, object_info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "GObject", "Object")); g_assert_nonnull (object_info); + g_assert_true (GI_IS_OBJECT_INFO (object_info)); + g_assert_true (GI_IS_REGISTERED_TYPE_INFO (object_info)); + g_assert_true (GI_IS_BASE_INFO (object_info)); g_assert_cmpint (gi_base_info_get_info_type (GI_BASE_INFO (object_info)), ==, GI_INFO_TYPE_OBJECT); g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (object_info)), ==, "Object"); @@ -103,6 +106,9 @@ test_repository_info (RepositoryFixture *fx, signal_info = gi_object_info_find_signal (object_info, "notify"); g_assert_nonnull (signal_info); + g_assert_true (GI_IS_SIGNAL_INFO (signal_info)); + g_assert_true (GI_IS_CALLABLE_INFO (signal_info)); + g_assert_true (GI_IS_BASE_INFO (signal_info)); g_assert_cmpint (gi_signal_info_get_flags (signal_info), ==, G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS | G_SIGNAL_ACTION); @@ -111,6 +117,10 @@ test_repository_info (RepositoryFixture *fx, method_info = gi_object_info_find_method (object_info, "get_property"); g_assert_nonnull (method_info); + g_assert_true (GI_IS_FUNCTION_INFO (method_info)); + g_assert_true (GI_IS_CALLABLE_INFO (method_info)); + g_assert_true (GI_IS_BASE_INFO (method_info)); + g_assert_true (gi_callable_info_is_method (GI_CALLABLE_INFO (method_info))); g_assert_cmpuint (gi_callable_info_get_n_args (GI_CALLABLE_INFO (method_info)), ==, 2); g_clear_pointer (&method_info, gi_base_info_unref);