diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2014-04-29 16:22:32 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2014-05-01 17:59:53 -0300 |
commit | 49fa04212b644f19ce576a8011e3f4fcda6a0806 (patch) | |
tree | bcd193c9b4c61aff1638208d5a1e517a326af6db /testsuite | |
parent | c4afca906c2ea02ae7a261d2e7e0c8902f3f09e5 (diff) | |
download | gtk+-49fa04212b644f19ce576a8011e3f4fcda6a0806.tar.gz |
GtkBuilder: improved parsing error report for invalid properties and signals.
Added GTK_BUILDER_ERROR_INVALID_PROPERTY and GTK_BUILDER_ERROR_INVALID_SIGNAL
error codes
ObjectInfo: Use a GType instead of a char * for the class name.
PropertyInfo: Use a GParamSpec instead of a char * for the property name.
SignalInfo: Use signal id and detail quark instead of a detailed signal name string.
This not only save us a few malloc in each case but lets us simplify the code
and report unknown properties and signals as a parsing error instead of just
printing a warning.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/gtk/builder.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/gtk/builder.c b/testsuite/gtk/builder.c index 74da1b3113..3d6f9e742a 100644 --- a/testsuite/gtk/builder.c +++ b/testsuite/gtk/builder.c @@ -131,6 +131,20 @@ test_parser (void) GTK_BUILDER_ERROR_DUPLICATE_ID)); g_error_free (error); + error = NULL; + gtk_builder_add_from_string (builder, "<interface><object class=\"GtkButton\" id=\"a\"><property name=\"deafbeef\"></property></object></interface>", -1, &error); + g_assert (g_error_matches (error, + GTK_BUILDER_ERROR, + GTK_BUILDER_ERROR_INVALID_PROPERTY)); + g_error_free (error); + + error = NULL; + gtk_builder_add_from_string (builder, "<interface><object class=\"GtkButton\" id=\"a\"><signal name=\"deafbeef\" handler=\"gtk_true\"/></object></interface>", -1, &error); + g_assert (g_error_matches (error, + GTK_BUILDER_ERROR, + GTK_BUILDER_ERROR_INVALID_SIGNAL)); + g_error_free (error); + g_object_unref (builder); } |