mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-13 11:15:12 +01:00
girepository: Add baseline tests for gi_callable_info_is_method()
This tests existing functionality.
This commit is contained in:
parent
3d71dcaa64
commit
fe142e3b32
@ -124,6 +124,65 @@ test_callable_get_async_function_for_sync_function (RepositoryFixture *fx,
|
||||
gi_base_info_unref (info);
|
||||
}
|
||||
|
||||
static void
|
||||
test_callable_info_is_method (RepositoryFixture *fx,
|
||||
const void *unused)
|
||||
{
|
||||
GIBaseInfo *info;
|
||||
GIFunctionInfo *func_info;
|
||||
GIVFuncInfo *vfunc_info;
|
||||
GISignalInfo *sig_info;
|
||||
GIBaseInfo *cb_info;
|
||||
|
||||
info = gi_repository_find_by_name (fx->repository, "Gio", "ActionGroup");
|
||||
g_assert_nonnull (info);
|
||||
|
||||
func_info = gi_interface_info_find_method (GI_INTERFACE_INFO (info), "action_added");
|
||||
g_assert_nonnull (func_info);
|
||||
|
||||
g_assert_true (gi_callable_info_is_method (GI_CALLABLE_INFO (func_info)));
|
||||
|
||||
vfunc_info = gi_interface_info_find_vfunc (GI_INTERFACE_INFO (info), "action_added");
|
||||
g_assert_nonnull (vfunc_info);
|
||||
|
||||
g_assert_true (gi_callable_info_is_method (GI_CALLABLE_INFO (vfunc_info)));
|
||||
|
||||
sig_info = gi_interface_info_find_signal (GI_INTERFACE_INFO (info), "action-added");
|
||||
g_assert_nonnull (sig_info);
|
||||
|
||||
g_assert_true (gi_callable_info_is_method (GI_CALLABLE_INFO (sig_info)));
|
||||
|
||||
cb_info = gi_repository_find_by_name (fx->repository, "Gio", "AsyncReadyCallback");
|
||||
g_assert_nonnull (cb_info);
|
||||
|
||||
g_assert_false (gi_callable_info_is_method (GI_CALLABLE_INFO (cb_info)));
|
||||
|
||||
gi_base_info_unref (info);
|
||||
gi_base_info_unref ((GIBaseInfo *) func_info);
|
||||
gi_base_info_unref ((GIBaseInfo *) vfunc_info);
|
||||
gi_base_info_unref ((GIBaseInfo *) sig_info);
|
||||
gi_base_info_unref (cb_info);
|
||||
}
|
||||
|
||||
static void
|
||||
test_callable_info_static_method (RepositoryFixture *fx,
|
||||
const void *unused)
|
||||
{
|
||||
GIBaseInfo *info;
|
||||
GIFunctionInfo *func_info;
|
||||
|
||||
info = gi_repository_find_by_name (fx->repository, "Gio", "Application");
|
||||
g_assert_nonnull (info);
|
||||
|
||||
func_info = gi_object_info_find_method (GI_OBJECT_INFO (info), "get_default");
|
||||
g_assert_nonnull (func_info);
|
||||
|
||||
g_assert_false (gi_callable_info_is_method (GI_CALLABLE_INFO (func_info)));
|
||||
|
||||
gi_base_info_unref (info);
|
||||
gi_base_info_unref ((GIBaseInfo *) func_info);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@ -131,6 +190,8 @@ main (int argc, char **argv)
|
||||
|
||||
ADD_REPOSITORY_TEST ("/callable-info/sync-function", test_callable_get_sync_function_for_async_function, &typelib_load_spec_gio);
|
||||
ADD_REPOSITORY_TEST ("/callable-info/async-function", test_callable_get_async_function_for_sync_function, &typelib_load_spec_gio);
|
||||
ADD_REPOSITORY_TEST ("/callable-info/is-method", test_callable_info_is_method, &typelib_load_spec_gio);
|
||||
ADD_REPOSITORY_TEST ("/callable-info/static-method", test_callable_info_static_method, &typelib_load_spec_gio);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user