[glib] Improve coverage of application tests
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Improve coverage of application tests
- Date: Fri, 30 Jul 2010 23:58:39 +0000 (UTC)
commit 7710c50fb22d44bc8554ad811418141490e09f78
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jul 29 02:18:45 2010 -0400
Improve coverage of application tests
gio/tests/application.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/application.c b/gio/tests/application.c
index 3307b3a..ea1dcc5 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]