X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=tests%2Ftest-close.c;h=fc302034685695b43e0e2a776d34c250a5276365;hb=4884a6e823e53b0d0e61ae122cd1083ea10aebea;hp=ddc291928e3a1f41129073f0087195df26e9389f;hpb=ae4847f3dc67b8bdddf6e3e8dbec0348995efaef;p=projects%2Fchimara%2Fchimara.git 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();