diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/config/stub_accounts.c | 6 | ||||
-rw-r--r-- | tests/unittests/test_roster_list.c | 32 | ||||
-rw-r--r-- | tests/unittests/test_roster_list.h | 3 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 6 | ||||
-rw-r--r-- | tests/unittests/unittests.c | 3 | ||||
-rw-r--r-- | tests/unittests/xmpp/stub_xmpp.c | 2 |
6 files changed, 51 insertions, 1 deletions
diff --git a/tests/unittests/config/stub_accounts.c b/tests/unittests/config/stub_accounts.c index 19a0bdcb..653b2897 100644 --- a/tests/unittests/config/stub_accounts.c +++ b/tests/unittests/config/stub_accounts.c @@ -213,6 +213,12 @@ accounts_get_last_presence(const char* const account_name) return mock_type(resource_presence_t); } +char* +accounts_get_login_status(const char* const account_name) +{ + return NULL; +} + void accounts_set_priority_online(const char* const account_name, const gint value) { diff --git a/tests/unittests/test_roster_list.c b/tests/unittests/test_roster_list.c index b46e7b57..fc10d1a7 100644 --- a/tests/unittests/test_roster_list.c +++ b/tests/unittests/test_roster_list.c @@ -689,3 +689,35 @@ remove_contact_with_remaining_in_group(void** state) g_list_free_full(groups_res, free); roster_destroy(); } + +void +get_contact_display_name(void** state) +{ + roster_create(); + roster_add("person@server.org", "nickname", NULL, NULL, FALSE); + + assert_string_equal("nickname", roster_get_display_name("person@server.org")); + + roster_destroy(); +} + +void +get_contact_display_name_is_barejid_if_name_is_empty(void** state) +{ + roster_create(); + roster_add("person@server.org", NULL, NULL, NULL, FALSE); + + assert_string_equal("person@server.org", roster_get_display_name("person@server.org")); + + roster_destroy(); +} + +void +get_contact_display_name_is_passed_barejid_if_contact_does_not_exist(void** state) +{ + roster_create(); + + assert_string_equal("person@server.org", roster_get_display_name("person@server.org")); + + roster_destroy(); +} diff --git a/tests/unittests/test_roster_list.h b/tests/unittests/test_roster_list.h index b9874fec..81983d46 100644 --- a/tests/unittests/test_roster_list.h +++ b/tests/unittests/test_roster_list.h @@ -30,3 +30,6 @@ void add_contacts_with_different_groups(void** state); void add_contacts_with_same_groups(void** state); void add_contacts_with_overlapping_groups(void** state); void remove_contact_with_remaining_in_group(void** state); +void get_contact_display_name(void** state); +void get_contact_display_name_is_barejid_if_name_is_empty(void** state); +void get_contact_display_name_is_passed_barejid_if_contact_does_not_exist(void** state); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 1cae8bde..edacc80a 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -1125,6 +1125,12 @@ void cons_mam_setting(void) { } + +void +cons_silence_setting(void) +{ +} + void cons_show_bookmarks_ignore(gchar** list, gsize len) { diff --git a/tests/unittests/unittests.c b/tests/unittests/unittests.c index 7fd3b192..e2293004 100644 --- a/tests/unittests/unittests.c +++ b/tests/unittests/unittests.c @@ -219,6 +219,9 @@ main(int argc, char* argv[]) unit_test(add_contacts_with_same_groups), unit_test(add_contacts_with_overlapping_groups), unit_test(remove_contact_with_remaining_in_group), + unit_test(get_contact_display_name), + unit_test(get_contact_display_name_is_barejid_if_name_is_empty), + unit_test(get_contact_display_name_is_passed_barejid_if_contact_does_not_exist), unit_test_setup_teardown(returns_false_when_chat_session_does_not_exist, init_chat_sessions, diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c index ba72024c..4ecb8f79 100644 --- a/tests/unittests/xmpp/stub_xmpp.c +++ b/tests/unittests/xmpp/stub_xmpp.c @@ -547,7 +547,7 @@ blocked_list(void) } gboolean -blocked_add(char* jid) +blocked_add(char* jid, blocked_report reportkind, const char* const message) { return TRUE; } |