X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=tests%2Fgridtest.c;h=7f25db161fa7318c477dae01504ef7e1ccb5b8eb;hb=0c5e51127206d26290a8e1e1349ab37d847d1d84;hp=d8922a19dac4c32c1067f35398399c4241e3bb40;hpb=78652af29a2f39e626febd5f4213da57d3a13901;p=projects%2Fchimara%2Fchimara.git diff --git a/tests/gridtest.c b/tests/gridtest.c index d8922a1..7f25db1 100644 --- a/tests/gridtest.c +++ b/tests/gridtest.c @@ -3,6 +3,7 @@ #include #include #include +#include void glk_main(void) { @@ -12,73 +13,62 @@ void glk_main(void) return; glk_set_window(mainwin); - glk_put_string("Philip en Marijn zijn vet goed.\n"); - glk_put_string("A veeeeeeeeeeeeeeeeeeeeeeeeeeeery looooooooooooooooooooooooong striiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing.\n"); - - int count; - for(count = 0; count < 30; count++) - glk_put_string("I want to write past the end of this text buffer! "); - - glui32 width, height; + glui32 width, height, x, y; glk_window_get_size(mainwin, &width, &height); - fprintf(stderr, "\nWidth: %d\nHeight: %d\nPress a key in the window, not in the terminal.\n", width, height); - glk_request_char_event(mainwin); - while(1) { - glk_select(&ev); - if(ev.type == evtype_CharInput) - break; + if(height < 4 || width < 22) + { + glk_put_string("Window not big enough"); + glk_exit(); } - - glk_window_move_cursor(mainwin, 15, 15); - glk_put_string(". . "); - glk_window_move_cursor(mainwin, 15, 16); - glk_put_string(" . ."); - glk_window_move_cursor(mainwin, 15, 17); - glk_put_string(". . "); - glk_window_move_cursor(mainwin, 15, 18); - glk_put_string(" . ."); - fprintf(stderr, "Cursor location test.\nPress another key.\n"); - glk_request_char_event(mainwin); - while(1) { - glk_select(&ev); - if(ev.type == evtype_CharInput) - break; - } - + char *buffer = calloc(256, sizeof(char)); assert(buffer); - fprintf(stderr, "Line input field until end of line\n"); - glk_window_move_cursor(mainwin, 10, 20); - glk_request_line_event(mainwin, buffer, 256, 0); - while(1) { - glk_select(&ev); - if(ev.type == evtype_LineInput) - break; - } + garglk_set_reversevideo(1); + for(y=0; y