From: P. F. Chimento Date: Fri, 19 Nov 2010 21:55:32 +0000 (+0100) Subject: Added test case for crash in ChimaraIF::command X-Git-Tag: v0.9~169 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=f9b46cd789c76c22dcb118e376ddf6b0f4d16f62;hp=5140be18f4a2b3e053da53868e54285c99a8afd4;p=projects%2Fchimara%2Fchimara.git Added test case for crash in ChimaraIF::command There is a gdk_threads_enter/leave missing somewhere, because using GTK calls from the signal handler of the ChimaraIF::command signal causes an X error. --- diff --git a/tests/test-close.c b/tests/test-close.c index ddc2919..fc30203 100644 --- a/tests/test-close.c +++ b/tests/test-close.c @@ -1,6 +1,18 @@ #include #include +void +on_command(ChimaraIF *glk, gchar *input, gchar *response, GtkWindow *window) +{ + GtkWidget *dialog = gtk_message_dialog_new(window, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, + "%s", input); + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", + response); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +} + int main(int argc, char *argv[]) { @@ -15,8 +27,10 @@ main(int argc, char *argv[]) /* Construct the window and its contents. We quit the GTK main loop * when the window's close button is clicked. */ 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); - glk = chimara_glk_new(); + glk = chimara_if_new(); + g_signal_connect(glk, "command", G_CALLBACK(on_command), window); gtk_container_add(GTK_CONTAINER(window), glk); gtk_widget_show_all(window); @@ -24,6 +38,9 @@ main(int argc, char *argv[]) around after gtk_main() exits */ g_object_ref(glk); + /* Start the plugin */ + g_assert(chimara_if_run_game(CHIMARA_IF(glk), "unicodetest.ulx", NULL)); + /* Start the GTK main loop */ gdk_threads_enter(); gtk_main();