diff options
author | Johan Dahlin <johan@src.gnome.org> | 2007-06-27 18:07:50 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2007-06-27 18:07:50 +0000 |
commit | ec3bb3775915004fea3b51687814646ddfc7ea71 (patch) | |
tree | 1eaba94ccb6c6dde40581d6074735bace74e5348 /tests | |
parent | 2fc1ae81344ec4bd58b5a505c11c444bec363077 (diff) | |
download | gtk+-ec3bb3775915004fea3b51687814646ddfc7ea71.tar.gz |
Add GtkBuilder and GError arguments to gtk_builder_value_from_string and
* gtk/gtkbuilder.c: (gtk_builder_get_parameters),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type):
* gtk/gtkbuilder.h:
* gtk/gtkcontainer.c: (gtk_container_buildable_set_child_property),
(attributes_text_element):
* gtk/gtkliststore.c: (list_store_text):
* tests/buildertest.c: (test_value_from_string):
Add GtkBuilder and GError arguments to gtk_builder_value_from_string
and gtk_builder_value_from_string_type. (#451428)
svn path=/trunk/; revision=18262
Diffstat (limited to 'tests')
-rw-r--r-- | tests/buildertest.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/tests/buildertest.c b/tests/buildertest.c index 199ee376ad..759f4bcb63 100644 --- a/tests/buildertest.c +++ b/tests/buildertest.c @@ -1416,71 +1416,84 @@ static gboolean test_value_from_string (void) { GValue value = { 0 }; + GError *error = NULL; + GtkBuilder *builder; - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_STRING, "test", &value), FALSE); + builder = gtk_builder_new (); + + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_STRING, "test", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_STRING (&value), FALSE); g_return_val_if_fail (strcmp (g_value_get_string (&value), "test") == 0, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_BOOLEAN, "true", &value), FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "true", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&value), FALSE); g_return_val_if_fail (g_value_get_boolean (&value) == TRUE, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_BOOLEAN, "false", &value), FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "false", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&value), FALSE); g_return_val_if_fail (g_value_get_boolean (&value) == FALSE, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_BOOLEAN, "yes", &value), FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "yes", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&value), FALSE); g_return_val_if_fail (g_value_get_boolean (&value) == TRUE, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_BOOLEAN, "no", &value), FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "no", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&value), FALSE); g_return_val_if_fail (g_value_get_boolean (&value) == FALSE, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_BOOLEAN, "0", &value), FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "0", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&value), FALSE); g_return_val_if_fail (g_value_get_boolean (&value) == FALSE, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_BOOLEAN, "1", &value), FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "1", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&value), FALSE); g_return_val_if_fail (g_value_get_boolean (&value) == TRUE, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_BOOLEAN, "blaurgh", &value) == FALSE, FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "blaurgh", &value, &error) == FALSE, FALSE); + g_return_val_if_fail (error != NULL, FALSE); g_value_unset (&value); + g_error_free (error); + error = NULL; - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_INT, "12345", &value), FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_INT, "12345", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_INT (&value), FALSE); g_return_val_if_fail (g_value_get_int (&value) == 12345, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_LONG, "9912345", &value), FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_LONG, "9912345", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_LONG (&value), FALSE); g_return_val_if_fail (g_value_get_long (&value) == 9912345, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_UINT, "2345", &value), FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_UINT, "2345", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_UINT (&value), FALSE); g_return_val_if_fail (g_value_get_uint (&value) == 2345, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_FLOAT, "1.454", &value), FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_FLOAT, "1.454", &value, &error), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_FLOAT (&value), FALSE); g_return_val_if_fail (fabs (g_value_get_float (&value) - 1.454) < 0.00001, FALSE); g_value_unset (&value); - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_FLOAT, "abc", &value) == FALSE, FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_FLOAT, "abc", &value, &error) == FALSE, FALSE); g_value_unset (&value); + g_error_free (error); + error = NULL; - g_return_val_if_fail (gtk_builder_value_from_string_type (G_TYPE_INT, "/-+,abc", &value) == FALSE, FALSE); + g_return_val_if_fail (gtk_builder_value_from_string_type (builder, G_TYPE_INT, "/-+,abc", &value, &error) == FALSE, FALSE); g_value_unset (&value); + g_error_free (error); + error = NULL; + g_object_unref (builder); + return TRUE; } |