mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added test for /otr theirfp when in console
This commit is contained in:
parent
82ad0cd306
commit
4afec6ab5e
@ -387,6 +387,22 @@ void cmd_otr_myfp_shows_my_fingerprint(void **state)
|
|||||||
free(help);
|
free(help);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmd_otr_theirfp_shows_message_when_in_console(void **state)
|
||||||
|
{
|
||||||
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
|
gchar *args[] = { "theirfp", NULL };
|
||||||
|
mock_connection_status(JABBER_CONNECTED);
|
||||||
|
mock_current_win_type(WIN_CONSOLE);
|
||||||
|
mock_ui_current_print_line();
|
||||||
|
|
||||||
|
ui_current_print_line_expect("You must be in a regular chat window to view a recipient's fingerprint.");
|
||||||
|
|
||||||
|
gboolean result = cmd_otr(args, *help);
|
||||||
|
assert_true(result);
|
||||||
|
|
||||||
|
free(help);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
void cmd_otr_shows_message_when_otr_unsupported(void **state)
|
void cmd_otr_shows_message_when_otr_unsupported(void **state)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,7 @@ void cmd_otr_myfp_shows_message_when_started(void **state);
|
|||||||
void cmd_otr_myfp_shows_message_when_connecting(void **state);
|
void cmd_otr_myfp_shows_message_when_connecting(void **state);
|
||||||
void cmd_otr_myfp_shows_message_when_disconnecting(void **state);
|
void cmd_otr_myfp_shows_message_when_disconnecting(void **state);
|
||||||
void cmd_otr_myfp_shows_my_fingerprint(void **state);
|
void cmd_otr_myfp_shows_my_fingerprint(void **state);
|
||||||
|
void cmd_otr_theirfp_shows_message_when_in_console(void **state);
|
||||||
#else
|
#else
|
||||||
void cmd_otr_shows_message_when_otr_unsupported(void **state);
|
void cmd_otr_shows_message_when_otr_unsupported(void **state);
|
||||||
#endif
|
#endif
|
||||||
|
@ -469,6 +469,7 @@ int main(int argc, char* argv[]) {
|
|||||||
unit_test(cmd_otr_myfp_shows_message_when_connecting),
|
unit_test(cmd_otr_myfp_shows_message_when_connecting),
|
||||||
unit_test(cmd_otr_myfp_shows_message_when_disconnecting),
|
unit_test(cmd_otr_myfp_shows_message_when_disconnecting),
|
||||||
unit_test(cmd_otr_myfp_shows_my_fingerprint),
|
unit_test(cmd_otr_myfp_shows_my_fingerprint),
|
||||||
|
unit_test(cmd_otr_theirfp_shows_message_when_in_console),
|
||||||
#else
|
#else
|
||||||
unit_test(cmd_otr_shows_message_when_otr_unsupported),
|
unit_test(cmd_otr_shows_message_when_otr_unsupported),
|
||||||
#endif
|
#endif
|
||||||
|
@ -171,6 +171,16 @@ void _mock_ui_current_print_formatted_line(const char show_char, int attrs, cons
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void _mock_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);
|
||||||
|
}
|
||||||
|
|
||||||
// bind mocks and stubs
|
// bind mocks and stubs
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -270,6 +280,12 @@ mock_ui_current_print_formatted_line(void)
|
|||||||
ui_current_print_formatted_line = _mock_ui_current_print_formatted_line;
|
ui_current_print_formatted_line = _mock_ui_current_print_formatted_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mock_ui_current_print_line(void)
|
||||||
|
{
|
||||||
|
ui_current_print_line = _mock_ui_current_print_line;
|
||||||
|
}
|
||||||
|
|
||||||
// expectations
|
// expectations
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -394,3 +410,9 @@ ui_current_print_formatted_line_expect(char show_char, int attrs, char *message)
|
|||||||
expect_value(_mock_ui_current_print_formatted_line, attrs, attrs);
|
expect_value(_mock_ui_current_print_formatted_line, attrs, attrs);
|
||||||
expect_string(_mock_ui_current_print_formatted_line, output, message);
|
expect_string(_mock_ui_current_print_formatted_line, output, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_current_print_line_expect(char *message)
|
||||||
|
{
|
||||||
|
expect_string(_mock_ui_current_print_line, output, message);
|
||||||
|
}
|
||||||
|
@ -54,4 +54,7 @@ void stub_ui_current_refresh(void);
|
|||||||
void mock_ui_current_print_formatted_line(void);
|
void mock_ui_current_print_formatted_line(void);
|
||||||
void ui_current_print_formatted_line_expect(char show_char, int attrs, char *message);
|
void ui_current_print_formatted_line_expect(char show_char, int attrs, char *message);
|
||||||
|
|
||||||
|
void mock_ui_current_print_line(void);
|
||||||
|
void ui_current_print_line_expect(char *message);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user