1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-30 17:55:24 -04:00

Added test for valid window switch

This commit is contained in:
James Booth 2014-04-01 23:33:12 +01:00
parent 96e32fe178
commit 7113b97952
3 changed files with 16 additions and 1 deletions

View File

@ -521,6 +521,7 @@ int main(int argc, char* argv[]) {
unit_test(cmd_roster_clearnick_sends_name_change_request_with_empty_nick),
unit_test(cmd_win_shows_message_when_win_doesnt_exist),
unit_test(cmd_win_switches_to_given_win_when_exists),
};
return run_tests(all_tests);

View File

@ -184,13 +184,18 @@ gboolean _mock_ui_win_exists(int index)
return (gboolean)mock();
}
static
void _mock_ui_switch_win(const int i)
{
check_expected(i);
}
// bind mocks and stubs
void
mock_cons_show(void)
{
cons_show = _mock_cons_show;
}
void
@ -458,3 +463,10 @@ 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);
}
void
ui_switch_win_expect(int given_i)
{
ui_switch_win = _mock_ui_switch_win;
expect_value(_mock_ui_switch_win, i, given_i);
}

View File

@ -67,4 +67,6 @@ 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);
void ui_switch_win_expect(int given_i);
#endif