diff options
Diffstat (limited to 'tests/history_text_test.c')
| -rw-r--r-- | tests/history_text_test.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/history_text_test.c b/tests/history_text_test.c index 88ca6aa..4ede890 100644 --- a/tests/history_text_test.c +++ b/tests/history_text_test.c @@ -1,4 +1,4 @@ -#include "term/term.h" +#include "wsap_vtcore/wsap_vtcore.h" #include "term_api.h" #include <assert.h> @@ -8,9 +8,9 @@ #include <stdlib.h> #include <string.h> -static struct term *new_term(int cols) +static struct wsap_vtcore *new_term(int cols) { - struct term *term = term_new(&(struct term_options){ + struct wsap_vtcore *term = wsap_vtcore_new(&(struct wsap_vtcore_options){ .size = { .x = cols, .y = 2 }, .scrollback = 100, }); @@ -18,12 +18,12 @@ static struct term *new_term(int cols) return term; } -static void feed(struct term *term, const char *text) +static void feed(struct wsap_vtcore *term, const char *text) { - term_feed(term, text, strlen(text), 0); + wsap_vtcore_feed(term, text, strlen(text), 0); } -static void expect_history(struct term *term, int rows, const char *expected) +static void expect_history(struct wsap_vtcore *term, int rows, const char *expected) { char *text = tt_history_text(term, rows); assert(text); @@ -36,13 +36,13 @@ static void expect_history(struct term *term, int rows, const char *expected) static void unicode_and_selection(void) { - struct term *term = new_term(16); + struct wsap_vtcore *term = new_term(16); expect_history(term, 100, ""); feed(term, "eĢš©āš»ē\r\nnext\r\nlast"); expect_history(term, 100, "eĢš©āš»ē\n"); expect_history(term, 0, ""); - term_select_start(term, (struct term_vector2i){0}, false, TERM_SELECT_CELL); - term_select_extend(term, (struct term_vector2i){ .x = 4 }, false); + wsap_vtcore_select_start(term, (struct wsap_vtcore_vector2i){0}, false, WSAP_VTCORE_SELECT_CELL); + wsap_vtcore_select_extend(term, (struct wsap_vtcore_vector2i){ .x = 4 }, false); char *before = tt_selection_text(term); assert(before); expect_history(term, 100, "eĢš©āš»ē\n"); @@ -54,41 +54,41 @@ static void unicode_and_selection(void) expect_history(term, 100, ""); feed(term, "\033[?1049l"); expect_history(term, 100, "eĢš©āš»ē\n"); - term_free(term); + wsap_vtcore_free(term); } static void limits_and_scrolled_view(void) { - struct term *term = new_term(8); + struct wsap_vtcore *term = new_term(8); feed(term, "one\r\ntwo\r\nthree\r\nfour\r\nfive"); expect_history(term, 100, "one\ntwo\nthree\n"); expect_history(term, 2, "two\nthree\n"); - term_scroll(term, 2); + wsap_vtcore_scroll(term, 2); expect_history(term, 100, "one\n"); - term_scroll(term, 100); + wsap_vtcore_scroll(term, 100); expect_history(term, 100, ""); - term_scroll_to(term, 0); - assert(term_resize(term, (struct term_vector2i){ .x = 12, .y = 2 })); + wsap_vtcore_scroll_to(term, 0); + assert(wsap_vtcore_resize(term, (struct wsap_vtcore_vector2i){ .x = 12, .y = 2 })); expect_history(term, 100, "one\ntwo\nthree\n"); - term_free(term); + wsap_vtcore_free(term); } static void wrapped_rows(void) { - struct term *term = new_term(4); + struct wsap_vtcore *term = new_term(4); feed(term, "abcdefghi\r\nx\r\ny"); expect_history(term, 100, "abcdefghi\n"); expect_history(term, 2, "efghi\n"); - term_free(term); + wsap_vtcore_free(term); term = new_term(4); feed(term, "abcdefghijklm"); expect_history(term, 100, "abcdefgh"); - term_free(term); + wsap_vtcore_free(term); } struct writer { - struct term *term; + struct wsap_vtcore *term; _Atomic bool done; }; @@ -106,7 +106,7 @@ static void *write_history(void *userdata) static void concurrent_history(void) { - struct term *term = new_term(16); + struct wsap_vtcore *term = new_term(16); struct writer writer = { .term = term }; pthread_t thread; assert(pthread_create(&thread, NULL, write_history, &writer) == 0); @@ -121,7 +121,7 @@ static void concurrent_history(void) free(text); } while (!atomic_load(&writer.done)); assert(pthread_join(thread, NULL) == 0); - term_free(term); + wsap_vtcore_free(term); } int main(void) |
