📄 pad.c
字号:
hzcc = columns * 8 / 10; /* horizontal character count */ if (augment > hzcc) { augment = hzcc; } pad_test_startup(1); do { go_home(); for (i = 2; i < lines; i++) { for (j = -1; j < augment; j++) { putchp(letter); } put_cr(); putchp(letter); tt_putp(clr_eol); put_crlf(); SLOW_TERMINAL_EXIT; } putchp(letter); put_crlf(); NEXT_LETTER; } while(still_testing()); pad_test_shutdown(t, 0); ptext(all_lines); pad_done_message(t, state, ch); put_clear();}/*** pad_smdc(test_list, status, ch)**** Test (smdc) (rmdc) Delete mode*/static voidpad_smdc( struct test_list *t, int *state, int *ch){ int i; if (!enter_delete_mode) { CAP_NOT_FOUND; ptext("(smdc) Enter-delete-mode"); if (!exit_delete_mode) { ptext(", (rmdc) Exit-delete-mode"); } ptext(", not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(smdc) (rmdc) Enter/Exit-delete-mode start testing")) { return; } pad_test_startup(1); do { page_loop(); for (i = 1; i < columns; i++) { tt_putp(enter_delete_mode); tt_putp(exit_delete_mode); putchp(letter); } } while(still_testing()); pad_test_shutdown(t, 0); home_down(); ptext(no_visual); pad_done_message(t, state, ch); put_clear();}/*** pad_dch(test_list, status, ch)**** Test (smdc) (rmdc) Delete mode and (dch)*/static voidpad_dch( struct test_list *t, int *state, int *ch){ int i, j; if (!parm_dch) { CAP_NOT_FOUND; ptext("(dch) Delete-characters, not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(dch) Delete-characters start testing")) { return; } hzcc = columns * 8 / 10; /* horizontal character count */ if (augment > hzcc) { augment = hzcc; } pad_test_startup(1); do { go_home(); for (i = 2; i < lines; i++) { for (j = 0; j <= repeats; j++) { putchp(letter); } put_cr(); tt_putp(enter_delete_mode); tt_putparm(parm_dch, repeats, repeats, 0); tt_putp(exit_delete_mode); put_crlf(); SLOW_TERMINAL_EXIT; } putchp(letter); put_crlf(); NEXT_LETTER; } while(still_testing()); pad_test_shutdown(t, 0); home_down(); ptext(all_lines); pad_done_message(t, state, ch); put_clear();}/*** pad_dch1(test_list, status, ch)**** Test (smdc) (rmdc) Delete mode and (dch1)*/static voidpad_dch1( struct test_list *t, int *state, int *ch){ int i, j; if (!delete_character) { if (parm_dch) { /* if the other one is defined then its OK */ return; } CAP_NOT_FOUND; ptext("(dch1) Delete-character, not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(dch1) Delete-character start testing")) { return; } hzcc = columns * 8 / 10; /* horizontal character count */ if (augment > hzcc) { augment = hzcc; } pad_test_startup(1); do { go_home(); for (i = 2; i < lines; i++) { for (j = -1; j < augment; j++) { putchp(letter); } put_cr(); tt_putp(enter_delete_mode); for (j = 0; j < augment; j++) { tt_putp(delete_character); } tt_putp(exit_delete_mode); put_crlf(); SLOW_TERMINAL_EXIT; } putchp(letter); put_crlf(); NEXT_LETTER; } while(still_testing()); pad_test_shutdown(t, 0); ptext(all_lines); pad_done_message(t, state, ch); put_clear();}/*** pad_smir(test_list, status, ch)**** Test (smir) (rmir) Insert mode*/static voidpad_smir( struct test_list *t, int *state, int *ch){ int i; if (!enter_insert_mode) { CAP_NOT_FOUND; ptext("(smir) Enter-insert-mode"); if (!exit_insert_mode) { ptext(", (rmir) Exit-insert-mode"); } ptext(", not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(smir) (rmir) Enter/Exit-insert-mode start testing")) { return; } pad_test_startup(1); do { page_loop(); for (i = 1; i < columns; i++) { tt_putp(enter_insert_mode); tt_putp(exit_insert_mode); putchp(letter); } } while(still_testing()); pad_test_shutdown(t, 0); home_down(); ptext(no_visual); pad_done_message(t, state, ch); put_clear();}/*** pad_ich(test_list, status, ch)**** Test (smir) (rmir) Insert mode and (ich) and (ip)*/static voidpad_ich( struct test_list *t, int *state, int *ch){ int i, j; if (!parm_ich) { CAP_NOT_FOUND; ptext("(ich) Insert-characters, not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(ich) Insert-characters, (ip) Insert-padding start testing")) { return; } j = columns * 9 / 10; if (augment > j) { augment = j; } pad_test_startup(1); do { go_home(); for (i = 2; i < lines; i++) { putchp(letter); put_cr(); tt_putp(enter_insert_mode); replace_mode = 0; tt_putparm(parm_ich, repeats, repeats, 0); tt_putp(exit_insert_mode); replace_mode = 1; put_crlf(); SLOW_TERMINAL_EXIT; } for (i = 0; i < repeats; i++) { putchp(' '); } putchp(letter); NEXT_LETTER; put_crlf(); } while(still_testing()); pad_test_shutdown(t, 0); ptext(all_lines); pad_done_message(t, state, ch); tc_putp(exit_insert_mode);}/*** pad_ich1(test_list, status, ch)**** Test (smir) (rmir) Insert mode and (ich1) and (ip)*/static voidpad_ich1( struct test_list *t, int *state, int *ch){ int i, j; if (!insert_character) { CAP_NOT_FOUND; ptext("(ich1) Insert-character, not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(ich1) Insert-character, (ip) Insert-padding start testing")) { return; } if (augment > columns - 2) { augment = columns - 2; } pad_test_startup(1); do { put_clear(); for (i = 2; i < lines; i++) { putchp(letter); put_cr(); tt_putp(enter_insert_mode); replace_mode = 0; if (!insert_padding && !insert_character) { /* only enter/exit is needed */ for (j = 0; j < augment; j++) { putchp('.'); } } else { for (j = 0; j < augment; j++) { tt_putp(insert_character); putchp('.'); tt_putp(insert_padding); } } tt_putp(exit_insert_mode); replace_mode = 1; put_crlf(); SLOW_TERMINAL_EXIT; } for (j = 0; j < augment; j++) { putchp('.'); } putchp(letter); NEXT_LETTER; put_crlf(); } while(still_testing()); pad_test_shutdown(t, 0); ptext(all_lines); pad_done_message(t, state, ch); tc_putp(exit_insert_mode);}/*** pad_xch1(test_list, status, ch)**** Test (ich1) (ip) (dch1)*/static voidpad_xch1( struct test_list *t, int *state, int *ch){ static char xch1[] = "This line should not be garbled. It should be left justified."; if (enter_insert_mode || exit_insert_mode || enter_delete_mode || exit_delete_mode || !insert_character || !delete_character) { /* this test is quietly ignored */ return; } if (skip_pad_test(t, state, ch, "(ich1) Insert-character, (dch1) Delete-character start testing")) { return; } put_crlf(); ptext(xch1); put_cr(); pad_test_startup(0); do { tt_putp(insert_character); tt_putp(delete_character); } while(still_testing()); pad_test_shutdown(t, 1); ptextln(xch1); ptext("The preceding two lines should be the same. "); pad_done_message(t, state, ch);}/*** pad_rep(test_list, status, ch)**** Test (rep) repeat character*/static voidpad_rep( struct test_list *t, int *state, int *ch){ int i, j; if (!repeat_char) { CAP_NOT_FOUND; ptext("(rep) Repeat-character, not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(rep) Repeat-character start testing")) { return; } if (augment > columns - 2) { augment = columns - 2; } if (augment < 2) { augment = 2; } pad_test_startup(1); do { go_home(); for (i = 2; i < lines; i++) { tt_putparm(repeat_char, repeats, letter, repeats); put_crlf(); } for (j = 0; j < repeats; j++) { putchp(letter); } put_crlf(); NEXT_LETTER; } while(still_testing()); pad_test_shutdown(t, 0); ptextln(all_lines); pad_done_message(t, state, ch);}/*** pad_cup(test_list, status, ch)**** Test (cup) Cursor address*/static voidpad_cup( struct test_list *t, int *state, int *ch){ int i, j, l, r, c; if (!cursor_address) { CAP_NOT_FOUND; ptext("(cup) Cursor-address not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(cup) Cursor-address start testing")) { return; } put_clear(); ptext("Each line should be filled with the same letter. There should"); ptext(" be no gaps, or single letters scattered over the screen. "); if (char_count + 15 > columns) { put_crlf(); } if (((lines - line_count) & 1) == 0) { /* this removes the gap in the middle of the test when the number of lines is odd. */ put_crlf(); } r = line_count; c = char_count; l = (columns - 4) >> 1; pad_test_startup(0); do { for (i = 1; i + i + r < lines; i++) { for (j = 0; j <= l; j++) { tt_putparm(cursor_address, 1, r + i, j); putchp(letter); tt_putparm(cursor_address, 1, r + i, l + l + 1 - j); putchp(letter); tt_putparm(cursor_address, 1, lines - i, j); putchp(letter); tt_putparm(cursor_address, 1, lines - i, l + l + 1 - j); putchp(letter); } SLOW_TERMINAL_EXIT; } NEXT_LETTER; } while(still_testing()); pad_test_shutdown(t, 0); tt_putparm(cursor_address, 1, line_count = r, char_count = c); pad_done_message(t, state, ch); put_clear();}/*** pad_hd(test_list, status, ch)**** Test (hd) Half down*/static voidpad_hd( struct test_list *t, int *state, int *ch){ int i, j, k; if (!down_half_line) { CAP_NOT_FOUND; ptext("(hd) Half-line-down not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(hd) Half-line-down start testing")) { return; } pad_test_startup(1); do { for (i = 1; i < columns; i += 2) { for (j = 1; j < i; ++j) { putchp(' '); } tt_putp(down_half_line); for (k = lines + lines; k > 4; k--) { if (j++ >= columns) { break; } tt_putp(down_half_line); putchp(letter); } go_home(); SLOW_TERMINAL_EXIT; } NEXT_LETTER; } while(still_testing()); pad_test_shutdown(t, 0); pad_done_message(t, state, ch); put_clear();}/*** pad_hu(test_list, status, ch)**** Test (hu) Half line up*/static voidpad_hu( struct test_list *t, int *state, int *ch){ int i, j, k; if (!up_half_line) { CAP_NOT_FOUND; ptext("(hu) Half-line-up not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(hu) Half-line-up start testing")) { return; } pad_test_startup(1); do { for (i = 1; i < columns; i += 2) { home_down(); for (j = 1; j < i; ++j) { putchp(' '); } tt_putp(up_half_line); for (k = lines + lines; k > 4; k--) { if (j++ >= columns) { break; } tt_putp(up_half_line); putchp(letter); } SLOW_TERMINAL_EXIT; } go_home(); NEXT_LETTER; } while(still_testing()); pad_test_shutdown(t, 0); pad_done_message(t, state, ch); put_clear();}/*** pad_rin(test_list, status, ch)**** Test (rin) and (ri) Reverse index*/static voidpad_rin( struct test_list *t, int *state, int *ch){ int i; const char *start_message; if (t->flags & 1) { /* rin */ if (!parm_rindex) { CAP_NOT_FOUND; ptext("(rin) Scroll-reverse-n-lines not present. "); pad_done_message(t, state, ch); return; } start_message = "(rin) Scroll-reverse-n-lines start testing"; } else { /* ri */ if (!scroll_reverse) { CAP_NOT_FOUND; ptext("(ri) Scroll-reverse not present. "); pad_done_message(t, state, ch); return; } start_message = "(ri) Scroll-reverse start testing"; augment = 1; } if (skip_pad_test(t, state, ch, start_message)) { return; } pad_test_startup(1); do { sprintf(temp, "%d\r", test_complete); put_str(temp); if (scroll_reverse && repeats == 1) { tt_putp(scroll_reverse); } else { tt_putparm(parm_rindex, repeats, repeats, 0); } } while(still_testing()); put_str("This line should be on the bottom.\r"); if (scroll_reverse && augment == 1) { for (i = 1; i < lines; i++) { tt_putp(scroll_reverse); } } else { tt_putparm(parm_rindex, lines - 1, lines - 1, 0); } putln("The screen should have text on the bottom line."); sprintf(temp, "Scroll reverse %d line%s. ", augment, augment == 1 ? "" : "s"); put_str(temp); pad_test_shutdown(t, 0); pad_done_message(t, state, ch); put_clear();}/*** pad_il(test_list, status, ch)**** Test (il) and (il1) Insert line*/static voidpad_il( struct test_list *t, int *state, int *ch){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -