about summary refs log tree commit diff stats
path: root/tests/ui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/mock_ui.c37
-rw-r--r--tests/ui/mock_ui.h4
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/ui/mock_ui.c b/tests/ui/mock_ui.c
index 83119910..cd6c62ff 100644
--- a/tests/ui/mock_ui.c
+++ b/tests/ui/mock_ui.c
@@ -45,6 +45,14 @@ void _stub_cons_show(const char * const msg, ...)
 }
 
 static
+void _mock_cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity)
+{
+    check_expected(contact);
+    check_expected(resource);
+    check_expected(last_activity);
+}
+
+static
 void _mock_cons_show_error(const char * const msg, ...)
 {
     va_list args;
@@ -78,6 +86,11 @@ char * _stub_ui_ask_password(void)
     return NULL;
 }
 
+static
+void _stub_ui_chat_win_contact_online(PContact contact, Resource *resource, GDateTime *last_activity)
+{
+}
+
 void
 mock_cons_show(void)
 {
@@ -86,6 +99,18 @@ mock_cons_show(void)
 }
 
 void
+mock_cons_show_contact_online(void)
+{
+    cons_show_contact_online = _mock_cons_show_contact_online;
+}
+
+void
+stub_ui_chat_win_contact_online(void)
+{
+    ui_chat_win_contact_online = _stub_ui_chat_win_contact_online;
+}
+
+void
 mock_cons_show_error(void)
 {
     cons_show_error = _mock_cons_show_error;
@@ -153,6 +178,18 @@ expect_cons_show_account_list(gchar **accounts)
 }
 
 void
+expect_cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity)
+{
+    expect_memory(_mock_cons_show_contact_online, contact, contact, sizeof(contact));
+    expect_memory(_mock_cons_show_contact_online, resource, resource, sizeof(Resource));
+    if (last_activity == NULL) {
+        expect_any(_mock_cons_show_contact_online, last_activity);
+    } else {
+        expect_memory(_mock_cons_show_contact_online, last_activity, last_activity, sizeof(last_activity));
+    }
+}
+
+void
 mock_ui_ask_password_returns(char *password)
 {
     will_return(_mock_ui_ask_password, strdup(password));
diff --git a/tests/ui/mock_ui.h b/tests/ui/mock_ui.h
index 2833be29..6f6d34d7 100644
--- a/tests/ui/mock_ui.h
+++ b/tests/ui/mock_ui.h
@@ -11,6 +11,10 @@ void mock_cons_show(void);
 void expect_cons_show(char *output);
 void expect_cons_show_calls(int n);
 
+void mock_cons_show_contact_online(void);
+void expect_cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity);
+void stub_ui_chat_win_contact_online(void);
+
 void mock_cons_show_error(void);
 void expect_cons_show_error(char *output);