Allow previous autocompletion with shift tab

This commit is contained in:
James Booth
2017-04-01 00:27:11 +01:00
parent 1b9d033cef
commit 6b830277a6
38 changed files with 597 additions and 466 deletions

View File

@@ -158,7 +158,7 @@ void find_first_exists(void **state)
char *search = strdup("B");
char *result = roster_contact_autocomplete(search);
char *result = roster_contact_autocomplete(search, FALSE);
assert_string_equal("Bob", result);
free(result);
free(search);
@@ -172,7 +172,7 @@ void find_second_exists(void **state)
roster_add("Dave", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE);
char *result = roster_contact_autocomplete("Dav");
char *result = roster_contact_autocomplete("Dav", FALSE);
assert_string_equal("Dave", result);
free(result);
roster_destroy();
@@ -185,7 +185,7 @@ void find_third_exists(void **state)
roster_add("Dave", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE);
char *result = roster_contact_autocomplete("Ja");
char *result = roster_contact_autocomplete("Ja", FALSE);
assert_string_equal("James", result);
free(result);
roster_destroy();
@@ -198,7 +198,7 @@ void find_returns_null(void **state)
roster_add("Dave", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE);
char *result = roster_contact_autocomplete("Mike");
char *result = roster_contact_autocomplete("Mike", FALSE);
assert_null(result);
roster_destroy();
}
@@ -206,7 +206,7 @@ void find_returns_null(void **state)
void find_on_empty_returns_null(void **state)
{
roster_create();
char *result = roster_contact_autocomplete("James");
char *result = roster_contact_autocomplete("James", FALSE);
assert_null(result);
roster_destroy();
}
@@ -218,8 +218,8 @@ void find_twice_returns_second_when_two_match(void **state)
roster_add("Jamie", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE);
char *result1 = roster_contact_autocomplete("Jam");
char *result2 = roster_contact_autocomplete(result1);
char *result1 = roster_contact_autocomplete("Jam", FALSE);
char *result2 = roster_contact_autocomplete(result1, FALSE);
assert_string_equal("Jamie", result2);
free(result1);
free(result2);
@@ -240,11 +240,11 @@ void find_five_times_finds_fifth(void **state)
roster_add("Jamy", NULL, NULL, NULL, FALSE);
roster_add("Jamz", NULL, NULL, NULL, FALSE);
char *result1 = roster_contact_autocomplete("Jam");
char *result2 = roster_contact_autocomplete(result1);
char *result3 = roster_contact_autocomplete(result2);
char *result4 = roster_contact_autocomplete(result3);
char *result5 = roster_contact_autocomplete(result4);
char *result1 = roster_contact_autocomplete("Jam", FALSE);
char *result2 = roster_contact_autocomplete(result1, FALSE);
char *result3 = roster_contact_autocomplete(result2, FALSE);
char *result4 = roster_contact_autocomplete(result3, FALSE);
char *result5 = roster_contact_autocomplete(result4, FALSE);
assert_string_equal("Jamo", result5);
free(result1);
free(result2);
@@ -261,9 +261,9 @@ void find_twice_returns_first_when_two_match_and_reset(void **state)
roster_add("Jamie", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE);
char *result1 = roster_contact_autocomplete("Jam");
char *result1 = roster_contact_autocomplete("Jam", FALSE);
roster_reset_search_attempts();
char *result2 = roster_contact_autocomplete(result1);
char *result2 = roster_contact_autocomplete(result1, FALSE);
assert_string_equal("James", result2);
free(result1);
free(result2);