From a19955f3f81b1a5eb8fc928bc5dcf8a24bb6833f Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 12 Jul 2013 07:42:07 -0500 Subject: add the online-accounts action and unit tests for it --- tests/backend-mock-actions.c | 7 +++++++ tests/test-service.cc | 9 +++++++++ 2 files changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/backend-mock-actions.c b/tests/backend-mock-actions.c index af4afd9..25a606f 100644 --- a/tests/backend-mock-actions.c +++ b/tests/backend-mock-actions.c @@ -141,6 +141,12 @@ my_settings (IndicatorSessionActions * self G_GNUC_UNUSED) g_settings_set_string (mock_settings, "last-command", "settings"); } +static void +my_online_accounts (IndicatorSessionActions * self G_GNUC_UNUSED) +{ + g_settings_set_string (mock_settings, "last-command", "online-accounts"); +} + static gboolean my_can_prompt (IndicatorSessionActions * self G_GNUC_UNUSED) { @@ -195,6 +201,7 @@ indicator_session_actions_mock_class_init (IndicatorSessionActionsMockClass * kl actions_class->reboot = my_reboot; actions_class->power_off = my_power_off; actions_class->settings = my_settings; + actions_class->online_accounts = my_online_accounts; actions_class->help = my_help; actions_class->about = my_about; actions_class->switch_to_screensaver = my_switch_to_screensaver; diff --git a/tests/test-service.cc b/tests/test-service.cc index 86f49e6..2027ec0 100644 --- a/tests/test-service.cc +++ b/tests/test-service.cc @@ -589,6 +589,15 @@ TEST_F (ServiceTest, OnlineAccountError) ASSERT_TRUE (find_menu_item_for_action ("indicator.online-accounts", &model, &pos)); g_clear_object (&model); + // check that the service has a corresponding action + ASSERT_TRUE (g_action_group_has_action (G_ACTION_GROUP(action_group), "online-accounts")); + ASSERT_TRUE (g_action_group_get_action_enabled (G_ACTION_GROUP(action_group), "online-accounts")); + + // confirm that activating the action is handled by the service + g_action_group_activate_action (G_ACTION_GROUP(action_group), "online-accounts", NULL); + wait_for_signal (mock_settings, "changed::last-command"); + check_last_command_is ("online-accounts"); + // check that the header's icon and a11y adjusted to the error state check_header ("", "system-devices-panel-alert", "System (Attention Required)"); -- cgit v1.2.3