about summary refs log tree commit diff stats
path: root/tests/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-04-01 23:14:53 +0100
committerJames Booth <boothj5@gmail.com>2014-04-01 23:14:53 +0100
commit96e32fe17846a8ef25faad25bd57fbdc7338a16f (patch)
treecba892d020b33d92954818a190aba427d1459ddd /tests/ui
parent404dde281018596e3ff8b8b46dddbf622cc9670a (diff)
downloadprofani-tty-96e32fe17846a8ef25faad25bd57fbdc7338a16f.tar.gz
Added cmd_win test
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/mock_ui.c20
-rw-r--r--tests/ui/mock_ui.h3
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/mock_ui.c b/tests/ui/mock_ui.c
index 67eb51e8..5dc52a10 100644
--- a/tests/ui/mock_ui.c
+++ b/tests/ui/mock_ui.c
@@ -177,6 +177,13 @@ void _mock_cons_show_roster(GSList *list)
     check_expected(list);
 }
 
+static
+gboolean _mock_ui_win_exists(int index)
+{
+    check_expected(index);
+    return (gboolean)mock();
+}
+
 // bind mocks and stubs
 
 void
@@ -288,6 +295,12 @@ mock_cons_show_roster(void)
     cons_show_roster = _mock_cons_show_roster;
 }
 
+void
+mock_ui_win_exists(void)
+{
+    ui_win_exists = _mock_ui_win_exists;
+}
+
 // expectations
 
 void
@@ -438,3 +451,10 @@ cons_show_roster_expect(GSList *list)
 {
     expect_any(_mock_cons_show_roster, list);
 }
+
+void
+ui_win_exists_expect_and_return(int given_index, gboolean result)
+{
+    expect_value(_mock_ui_win_exists, index, given_index);
+    will_return(_mock_ui_win_exists, result);
+}
diff --git a/tests/ui/mock_ui.h b/tests/ui/mock_ui.h
index 55b036e6..c939a002 100644
--- a/tests/ui/mock_ui.h
+++ b/tests/ui/mock_ui.h
@@ -64,4 +64,7 @@ void ui_room_join_expect(char *room);
 void mock_cons_show_roster(void);
 void cons_show_roster_expect(GSList *list);
 
+void mock_ui_win_exists(void);
+void ui_win_exists_expect_and_return(int given_index, gboolean result);
+
 #endif