[gtk+] One more unit test
- From: Paolo Borelli <pborelli src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] One more unit test
- Date: Mon, 7 Sep 2009 09:17:47 +0000 (UTC)
commit 4e78b4c7d194d33377c6203ef4c4c434303afc75
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Sep 7 11:16:33 2009 +0200
One more unit test
gtk/tests/expander.c | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/gtk/tests/expander.c b/gtk/tests/expander.c
index 00b9ea1..853b20a 100644
--- a/gtk/tests/expander.c
+++ b/gtk/tests/expander.c
@@ -26,7 +26,7 @@
#include <gtk/gtk.h>
static void
-test_click (void)
+test_click_expander (void)
{
GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test click on expander");
GtkWidget *expander = gtk_expander_new ("Test Expander");
@@ -57,11 +57,38 @@ test_click (void)
g_assert (!expanded);
}
+static void
+test_click_content_widget (void)
+{
+ GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test click on content widget");
+ GtkWidget *expander = gtk_expander_new ("Test Expander");
+ GtkWidget *entry = gtk_entry_new ();
+ gboolean expanded;
+ gboolean simsuccess;
+ gtk_container_add (GTK_CONTAINER (expander), entry);
+ gtk_container_add (GTK_CONTAINER (GTK_BIN (window)->child), expander);
+ gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
+ gtk_widget_show (expander);
+ gtk_widget_show (entry);
+ gtk_widget_show_now (window);
+
+ /* check click on content with expander open */
+ expanded = gtk_expander_get_expanded (GTK_EXPANDER (expander));
+ g_assert (expanded);
+ simsuccess = gtk_test_widget_click (entry, 1, 0);
+ g_assert (simsuccess == TRUE);
+ while (gtk_events_pending ()) /* let expander timeout/idle handlers update */
+ gtk_main_iteration ();
+ expanded = gtk_expander_get_expanded (GTK_EXPANDER (expander));
+ g_assert (expanded);
+}
+
int
main (int argc,
char *argv[])
{
gtk_test_init (&argc, &argv);
- g_test_add_func ("/expander/click", test_click);
+ g_test_add_func ("/expander/click-expander", test_click_expander);
+ g_test_add_func ("/expander/click-content-widget", test_click_content_widget);
return g_test_run();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]