Commit 61033168 authored by Johan Dahlin's avatar Johan Dahlin

Add a test to check object properties

    * tests/buildertest.c (test_object_properties): 
    Add a test to check object properties


svn path=/trunk/; revision=18253
parent ae800a34
2007-06-26 Johan Dahlin <jdahlin@async.com.br>
* tests/buildertest.c (test_object_properties):
Add a test to check object properties
* gtk/gtkbuilder.h (enum):
* gtk/gtkbuilderparser.c (end_element):
* tests/buildertest.c (test_parser):
Set an error if we encounter properties without values set
(#451303, Philip Withnall)
(test_object_properties): Add a test
* demos/gtk-demo/builder.c (do_builder): Connect the
destroy signal in the example instead of the ui file.
Also set the screen and title of the window.
......
......@@ -761,6 +761,41 @@ gboolean test_construct_only_property (void)
return TRUE;
}
gboolean test_object_properties (void)
{
GtkBuilder *builder;
const gchar buffer[] =
"<interface>"
" <object class=\"GtkWindow\" id=\"window1\">"
" <child>"
" <object class=\"GtkVBox\" id=\"vbox\">"
" <property name=\"border-width\">10</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label1\">"
" <property name=\"mnemonic-widget\">spinbutton1</property>"
" </object>"
" </child>"
" <child>"
" <object class=\"GtkSpinButton\" id=\"spinbutton1\"/>"
" </child>"
" </object>"
" </child>"
" </object>"
"</interface>";
GObject *label, *spinbutton;
builder = builder_new_from_string (buffer, -1, NULL);
label = gtk_builder_get_object (builder, "label1");
g_return_val_if_fail (label != NULL, FALSE);
spinbutton = gtk_builder_get_object (builder, "spinbutton1");
g_return_val_if_fail (spinbutton != NULL, FALSE);
g_return_val_if_fail (spinbutton == (GObject*)gtk_label_get_mnemonic_widget (GTK_LABEL (label)), FALSE);
g_object_unref (builder);
return TRUE;
}
gboolean test_children (void)
{
GtkBuilder * builder;
......@@ -1474,6 +1509,10 @@ main (int argc, char **argv)
if (!test_child_properties ())
g_error ("test_child_properties failed");
g_print ("Testing object properties\n");
if (!test_object_properties ())
g_error ("test_object_properties failed");
g_print ("Testing notebook\n");
if (!test_notebook ())
g_error ("test_notebook failed");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment