mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added form tests
This commit is contained in:
parent
2505d47040
commit
d1f8c6cddf
@ -40,7 +40,7 @@ tests_sources = \
|
||||
src/chat_session.h src/muc.c src/muc.h src/jid.h src/jid.c \
|
||||
src/resource.c src/resource.h \
|
||||
src/roster_list.c src/roster_list.h \
|
||||
src/xmpp/xmpp.h \
|
||||
src/xmpp/xmpp.h src/xmpp/form.c \
|
||||
src/ui/ui.h \
|
||||
src/command/command.h src/command/command.c src/command/history.c \
|
||||
src/command/commands.h src/command/commands.c \
|
||||
@ -79,6 +79,7 @@ tests_sources = \
|
||||
tests/test_cmd_win.c tests/test_cmd_win.h \
|
||||
tests/test_common.c tests/test_common.h \
|
||||
tests/test_contact.c tests/test_contact.h \
|
||||
tests/test_form.c tests/test_form.h \
|
||||
tests/test_autocomplete.c tests/test_autocomplete.h \
|
||||
tests/testsuite.c
|
||||
|
||||
|
@ -47,8 +47,6 @@ _new_field(void)
|
||||
|
||||
void get_form_type_field_returns_null_no_fields(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
|
||||
char *result = form_get_form_type_field(form);
|
||||
@ -60,8 +58,6 @@ void get_form_type_field_returns_null_no_fields(void **state)
|
||||
|
||||
void get_form_type_field_returns_null_when_not_present(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
FormField *field = _new_field();
|
||||
field->var = strdup("var1");
|
||||
@ -77,8 +73,6 @@ void get_form_type_field_returns_null_when_not_present(void **state)
|
||||
|
||||
void get_form_type_field_returns_value_when_present(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
|
||||
FormField *field1 = _new_field();
|
||||
@ -105,8 +99,6 @@ void get_form_type_field_returns_value_when_present(void **state)
|
||||
|
||||
void get_field_type_returns_unknown_when_no_fields(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
|
||||
form_field_type_t result = form_get_field_type(form, "tag");
|
||||
@ -118,8 +110,6 @@ void get_field_type_returns_unknown_when_no_fields(void **state)
|
||||
|
||||
void get_field_type_returns_correct_type(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag2"), strdup("var2"));
|
||||
@ -145,8 +135,6 @@ void get_field_type_returns_correct_type(void **state)
|
||||
|
||||
void set_value_adds_when_none(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag2"), strdup("var2"));
|
||||
@ -185,8 +173,6 @@ void set_value_adds_when_none(void **state)
|
||||
|
||||
void set_value_updates_when_one(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag2"), strdup("var2"));
|
||||
@ -225,8 +211,6 @@ void set_value_updates_when_one(void **state)
|
||||
|
||||
void add_unique_value_adds_when_none(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag2"), strdup("var2"));
|
||||
@ -266,8 +250,6 @@ void add_unique_value_adds_when_none(void **state)
|
||||
|
||||
void add_unique_value_does_nothing_when_exists(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag2"), strdup("var2"));
|
||||
@ -308,8 +290,6 @@ void add_unique_value_does_nothing_when_exists(void **state)
|
||||
|
||||
void add_unique_value_adds_when_doesnt_exist(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag2"), strdup("var2"));
|
||||
@ -358,8 +338,6 @@ void add_unique_value_adds_when_doesnt_exist(void **state)
|
||||
|
||||
void add_value_adds_when_none(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
@ -391,8 +369,6 @@ void add_value_adds_when_none(void **state)
|
||||
|
||||
void add_value_adds_when_some(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
@ -433,8 +409,6 @@ void add_value_adds_when_some(void **state)
|
||||
|
||||
void add_value_adds_when_exists(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
@ -476,8 +450,6 @@ void add_value_adds_when_exists(void **state)
|
||||
|
||||
void remove_value_does_nothing_when_none(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
@ -506,8 +478,6 @@ void remove_value_does_nothing_when_none(void **state)
|
||||
|
||||
void remove_value_does_nothing_when_doesnt_exist(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
@ -549,8 +519,6 @@ void remove_value_does_nothing_when_doesnt_exist(void **state)
|
||||
|
||||
void remove_value_removes_when_one(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
@ -580,8 +548,6 @@ void remove_value_removes_when_one(void **state)
|
||||
|
||||
void remove_value_removes_when_many(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
@ -623,8 +589,6 @@ void remove_value_removes_when_many(void **state)
|
||||
|
||||
void remove_text_multi_value_does_nothing_when_none(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
@ -653,8 +617,6 @@ void remove_text_multi_value_does_nothing_when_none(void **state)
|
||||
|
||||
void remove_text_multi_value_does_nothing_when_doesnt_exist(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
@ -696,8 +658,6 @@ void remove_text_multi_value_does_nothing_when_doesnt_exist(void **state)
|
||||
|
||||
void remove_text_multi_value_removes_when_one(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
@ -727,8 +687,6 @@ void remove_text_multi_value_removes_when_one(void **state)
|
||||
|
||||
void remove_text_multi_value_removes_when_many(void **state)
|
||||
{
|
||||
form_init_module();
|
||||
|
||||
DataForm *form = _new_form();
|
||||
g_hash_table_insert(form->tag_to_var, strdup("tag1"), strdup("var1"));
|
||||
|
||||
|
@ -520,7 +520,6 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
unit_test(cmd_win_shows_message_when_win_doesnt_exist),
|
||||
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_when_not_present),
|
||||
@ -543,7 +542,6 @@ int main(int argc, char* argv[]) {
|
||||
unit_test(remove_text_multi_value_does_nothing_when_doesnt_exist),
|
||||
unit_test(remove_text_multi_value_removes_when_one),
|
||||
unit_test(remove_text_multi_value_removes_when_many),
|
||||
*/
|
||||
};
|
||||
|
||||
return run_tests(all_tests);
|
||||
|
@ -215,73 +215,4 @@ void roster_send_add_new(const char * const barejid, const char * const name)
|
||||
void roster_send_remove(const char * const barejid)
|
||||
{
|
||||
check_expected(barejid);
|
||||
}
|
||||
|
||||
void form_destroy(DataForm *form) {}
|
||||
|
||||
char * form_get_form_type_field(DataForm *form)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void form_set_value(DataForm *form, const char * const tag, char *value) {}
|
||||
|
||||
gboolean form_add_unique_value(DataForm *form, const char * const tag, char *value)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void form_add_value(DataForm *form, const char * const tag, char *value) {}
|
||||
|
||||
gboolean form_remove_value(DataForm *form, const char * const tag, char *value)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean form_remove_text_multi_value(DataForm *form, const char * const tag, int index)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean form_tag_exists(DataForm *form, const char * const tag)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
form_field_type_t form_get_field_type(DataForm *form, const char * const tag)
|
||||
{
|
||||
return FIELD_BOOLEAN;
|
||||
}
|
||||
|
||||
gboolean form_field_contains_option(DataForm *form, const char * const tag, char *value)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int form_get_value_count(DataForm *form, const char * const tag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FormField* form_get_field_by_tag(DataForm *form, const char * const tag)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Autocomplete form_get_value_ac(DataForm *form, const char * const tag)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void form_reset_autocompleters(DataForm *form) {}
|
||||
|
||||
GSList * form_get_non_form_type_fields_sorted(DataForm *form)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GSList * form_get_field_values_sorted(FormField *field)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user