diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2013-12-19 16:02:17 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2013-12-19 16:02:17 +1300 |
commit | 8362fed93ded348c8a6cbec47c98965e888ea6bc (patch) | |
tree | 6f8014c207c4869ebddbc3ed67067fbbaac3e83a /tests | |
parent | e8a7320e285d9feb6665c10efea8094ce306c213 (diff) | |
download | ayatana-indicator-session-8362fed93ded348c8a6cbec47c98965e888ea6bc.tar.gz ayatana-indicator-session-8362fed93ded348c8a6cbec47c98965e888ea6bc.tar.bz2 ayatana-indicator-session-8362fed93ded348c8a6cbec47c98965e888ea6bc.zip |
Use username as label if the real name is empty or whitespace
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-service.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test-service.cc b/tests/test-service.cc index 5ec86d2..f14fe61 100644 --- a/tests/test-service.cc +++ b/tests/test-service.cc @@ -819,3 +819,33 @@ TEST_F (ServiceTest, User) wait_for_signal (mock_settings, "changed::last-command"); check_last_command_is ("switch-to-user::tbaker"); } + +TEST_F (ServiceTest, UserLabels) +{ + int pos = 0; + GMenuModel * switch_menu = 0; + + // Check label uses username when real name is blank + IndicatorSessionUser * u = g_new0 (IndicatorSessionUser, 1); + u->uid = 100; + u->user_name = g_strdup ("blank"); + u->real_name = g_strdup (""); + indicator_session_users_mock_add_user (INDICATOR_SESSION_USERS_MOCK(mock_users), u); + wait_for_menu_resync (); + ASSERT_TRUE (find_menu_item_for_action ("indicator.switch-to-screensaver", &switch_menu, &pos)); + check_label ("blank", switch_menu, 2); + g_clear_object (&switch_menu); + indicator_session_users_mock_remove_user (INDICATOR_SESSION_USERS_MOCK(mock_users), 100); + + // Check label uses username when real name is all whitespace + u = g_new0 (IndicatorSessionUser, 1); + u->uid = 100; + u->user_name = g_strdup ("whitespace"); + u->real_name = g_strdup (" "); + indicator_session_users_mock_add_user (INDICATOR_SESSION_USERS_MOCK(mock_users), u); + wait_for_menu_resync (); + ASSERT_TRUE (find_menu_item_for_action ("indicator.switch-to-screensaver", &switch_menu, &pos)); + check_label ("whitespace", switch_menu, 2); + g_clear_object (&switch_menu); + indicator_session_users_mock_remove_user (INDICATOR_SESSION_USERS_MOCK(mock_users), 100); +} |