From 4dc162f4e4f52b69f9fa6008999c1bda338306e2 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Sun, 28 Aug 2011 23:52:03 -0400 Subject: [PATCH] Testing for Inform 7 bug #731 http://inform7.com/mantis/view.php?id=731 --- tests/test-close.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/tests/test-close.c b/tests/test-close.c index fc30203..68ea15f 100644 --- a/tests/test-close.c +++ b/tests/test-close.c @@ -13,10 +13,24 @@ on_command(ChimaraIF *glk, gchar *input, gchar *response, GtkWindow *window) gtk_widget_destroy(dialog); } +void +on_stop(GtkButton *button, ChimaraIF *glk) +{ + chimara_glk_stop(CHIMARA_GLK(glk)); + chimara_glk_wait(CHIMARA_GLK(glk)); +} + +void +on_go(GtkButton *button, ChimaraIF *glk) +{ + on_stop(button, glk); + g_assert(chimara_if_run_game(CHIMARA_IF(glk), "unicodetest.ulx", NULL)); +} + int main(int argc, char *argv[]) { - GtkWidget *window, *glk; + GtkWidget *window, *vbox, *hbox, *stop, *go, *glk; /* Initialize threads and GTK */ if(!g_thread_supported()) @@ -29,9 +43,20 @@ main(int argc, char *argv[]) window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window), 400, 400); g_signal_connect(window, "delete-event", G_CALLBACK(gtk_main_quit), NULL); + vbox = gtk_vbox_new(FALSE, 6); glk = chimara_if_new(); - g_signal_connect(glk, "command", G_CALLBACK(on_command), window); - gtk_container_add(GTK_CONTAINER(window), glk); + //g_signal_connect(glk, "command", G_CALLBACK(on_command), window); + hbox = gtk_hbutton_box_new(); + stop = gtk_button_new_with_label("Stop"); + g_signal_connect(stop, "clicked", G_CALLBACK(on_stop), glk); + go = gtk_button_new_with_label("Go"); + g_signal_connect(go, "clicked", G_CALLBACK(on_go), glk); + + gtk_box_pack_start(GTK_BOX(hbox), stop, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), go, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), glk, TRUE, TRUE, 0); + gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show_all(window); /* Add a reference to the ChimaraGlk widget, because we want to keep it -- 2.30.2