mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 19:22:11 +01:00
Merge branch 'null-param-handle-test' into 'main'
gobject/tests/param: Add unit test for handling invalid NULL param spec See merge request GNOME/glib!2939
This commit is contained in:
commit
90ae06a9f6
@ -349,6 +349,25 @@ test_param_spec_param (void)
|
||||
g_param_spec_unref (wrapped_pspec_uint);
|
||||
}
|
||||
|
||||
static void
|
||||
test_param_spec_null_param (void)
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
pspec = g_param_spec_param ("param", NULL, NULL,
|
||||
G_TYPE_PARAM_POINTER, G_PARAM_READWRITE);
|
||||
|
||||
g_assert_cmpstr (g_param_spec_get_name (pspec), ==, "param");
|
||||
|
||||
g_value_init (&value, G_TYPE_PARAM_POINTER);
|
||||
g_assert_false (g_param_value_is_valid (pspec, &value));
|
||||
g_assert_false (g_param_value_validate (pspec, &value));
|
||||
|
||||
g_value_unset (&value);
|
||||
g_param_spec_unref (pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
test_param_spec_string (void)
|
||||
{
|
||||
@ -1654,6 +1673,7 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/paramspec/double", test_param_spec_double);
|
||||
g_test_add_func ("/paramspec/unichar", test_param_spec_unichar);
|
||||
g_test_add_func ("/paramspec/param", test_param_spec_param);
|
||||
g_test_add_func ("/paramspec/null-param", test_param_spec_null_param);
|
||||
g_test_add_func ("/paramspec/string", test_param_spec_string);
|
||||
g_test_add_func ("/paramspec/override", test_param_spec_override);
|
||||
g_test_add_func ("/paramspec/gtype", test_param_spec_gtype);
|
||||
|
Loading…
x
Reference in New Issue
Block a user