Added contact presence offline test
This commit is contained in:
@@ -171,9 +171,9 @@ p_contact_create_display_string(const PContact contact, const char * const resou
|
|||||||
{
|
{
|
||||||
GString *result_str = g_string_new("");
|
GString *result_str = g_string_new("");
|
||||||
|
|
||||||
// use nickname if exists
|
// use nickname if exists
|
||||||
const char *display_name = p_contact_name_or_jid(contact);
|
const char *display_name = p_contact_name_or_jid(contact);
|
||||||
g_string_append(result_str, display_name);
|
g_string_append(result_str, display_name);
|
||||||
|
|
||||||
// add resource if not default provided by profanity
|
// add resource if not default provided by profanity
|
||||||
if (strcmp(resource, "__prof_default") != 0) {
|
if (strcmp(resource, "__prof_default") != 0) {
|
||||||
|
|||||||
@@ -100,3 +100,16 @@ void contact_string_when_default_resource(void **state)
|
|||||||
p_contact_free(contact);
|
p_contact_free(contact);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void contact_presence_offline(void **state)
|
||||||
|
{
|
||||||
|
PContact contact = p_contact_new("bob@server.com", "bob", NULL, "both",
|
||||||
|
"is offline", FALSE);
|
||||||
|
|
||||||
|
const char *presence = p_contact_presence(contact);
|
||||||
|
|
||||||
|
assert_string_equal("offline", presence);
|
||||||
|
|
||||||
|
p_contact_free(contact);
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,3 +5,4 @@ void contact_jid_when_name_not_exists(void **state);
|
|||||||
void contact_string_when_name_exists(void **state);
|
void contact_string_when_name_exists(void **state);
|
||||||
void contact_string_when_name_not_exists(void **state);
|
void contact_string_when_name_not_exists(void **state);
|
||||||
void contact_string_when_default_resource(void **state);
|
void contact_string_when_default_resource(void **state);
|
||||||
|
void contact_presence_offline(void **state);
|
||||||
|
|||||||
@@ -265,6 +265,7 @@ int main(int argc, char* argv[]) {
|
|||||||
unit_test(contact_string_when_name_exists),
|
unit_test(contact_string_when_name_exists),
|
||||||
unit_test(contact_string_when_name_not_exists),
|
unit_test(contact_string_when_name_not_exists),
|
||||||
unit_test(contact_string_when_default_resource),
|
unit_test(contact_string_when_default_resource),
|
||||||
|
unit_test(contact_presence_offline),
|
||||||
};
|
};
|
||||||
return run_tests(tests);
|
return run_tests(tests);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user