mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Test for /otr theirfp in non OTR window
This commit is contained in:
parent
a25714b6dc
commit
b4b463998b
@ -424,6 +424,23 @@ void cmd_otr_theirfp_shows_message_when_in_duck(void **state)
|
|||||||
test_cmd_otr_theirfp_from_wintype(WIN_DUCK);
|
test_cmd_otr_theirfp_from_wintype(WIN_DUCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmd_otr_theirfp_shows_message_when_non_otr_chat_window(void **state)
|
||||||
|
{
|
||||||
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
|
gchar *args[] = { "theirfp", NULL };
|
||||||
|
mock_connection_status(JABBER_CONNECTED);
|
||||||
|
mock_current_win_type(WIN_CHAT);
|
||||||
|
ui_current_win_is_otr_returns(FALSE);
|
||||||
|
mock_ui_current_print_formatted_line();
|
||||||
|
|
||||||
|
ui_current_print_formatted_line_expect('!', 0, "You are not currently in an OTR session.");
|
||||||
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,7 @@ void cmd_otr_theirfp_shows_message_when_in_console(void **state);
|
|||||||
void cmd_otr_theirfp_shows_message_when_in_muc(void **state);
|
void cmd_otr_theirfp_shows_message_when_in_muc(void **state);
|
||||||
void cmd_otr_theirfp_shows_message_when_in_private(void **state);
|
void cmd_otr_theirfp_shows_message_when_in_private(void **state);
|
||||||
void cmd_otr_theirfp_shows_message_when_in_duck(void **state);
|
void cmd_otr_theirfp_shows_message_when_in_duck(void **state);
|
||||||
|
void cmd_otr_theirfp_shows_message_when_non_otr_chat_window(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
|
||||||
|
@ -473,6 +473,7 @@ int main(int argc, char* argv[]) {
|
|||||||
unit_test(cmd_otr_theirfp_shows_message_when_in_muc),
|
unit_test(cmd_otr_theirfp_shows_message_when_in_muc),
|
||||||
unit_test(cmd_otr_theirfp_shows_message_when_in_private),
|
unit_test(cmd_otr_theirfp_shows_message_when_in_private),
|
||||||
unit_test(cmd_otr_theirfp_shows_message_when_in_duck),
|
unit_test(cmd_otr_theirfp_shows_message_when_in_duck),
|
||||||
|
unit_test(cmd_otr_theirfp_shows_message_when_non_otr_chat_window),
|
||||||
#else
|
#else
|
||||||
unit_test(cmd_otr_shows_message_when_otr_unsupported),
|
unit_test(cmd_otr_shows_message_when_otr_unsupported),
|
||||||
#endif
|
#endif
|
||||||
|
@ -181,6 +181,12 @@ void _mock_ui_current_print_line(const char * const msg, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
gboolean _mock_ui_current_win_is_otr(void)
|
||||||
|
{
|
||||||
|
return (gboolean)mock();
|
||||||
|
}
|
||||||
|
|
||||||
// bind mocks and stubs
|
// bind mocks and stubs
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -416,3 +422,10 @@ ui_current_print_line_expect(char *message)
|
|||||||
{
|
{
|
||||||
expect_string(_mock_ui_current_print_line, output, message);
|
expect_string(_mock_ui_current_print_line, output, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_current_win_is_otr_returns(gboolean result)
|
||||||
|
{
|
||||||
|
ui_current_win_is_otr = _mock_ui_current_win_is_otr;
|
||||||
|
will_return(_mock_ui_current_win_is_otr, result);
|
||||||
|
}
|
||||||
|
@ -57,4 +57,6 @@ void ui_current_print_formatted_line_expect(char show_char, int attrs, char *mes
|
|||||||
void mock_ui_current_print_line(void);
|
void mock_ui_current_print_line(void);
|
||||||
void ui_current_print_line_expect(char *message);
|
void ui_current_print_line_expect(char *message);
|
||||||
|
|
||||||
|
void ui_current_win_is_otr_returns(gboolean result);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user