From 7710c50fb22d44bc8554ad811418141490e09f78 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 29 Jul 2010 02:18:45 -0400 Subject: [PATCH] Improve coverage of application tests --- gio/tests/application.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/gio/tests/application.c b/gio/tests/application.c index 3307b3aa3..ea1dcc54e 100644 --- a/gio/tests/application.c +++ b/gio/tests/application.c @@ -148,10 +148,46 @@ static void test_basic (void) { GApplication *app; + const gchar *appid; + gboolean quit; + gboolean remote; + gboolean reg; + gchar **actions; app = g_application_new ("org.gtk.TestApplication", 0, NULL); + + g_assert (g_application_get_instance () == app); + g_assert_cmpstr (g_application_get_id (app), ==, "org.gtk.TestApplication"); + g_object_get (app, + "application-id", &appid, + "default-quit", &quit, + "is-remote", &remote, + "register", ®, + NULL); + g_assert_cmpstr (appid, ==, "org.gtk.TestApplication"); + g_assert (quit); + g_assert (!remote); + g_assert (reg); + g_application_add_action (app, "About", "Print an about message"); + g_assert (g_application_get_action_enabled (app, "About")); + g_assert_cmpstr (g_application_get_action_description (app, "About"), ==, "Print an about message"); + + actions = g_application_list_actions (app); + g_assert_cmpint (g_strv_length (actions), ==, 1); + g_assert_cmpstr (actions[0], ==, "About"); + g_strfreev (actions); + + g_application_add_action (app, "Action2", "Another action"); + actions = g_application_list_actions (app); + g_assert_cmpint (g_strv_length (actions), ==, 2); + g_strfreev (actions); + g_application_remove_action (app, "Action2"); + actions = g_application_list_actions (app); + g_assert_cmpint (g_strv_length (actions), ==, 1); + g_strfreev (actions); + g_signal_connect (app, "action-with-data::About", G_CALLBACK (on_app_action), NULL); state = INVOKE_ACTION;