diff options
author | James Booth <boothj5@gmail.com> | 2014-12-24 23:32:32 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-12-24 23:32:32 +0000 |
commit | 419f37feea3c22e9e6c51bb035a717ab7d29e2fd (patch) | |
tree | c8f485d5b0e1d20908cf3399d223e0011847f601 /tests/ui | |
parent | aa4ffa7e8c9fa0f1b045b1b1c9fe478be552fd82 (diff) | |
download | profani-tty-419f37feea3c22e9e6c51bb035a717ab7d29e2fd.tar.gz |
Added cmd_otr tests
Diffstat (limited to 'tests/ui')
-rw-r--r-- | tests/ui/stub_ui.c | 40 | ||||
-rw-r--r-- | tests/ui/stub_ui.h | 2 |
2 files changed, 38 insertions, 4 deletions
diff --git a/tests/ui/stub_ui.c b/tests/ui/stub_ui.c index 310721e5..290e0181 100644 --- a/tests/ui/stub_ui.c +++ b/tests/ui/stub_ui.c @@ -25,6 +25,20 @@ expect_cons_show_error(char *expected) expect_string(cons_show_error, output, expected); } +void +expect_ui_current_print_line(char *message) +{ + expect_string(ui_current_print_line, output, message); +} + +void +expect_ui_current_print_formatted_line(char show_char, int attrs, char *message) +{ + expect_value(ui_current_print_formatted_line, show_char, show_char); + expect_value(ui_current_print_formatted_line, attrs, attrs); + expect_string(ui_current_print_formatted_line, output, message); +} + // stubs void ui_init(void) {} @@ -105,16 +119,34 @@ int ui_current_win_index(void) gboolean ui_current_win_is_otr(void) { - return FALSE; + return (gboolean)mock(); } ProfChatWin *ui_get_current_chat(void) { - return NULL; + return (ProfChatWin*)mock(); +} + +void ui_current_print_line(const char * const msg, ...) +{ + va_list args; + va_start(args, msg); + vsnprintf(output, sizeof(output), msg, args); + check_expected(output); + va_end(args); +} + +void ui_current_print_formatted_line(const char show_char, int attrs, const char * const msg, ...) +{ + check_expected(show_char); + check_expected(attrs); + va_list args; + va_start(args, msg); + vsnprintf(output, sizeof(output), msg, args); + check_expected(output); + va_end(args); } -void ui_current_print_line(const char * const msg, ...) {} -void ui_current_print_formatted_line(const char show_char, int attrs, const char * const msg, ...) {} void ui_current_error_line(const char * const msg) {} win_type_t ui_win_type(int index) diff --git a/tests/ui/stub_ui.h b/tests/ui/stub_ui.h index 31c2a120..f64eba02 100644 --- a/tests/ui/stub_ui.h +++ b/tests/ui/stub_ui.h @@ -1,2 +1,4 @@ void expect_cons_show(char *expected); void expect_cons_show_error(char *expected); +void expect_ui_current_print_line(char *message); +void expect_ui_current_print_formatted_line(char show_char, int attrs, char *message); \ No newline at end of file |