[gtk+/composite-templates] Added signal data test to test_expose_object()
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/composite-templates] Added signal data test to test_expose_object()
- Date: Mon, 12 Nov 2012 19:49:18 +0000 (UTC)
commit 1fbd4c799bad5c887834e05392b2da7b3a0808c0
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Mon Nov 12 16:48:46 2012 -0300
Added signal data test to test_expose_object()
gtk/tests/builder.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gtk/tests/builder.c b/gtk/tests/builder.c
index f87b4d6..a1c08b9 100644
--- a/gtk/tests/builder.c
+++ b/gtk/tests/builder.c
@@ -2845,6 +2845,20 @@ test_template (void)
test_template_real (TRUE);
}
+static GObject *external_object = NULL, *external_object_swapped = NULL;
+
+void
+on_button_clicked (GtkButton *button, GObject *data)
+{
+ external_object = data;
+}
+
+void
+on_button_clicked_swapped (GObject *data, GtkButton *button)
+{
+ external_object_swapped = data;
+}
+
static void
test_expose_object (void)
{
@@ -2856,12 +2870,15 @@ test_expose_object (void)
"<interface>"
" <object class=\"GtkButton\" id=\"button\">"
" <property name=\"image\" external-object=\"True\">external_image</property>"
+ " <signal name=\"clicked\" handler=\"on_button_clicked\" object=\"builder\" external-object=\"yes\" swapped=\"no\"/>"
+ " <signal name=\"clicked\" handler=\"on_button_clicked_swapped\" object=\"builder\" external-object=\"yes\"/>"
" </object>"
"</interface>";
image = gtk_image_new ();
builder = gtk_builder_new ();
gtk_builder_expose_object (builder, "external_image", G_OBJECT (image));
+ gtk_builder_expose_object (builder, "builder", G_OBJECT (builder));
gtk_builder_add_from_string (builder, buffer, -1, &error);
g_assert (error == NULL);
@@ -2869,6 +2886,13 @@ test_expose_object (void)
g_assert (GTK_IS_BUTTON (obj));
g_assert (gtk_button_get_image (GTK_BUTTON (obj)) == image);
+
+ /* Connect signals and fake clicked event */
+ gtk_builder_connect_signals (builder, NULL);
+ gtk_button_clicked (GTK_BUTTON (obj));
+
+ g_assert (external_object == G_OBJECT (builder));
+ g_assert (external_object_swapped == G_OBJECT (builder));
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]