mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-08-02 06:26:21 +00:00
Added cmd_win tests
This commit is contained in:
@@ -76,6 +76,7 @@ tests_sources = \
|
|||||||
tests/test_cmd_roster.c tests/test_cmd_roster.h \
|
tests/test_cmd_roster.c tests/test_cmd_roster.h \
|
||||||
tests/test_cmd_statuses.c tests/test_cmd_statuses.h \
|
tests/test_cmd_statuses.c tests/test_cmd_statuses.h \
|
||||||
tests/test_cmd_sub.c tests/test_cmd_sub.h \
|
tests/test_cmd_sub.c tests/test_cmd_sub.h \
|
||||||
|
tests/test_cmd_win.c tests/test_cmd_win.h \
|
||||||
tests/test_autocomplete.c tests/test_autocomplete.h \
|
tests/test_autocomplete.c tests/test_autocomplete.h \
|
||||||
tests/testsuite.c
|
tests/testsuite.c
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,18 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "ui/mock_ui.h"
|
#include "ui/stub_ui.h"
|
||||||
|
|
||||||
#include "command/commands.h"
|
#include "command/commands.h"
|
||||||
|
|
||||||
void cmd_win_shows_message_when_win_doesnt_exist(void **state)
|
void cmd_win_shows_message_when_win_doesnt_exist(void **state)
|
||||||
{
|
{
|
||||||
mock_cons_show();
|
|
||||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
gchar *args[] = { "3", NULL };
|
gchar *args[] = { "3", NULL };
|
||||||
|
|
||||||
ui_switch_win_expect_and_return(3, FALSE);
|
expect_value(ui_switch_win, i, 3);
|
||||||
|
will_return(ui_switch_win, FALSE);
|
||||||
|
|
||||||
expect_cons_show("Window 3 does not exist.");
|
expect_cons_show("Window 3 does not exist.");
|
||||||
|
|
||||||
gboolean result = cmd_win(args, *help);
|
gboolean result = cmd_win(args, *help);
|
||||||
@@ -30,7 +31,8 @@ void cmd_win_switches_to_given_win_when_exists(void **state)
|
|||||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
gchar *args[] = { "12", NULL };
|
gchar *args[] = { "12", NULL };
|
||||||
|
|
||||||
ui_switch_win_expect_and_return(12, TRUE);
|
expect_value(ui_switch_win, i, 12);
|
||||||
|
will_return(ui_switch_win, TRUE);
|
||||||
|
|
||||||
gboolean result = cmd_win(args, *help);
|
gboolean result = cmd_win(args, *help);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
|
|||||||
@@ -520,9 +520,10 @@ int main(int argc, char* argv[]) {
|
|||||||
unit_test(cmd_roster_clearnick_shows_message_when_no_jid),
|
unit_test(cmd_roster_clearnick_shows_message_when_no_jid),
|
||||||
unit_test(cmd_roster_clearnick_shows_message_when_no_contact_exists),
|
unit_test(cmd_roster_clearnick_shows_message_when_no_contact_exists),
|
||||||
unit_test(cmd_roster_clearnick_sends_name_change_request_with_empty_nick),
|
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_shows_message_when_win_doesnt_exist),
|
||||||
unit_test(cmd_win_switches_to_given_win_when_exists),
|
unit_test(cmd_win_switches_to_given_win_when_exists),
|
||||||
|
/*
|
||||||
|
|
||||||
unit_test(get_form_type_field_returns_null_no_fields),
|
unit_test(get_form_type_field_returns_null_no_fields),
|
||||||
unit_test(get_form_type_field_returns_null_when_not_present),
|
unit_test(get_form_type_field_returns_null_when_not_present),
|
||||||
|
|||||||
@@ -53,8 +53,11 @@ GSList* ui_get_recipients(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ui_handle_special_keys(const wint_t * const ch, const int result) {}
|
void ui_handle_special_keys(const wint_t * const ch, const int result) {}
|
||||||
|
|
||||||
gboolean ui_switch_win(const int i)
|
gboolean ui_switch_win(const int i)
|
||||||
{
|
{
|
||||||
|
check_expected(i);
|
||||||
|
return (gboolean)mock();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user