📄 pad.c
字号:
int i; const char *start_message; if (t->flags & 1) { /* il */ if (!parm_insert_line) { CAP_NOT_FOUND; ptext("(il) Insert-lines not present. "); pad_done_message(t, state, ch); return; } start_message = "(il) Insert-lines start testing"; } else { /* il1 */ if (!insert_line) { CAP_NOT_FOUND; ptext("(il1) Insert-line not present. "); pad_done_message(t, state, ch); return; } start_message = "(il1) Insert-line 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 (insert_line && repeats == 1) { tt_putp(insert_line); } else { tt_putparm(parm_insert_line, repeats, repeats, 0); } } while(still_testing()); put_str("This line should be on the bottom.\r"); if (insert_line && augment == 1) { for (i = 1; i < lines; i++) { tt_putp(insert_line); } } else { tt_putparm(parm_insert_line, lines - 1, lines - 1, 0); } putln("The screen should have text on the bottom line."); sprintf(temp, "Insert %d line%s. ", augment, augment == 1 ? "" : "s"); put_str(temp); pad_test_shutdown(t, 0); pad_done_message(t, state, ch); put_clear();}/*** pad_indn(test_list, status, ch)**** Test (indn) and (ind) Scroll forward*/static voidpad_indn( struct test_list *t, int *state, int *ch){ int i; const char *start_message; if (t->flags & 1) { /* indn */ if (!parm_index) { CAP_NOT_FOUND; ptext("(indn) Scroll-forward-n-lines not present. "); pad_done_message(t, state, ch); return; } start_message = "(indn) Scroll-forward-n-lines start testing"; } else { /* ind */ if (!scroll_forward) { CAP_NOT_FOUND; ptext("(ind) Scroll-forward not present. "); pad_done_message(t, state, ch); return; } if (over_strike) { ptext("(ind) Scroll-forward not tested on overstrike terminals. "); pad_done_message(t, state, ch); return; } start_message = "(ind) Scroll-forward start testing"; augment = 1; } if (skip_pad_test(t, state, ch, start_message)) { return; } pad_test_startup(1); /* go to the bottom of the screen */ home_down(); do { sprintf(temp, "%d\r", test_complete); put_str(temp); if (scroll_forward && repeats == 1) { put_ind(); } else { tt_putparm(parm_index, repeats, repeats, 0); } } while(still_testing()); put_str("This line should be on the top.\r"); if (scroll_forward && augment == 1) { for (i = 1; i < lines; i++) { put_ind(); } } else { tt_putparm(parm_index, lines - 1, lines - 1, 0); } go_home(); sprintf(temp, "\nScroll forward %d line%s. ", augment, augment == 1 ? "" : "s"); put_str(temp); pad_test_shutdown(t, 0); pad_done_message(t, state, ch);}/*** pad_dl(test_list, status, ch)**** Test (dl) and (dl1) Delete lines*/static voidpad_dl( struct test_list *t, int *state, int *ch){ int i = 0; const char *start_message; if (t->flags & 1) { /* dl */ if (!parm_delete_line) { CAP_NOT_FOUND; ptext("(dl) Delete-lines not present. "); pad_done_message(t, state, ch); return; } start_message = "(dl) Delete-lines start testing"; } else { /* dl1 */ if (!delete_line) { CAP_NOT_FOUND; ptext("(dl1) Delete-line not present. "); pad_done_message(t, state, ch); return; } start_message = "(dl1) Delete-line 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); if (augment < lines - 1) { go_home(); putln(temp); } put_str(temp); if (delete_line && repeats == 1) { tt_putp(delete_line); } else { tt_putparm(parm_delete_line, repeats, repeats, 0); } } while(still_testing()); home_down(); put_str("This line should be on the top."); go_home(); if (delete_line && augment == 1) { for (i = 1; i < lines; i++) { tt_putp(delete_line); } } else { tt_putparm(parm_delete_line, lines - 1, lines - 1, 0); } sprintf(temp, "\nDelete %d line%s. ", augment, augment == 1 ? "" : "s"); put_str(temp); pad_test_shutdown(t, 0); pad_done_message(t, state, ch);}/*** pad_xl(test_list, status, ch)**** Test (il1) Insert and (dl1) Delete lines*/static voidpad_xl( struct test_list *t, int *state, int *ch){ if (!insert_line && !delete_line) { /* quietly skip this test */ return; } if (skip_pad_test(t, state, ch, "(il1) Insert-line, (dl1) Delete-line start testing")) { return; } put_clear(); putln("\rThis text is written on the first line."); ptext("This sentence begins on the second line. As this"); ptext(" test runs the bottom part of this paragraph will"); ptext(" jump up and down. Don't worry, that's normal. When"); ptext(" the jumping stops, the entire paragraph should"); ptext(" still be on the screen and in the same place as when"); ptext(" the test started. If this paragraph has scrolled"); ptext(" off the top or bottom of the screen then the test"); ptext(" has failed. Scrolling off the top of the screen"); ptext(" usually means that the delete line capability is"); ptext(" working better than the insert line capability. If"); ptext(" the text scrolls off the bottom then delete line may"); ptext(" be broken. If parts of the text are missing then"); ptext(" you should get professional help."); put_crlf(); go_home(); put_newlines(2); pad_test_startup(0); do { tt_putp(insert_line); put_cr(); tt_putp(delete_line); } while(still_testing()); pad_test_shutdown(t, 0); home_down(); ptext("The top of the screen should have a paragraph of text. "); pad_done_message(t, state, ch);}/*** pad_scrc(test_list, status, ch)**** Test (sc) (rc) Save/restore cursor*/static voidpad_scrc( struct test_list *t, int *state, int *ch){ int i; if (!save_cursor || !restore_cursor) { CAP_NOT_FOUND; if (save_cursor) { ptext("(rc) Restore-cursor"); } else if (restore_cursor) { ptext("(sc) Save-cursor"); } else { ptext("(sc) Save-cursor, (rc) Restore-cursor"); } ptext(" not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(sc) (rc) Save/Restore-cursor start testing")) { return; } pad_test_startup(1); do { page_loop(); for (i = 1; i < columns; i++) { tt_putp(save_cursor); putchp(letter); tt_putp(restore_cursor); putchp('X'); } } while(still_testing()); pad_test_shutdown(t, 0); home_down(); ptext(above_line); pad_done_message(t, state, ch);}/*** pad_csrind(test_list, status, ch)**** Test (csr) and (ind) Change scroll region and index.*/static voidpad_csrind( struct test_list *t, int *state, int *ch){ int i; if (!change_scroll_region) { CAP_NOT_FOUND; ptext("(csr) Change-scroll-region not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(csr) Save/Restore-cursor, (ind) index start testing")) { return; } if (augment < 2) { augment = 2; } if (augment > lines - 1) { augment = lines - 1; } put_clear(); ptext("This text is on the top line."); tt_putparm(change_scroll_region, 1, lines - augment, lines - 1); /* go to the bottom of the screen */ home_down(); pad_test_startup(0); do { sprintf(temp, "%d\r", test_complete); put_str(temp); put_ind(); } while(still_testing()); ptextln("(csr) is broken."); for (i = augment; i > 1; i--) { put_ind(); } pad_test_shutdown(t, 0); ptext("All but top and bottom lines should be blank. "); pad_done_message(t, state, ch); tt_putparm(change_scroll_region, 1, 0, lines - 1); put_clear();}/*** pad_sccsrrc(test_list, status, ch)**** Test (sc) (csr) and (rc) Save/Change/Restore scroll region*/static voidpad_sccsrrc( struct test_list *t, int *state, int *ch){ int i; if (!save_cursor || !change_scroll_region || !restore_cursor) { /* quietly ignore this test */ return; } if (skip_pad_test(t, state, ch, "(sc) (csr) (rc) Save/Change/Restore-cursor, start testing")) { return; } pad_test_startup(1); do { page_loop(); for (i = 1; i < columns; i++) { tt_putp(save_cursor); putchp(letter); tt_putparm(change_scroll_region, 1, 0, lines - 1); tt_putp(restore_cursor); putchp('X'); } } while(still_testing()); pad_test_shutdown(t, 0); home_down(); ptext(above_line); pad_done_message(t, state, ch); tt_putparm(change_scroll_region, 1, 0, lines - 1);}/*** pad_csr_nel(test_list, status, ch)**** Test (sc) (csr) (nel) and (rc) Save/Change/Restore scroll region*/static voidpad_csr_nel( struct test_list *t, int *state, int *ch){ int i, j; if (!save_cursor || !change_scroll_region || !restore_cursor) { /* quietly ignore this test */ return; } if (skip_pad_test(t, state, ch, "(csr) Change-scroll-region, (nel) newline start testing")) { return; } pad_test_startup(1); do { for (i = 0; i < lines; i++) { for (j = lines - i; j > 0; j--) { put_crlf(); } tt_putp(save_cursor); tt_putparm(change_scroll_region, 1, i, lines - 1); tt_putp(restore_cursor); put_str(every_line); } tt_putp(save_cursor); tt_putparm(change_scroll_region, 1, 0, lines - 1); tt_putp(restore_cursor); } while(still_testing()); pad_test_shutdown(t, 0); put_str(" "); pad_done_message(t, state, ch); tt_putparm(change_scroll_region, 1, 0, lines - 1);}/*** pad_csr_cup(test_list, status, ch)**** Test (csr) (cup) Change scroll region and cursor address*/static voidpad_csr_cup( struct test_list *t, int *state, int *ch){ int i, j; if (!change_scroll_region || !cursor_address) { /* quietly ignore this test */ return; } if (skip_pad_test(t, state, ch, "(csr) Change-scroll-region, (cup) cursor-address start testing")) { return; } pad_test_startup(1); do { for (i = 0; i < lines; i++) { for (j = lines - i; j > 0; j--) { put_crlf(); } tt_putparm(change_scroll_region, 1, i, lines - 1); tt_putparm(cursor_address, 1, lines - 1, 0); put_str(every_line); } tt_putparm(change_scroll_region, 1, 0, lines - 1); tt_putparm(cursor_address, 1, lines - 1, strlen(every_line)); } while(still_testing()); pad_test_shutdown(t, 0); put_str(" "); pad_done_message(t, state, ch); tt_putparm(change_scroll_region, 1, 0, lines - 1);}/*** pad_ht(test_list, status, ch)**** Test (ht) Tabs*/static voidpad_ht( struct test_list *t, int *state, int *ch){ int i, j; if (!set_tab && init_tabs <= 0) { CAP_NOT_FOUND; ptext("(ht) Tab not tested. (hts) Set-tabs and (it) initial-tabs not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(ht) Tab start testing")) { return; } pad_test_startup(1); do { /* it is not always possible to test tabs with caps that do not already have padding. The following test uses a mixed bag of tests in order to avoid this problem. Note: I do not scroll */ if (auto_right_margin && can_go_home) for (i = 1, go_home(); i < lines - 2; i++) { for (j = 8; j < columns; j += 8) { putchp('\t'); } put_str("A "); } if (cursor_down && can_go_home) for (i = 1, go_home(); i < lines - 2; i++) { for (j = 8; j < columns; j += 8) { putchp('\t'); } put_str("D\r"); tt_putp(cursor_down); } if (cursor_address) for (i = 1; i < lines - 2; i++) { tt_putparm(cursor_address, 1, i - 1, 0); for (j = 8; j < columns; j += 8) { putchp('\t'); } put_str("C"); } go_home(); for (i = 1; i < lines - 2; i++) { for (j = 8; j < columns; j += 8) { putchp('\t'); } putln("N"); } } while(still_testing()); pad_test_shutdown(t, 0); ptextln("Letters on the screen other than Ns at the right margin indicate failure."); ptext("A-(am) D-(cud1) C-(cup) N-(nel) "); pad_done_message(t, state, ch);}/*** pad_smso(test_list, status, ch)**** Test (smso) (rmso) Enter/exit mode*/static voidpad_smso( struct test_list *t, int *state, int *ch){ int i, j; if (!enter_standout_mode || !exit_standout_mode) { CAP_NOT_FOUND; ptext("(smso) (rmso) Enter/Exit-standout-mode not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(smso) (rmso) Enter/Exit-standout-mode start testing")) { return; } /* In terminals that emulate non-hidden attributes with hidden attributes, the amount of time that it takes to fill the screen with an attribute is nontrivial. The following test is designed to catch those delays */ pad_test_startup(1); do { page_loop(); j = magic_cookie_glitch > 0 ? magic_cookie_glitch : 0; for (i = 2 + j + j; i < columns;) { put_mode(enter_standout_mode); i += j + j + 2; putchp('X'); put_mode(exit_standout_mode); putchp('X'); } } while(still_testing()); pad_test_shutdown(t, 0); home_down(); ptext(above_line); pad_done_message(t, state, ch); put_mode(exit_standout_mode);}/*** pad_smacs(test_list, status, ch)**** Test (smacs) (rmacs) Enter/exit altcharset mode*/static voidpad_smacs( struct test_list *t, int *state, int *ch){ int i, j; /* test enter even if exit is missing */ if (!enter_alt_charset_mode) { CAP_NOT_FOUND; ptext("(smacs) Enter-altcharset-mode not present. "); pad_done_message(t, state, ch); return; } if (skip_pad_test(t, state, ch, "(smacs) (rmacs) Enter/Exit-altcharset-mode start testing")) { return; } pad_test_startup(1); do { page_loop(); j = magic_cookie_glitch > 0 ? magic_cookie_glitch : 0; for (i = 2 + j + j; i < columns;) { put_mode(enter_alt_charset_mode); i += j + j + 2; putchp(letter); put_mode(exit_alt_charset_mode); putchp(letter); } } while(still_testing()); pad_test_shutdown(t, 0); home_down(); ptext("Every other character is from the alternate character set. "); pad_done_message(t, state, ch); put_mode(exit_alt_charset_mode);}/*** pad_crash(test_list, status, ch)**** Test (clear) without padding*/static voidpad_crash( struct test_list *t, int *state, int *ch){ int save_xon_xoff; if (!clear_screen) { ptext("(clear) Clear-screen not present. "); pad_done_message(t, state, ch); return; } ptext("If you would like to see if the terminal will really lock up."); ptextln(" I will send the clear screen sequence without the pads."); if (skip_pad_test(t, state, ch, "(clear) Clear-screen start crash testing")) { return; } save_xon_xoff = xon_xoff; xon_xoff = 1; pad_test_startup(0); do { put_str("Erase this!"); tt_putp(clear_screen); } while(still_testing()); xon_xoff = save_xon_xoff; pad_test_shutdown(t, 1); pad_done_message(t, state, ch);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -