2 ** Copyright (C) 1991, 1997 Free Software Foundation, Inc.
4 ** This file is part of TACK.
6 ** TACK is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU General Public License as published by
8 ** the Free Software Foundation; either version 2, or (at your option)
11 ** TACK is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ** GNU General Public License for more details.
16 ** You should have received a copy of the GNU General Public License
17 ** along with TACK; see the file COPYING. If not, write to
18 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 ** Boston, MA 02110-1301, USA
24 MODULE_ID("$Id: pad.c,v 1.6 2005/09/17 19:49:16 tom Exp $")
26 /* test the pad counts on the terminal */
28 static void pad_standard(struct test_list *, int *, int *);
29 static void init_xon_xoff(struct test_list *, int *, int *);
30 static void init_cup(struct test_list *, int *, int *);
31 static void pad_rmxon(struct test_list *, int *, int *);
32 static void pad_home1(struct test_list *, int *, int *);
33 static void pad_home2(struct test_list *, int *, int *);
34 static void pad_clear(struct test_list *, int *, int *);
35 static void pad_ech(struct test_list *, int *, int *);
36 static void pad_el1(struct test_list *, int *, int *);
37 static void pad_el(struct test_list *, int *, int *);
38 static void pad_smdc(struct test_list *, int *, int *);
39 static void pad_dch(struct test_list *, int *, int *);
40 static void pad_dch1(struct test_list *, int *, int *);
41 static void pad_smir(struct test_list *, int *, int *);
42 static void pad_ich(struct test_list *, int *, int *);
43 static void pad_ich1(struct test_list *, int *, int *);
44 static void pad_xch1(struct test_list *, int *, int *);
45 static void pad_rep(struct test_list *, int *, int *);
46 static void pad_cup(struct test_list *, int *, int *);
47 static void pad_hd(struct test_list *, int *, int *);
48 static void pad_hu(struct test_list *, int *, int *);
49 static void pad_rin(struct test_list *, int *, int *);
50 static void pad_il(struct test_list *, int *, int *);
51 static void pad_indn(struct test_list *, int *, int *);
52 static void pad_dl(struct test_list *, int *, int *);
53 static void pad_xl(struct test_list *, int *, int *);
54 static void pad_scrc(struct test_list *, int *, int *);
55 static void pad_csrind(struct test_list *, int *, int *);
56 static void pad_sccsrrc(struct test_list *, int *, int *);
57 static void pad_csr_nel(struct test_list *, int *, int *);
58 static void pad_csr_cup(struct test_list *, int *, int *);
59 static void pad_ht(struct test_list *, int *, int *);
60 static void pad_smso(struct test_list *, int *, int *);
61 static void pad_smacs(struct test_list *, int *, int *);
62 static void pad_crash(struct test_list *, int *, int *);
65 Any command found in this list, executed from a "Done" prompt
66 will force the default action to repeat rather than next.
68 const char *pad_repeat_test = {"ep-+<>"};
70 struct test_list pad_test_list[] = {
71 {0, 0, 0, 0, "e) edit terminfo", 0, &edit_menu},
72 {0, 0, 0, 0, "p) change padding", 0, &change_pad_menu},
73 {0, 0, 0, 0, "@) display statistics about the last test", dump_test_stats, 0},
74 {0, 0, 0, 0, "c) clear screen", menu_clear_screen, 0},
75 {0, 0, 0, 0, "i) send reset and init", menu_reset_init, 0},
76 {0, 0, 0, 0, txt_longer_test_time, longer_test_time, 0},
77 {0, 0, 0, 0, txt_shorter_test_time, shorter_test_time, 0},
78 {0, 0, 0, 0, txt_longer_augment, longer_augment, 0},
79 {0, 0, 0, 0, txt_shorter_augment, shorter_augment, 0},
81 Phase 1: Test initialization and reset strings.
83 (rs1) (rs2) (rs3) (is1) (is2) (is3) are very difficult to test.
84 They have no defined output. To make matters worse, the cap
85 builder could partition (rs1) (rs2) (rs3) by length, leaving the
86 terminal in some unknown state between (rs1) and (rs2) or between
87 (r2) and (rs3). Some reset strings clear the screen when done.
89 We have no control over this. The only thing we can do for
90 certain is to test the pad times by checking for overruns.
92 {MENU_NEXT, 3, "rs1", 0, 0, pad_standard, 0},
93 {MENU_NEXT, 3, "rs2", 0, 0, pad_standard, 0},
94 {MENU_NEXT, 3, "rs3", 0, 0, pad_standard, 0},
95 {MENU_NEXT | MENU_INIT, 0, 0, 0, 0, init_xon_xoff, 0},
96 {MENU_NEXT, 3, "is1", 0, 0, pad_standard, 0},
97 {MENU_NEXT, 3, "is2", 0, 0, pad_standard, 0},
98 {MENU_NEXT, 3, "is3", 0, 0, pad_standard, 0},
99 {MENU_NEXT, 3, "rmxon", "smxon", 0, pad_rmxon, 0},
100 {MENU_NEXT | MENU_INIT, 0, 0, 0, 0, init_cup, 0},
102 Phase 2: Test home, screen clears and erases.
104 {MENU_NEXT, 0, "home", 0, 0, pad_home1, 0},
105 {MENU_NEXT, 0, "home) (nel", 0, 0, pad_home2, 0},
106 {MENU_NEXT | 1, 0, "clear", 0, 0, pad_clear, 0},
107 {MENU_NEXT | MENU_LM1, 0, "ed", 0, 0, pad_clear, 0},
108 {MENU_NEXT | MENU_80c, 0, "ech", 0, 0, pad_ech, 0},
109 {MENU_NEXT | MENU_80c, 0, "el1", "cub1 nel", 0, pad_el1, 0},
110 {MENU_NEXT | MENU_10c, 0, "el", "nel", 0, pad_el, 0},
112 Phase 3: Character deletions and insertions
114 {MENU_NEXT, 0, "smdc) (rmdc", 0, 0, pad_smdc, 0},
115 {MENU_NEXT | MENU_80c, 0, "dch", "smdc rmdc", 0, pad_dch, 0},
116 {MENU_NEXT | MENU_80c, 0, "dch1", "smdc rmdc", 0, pad_dch1, 0},
117 {MENU_NEXT, 0, "smir) (rmir", 0, 0, pad_smir, 0},
118 {MENU_NEXT | MENU_90c, 0, "ich) (ip", "smir rmir", 0, pad_ich, 0},
119 {MENU_NEXT | MENU_90c, 0, "ich1) (ip", "smir rmir", 0, pad_ich1, 0},
120 {MENU_NEXT, 4, "ich1) (dch1", "smir rmir", 0, pad_xch1, 0},
121 {MENU_NEXT | MENU_90c, 0, "rep", 0, 0, pad_rep, 0},
123 Phase 4: Test cursor addressing pads.
125 {MENU_NEXT, 0, "cup", 0, 0, pad_cup, 0},
127 Phase 5: Test scrolling and cursor save/restore.
129 {MENU_NEXT, 0, "hd", 0, 0, pad_hd, 0},
130 {MENU_NEXT, 0, "hu", 0, 0, pad_hu, 0},
131 {MENU_NEXT | MENU_LM1 | 1, 0, "rin", 0, 0, pad_rin, 0},
132 {MENU_NEXT, 0, "ri", 0, 0, pad_rin, 0},
133 {MENU_NEXT | MENU_LM1 | 1, 0, "il", 0, 0, pad_il, 0},
134 {MENU_NEXT, 0, "il1", 0, 0, pad_il, 0},
135 {MENU_NEXT | MENU_LM1 | 1, 0, "indn", 0, 0, pad_indn, 0},
136 {MENU_NEXT, 0, "ind", 0, 0, pad_indn, 0},
137 {MENU_NEXT | MENU_LM1 | 1, 0, "dl", 0, 0, pad_dl, 0},
138 {MENU_NEXT, 0, "dl1", 0, 0, pad_dl, 0},
139 {MENU_NEXT, 0, "il1) (dl1", 0, 0, pad_xl, 0},
140 {MENU_NEXT, 0, "sc) (rc", 0, 0, pad_scrc, 0},
141 {MENU_NEXT | MENU_50l, 0, "csr) (ind", 0, 0, pad_csrind, 0},
142 {MENU_NEXT, 0, "sc) (csr) (rc", 0, 0, pad_sccsrrc, 0},
143 {MENU_NEXT, 0, "csr) (nel", "sc rc", 0, pad_csr_nel, 0},
144 {MENU_NEXT, 0, "csr) (cup", 0, 0, pad_csr_cup, 0},
148 {MENU_NEXT, 0, "ht", 0, 0, pad_ht, 0},
150 Phase 7: Test character-set-switch pads.
152 {MENU_NEXT, 0, "smso) (rmso", 0, 0, pad_smso, 0},
153 {MENU_NEXT, 0, "smacs) (rmacs", 0, 0, pad_smacs, 0},
155 Phase 8: Tests for miscellaneous mode-switch pads.
157 {MENU_NEXT, 3, "flash", 0, 0, pad_standard, 0},
158 {MENU_NEXT, 3, "smkx", 0, 0, pad_standard, 0},
159 {MENU_NEXT, 3, "rmkx", 0, 0, pad_standard, 0},
160 {MENU_NEXT, 3, "smm", 0, 0, pad_standard, 0},
161 {MENU_NEXT, 3, "rmm", 0, 0, pad_standard, 0},
163 Phase 9: Test crash-and-burn properties of unpadded (clear).
165 {0, 0, "clear", "xon", "k) run clear test with no padding", pad_crash, 0},
166 {MENU_LAST, 0, 0, 0, 0, 0, 0}
170 static int hzcc; /* horizontal character count */
171 char letter; /* current character being displayed */
172 int letter_number; /* points into letters[] */
173 int augment, repeats; /* number of characters (or lines) effected */
174 char letters[] = "AbCdefghiJklmNopQrStuVwXyZ";
176 static char every_line[] = "This text should be on every line.";
177 static char all_lines[] = "Each char on any line should be the same. ";
178 static char above_line[] = "The above lines should be all Xs. ";
179 static char no_visual[] = "This loop test has no visual failure indicator. ";
182 ** pad_standard(test_list, status, ch)
184 ** Run a single cap pad test.
192 const char *long_name;
197 if ((cap = get_string_cap_byname(t->caps_done, &long_name))) {
198 sprintf(tbuf, "(%s) %s, start testing", t->caps_done,
200 if (skip_pad_test(t, state, ch, tbuf)) {
214 } while(still_testing());
215 pad_test_shutdown(t, 0);
224 /* Note: get_string_cap_byname() always sets long_name */
225 sprintf(temp, "(%s) %s, not present. ", t->caps_done,
229 pad_done_message(t, state, ch);
233 ** init_xon_xoff(test_list, status, ch)
235 ** Initialize the xon_xoff values
239 struct test_list *t GCC_UNUSED,
240 int *state GCC_UNUSED,
243 /* the reset strings may dink with the XON/XOFF modes */
244 if (select_xon_xoff == 0 && exit_xon_mode) {
245 tc_putp(exit_xon_mode);
247 if (select_xon_xoff == 1 && enter_xon_mode) {
248 tc_putp(enter_xon_mode);
253 ** pad_rmxon(test_list, status, ch)
255 ** Test (rmxon) exit XON/XOFF mode
263 if (select_xon_xoff == 0 && exit_xon_mode) {
264 pad_standard(t, state, ch);
269 ** init_cup(test_list, status, ch)
271 ** Send the initialization strings for XON/XOFF and (smcup)
272 ** Stop pad testing if clear screen is missing.
280 init_xon_xoff(t, state, ch);
282 tc_putp(enter_ca_mode);
284 if (!can_clear_screen) {
285 ptext("(clear) clear screen not present,");
286 ptext(" pad processing terminated. ");
287 pad_done_message(t, state, ch);
288 if (*ch == 0 || *ch == 'n' || *ch == 's' || *ch == 'r') {
296 ** pad_home1(test_list, status, ch)
298 ** Test (home) when (am) is set.
308 if (can_go_home && auto_right_margin) {
310 truly brain damaged terminals will fail this test because
311 they cannot accept data at full rate
313 if (skip_pad_test(t, state, ch, "(home) Home start testing")) {
319 for (j = 1; j < lines; j++) {
320 for (k = 0; k < columns; k++) {
330 } while(still_testing());
331 pad_test_shutdown(t, 0);
332 ptext("All the dots should line up. ");
333 pad_done_message(t, state, ch);
339 ** pad_home2(test_list, status, ch)
341 ** Test (home) and (nel). (am) is reset.
352 if (skip_pad_test(t, state, ch,
353 "(home) Home, (nel) newline start testing")) {
359 for (j = 1; j < lines; j++) {
360 for (k = 2; k < columns; k++) {
367 put_crlf(); /* this does the (nel) */
371 } while(still_testing());
372 pad_test_shutdown(t, 0);
373 ptext("All the dots should line up. ");
374 pad_done_message(t, state, ch);
380 ** pad_clear(test_list, status, ch)
382 ** Test (clear) and (ed)
383 ** run the clear screen tests (also clear-to-end-of-screen)
397 const char *end_message = 0;
400 int clear_select; /* select the test number */
402 is_clear = t->flags & 1;
403 clear_select = auto_right_margin ? 0 : 1;
405 txt = "(clear) clear-screen start testing";
409 ptext("(ed) erase-to-end-of-display, not present. ");
410 pad_done_message(t, state, ch);
413 txt = "(ed) erase-to-end-of-display start testing";
415 if (skip_pad_test(t, state, ch, txt)) {
419 tc_putp(enter_am_mode);
422 for (; clear_select < 5; clear_select++) {
423 if (augment > lines || is_clear || !cursor_address) {
429 if (augment < lines) {
431 tt_putparm(cursor_address, 1,
432 lines - augment - 1, 0);
433 ptextln("This line should not be erased (ed)");
437 switch (clear_select) {
439 end_message = "Clear full screen. ";
442 end_message = "Clear sparse screen. ";
449 end_message = "Clear one character per line. ";
456 end_message = "Clear one full line. ";
459 end_message = "Clear single short line. ";
464 switch (clear_select) {
465 case 0: /* full screen test */
466 for (j = 1; j < repeats; j++) {
467 for (k = 0; k < columns; k++) {
477 case 1: /* sparse screen test */
478 for (j = columns - repeats; j > 2; j--) {
481 for (j = 2; j < repeats; j++) {
482 tt_putp(cursor_down);
486 case 2: /* short lines */
487 for (j = 2; j < repeats; j++) {
493 case 3: /* one full line */
494 for (j = columns - 5; j > 1; j--) {
498 case 4: /* one short line */
499 put_str("Erase this!");
505 if (augment == lines) {
508 tt_putparm(cursor_address, 1,
511 tt_tputs(clr_eos, repeats);
514 } while(still_testing());
515 pad_test_shutdown(t, 1);
518 pad_done_message(t, state, ch);
520 if (*ch != 0 && *ch != 'n') {
527 ** pad_ech(test_list, status, ch)
529 ** Test (ech) erase characters
541 ptext("(ech) Erase-characters, not present. ");
542 pad_done_message(t, state, ch);
545 if (skip_pad_test(t, state, ch,
546 "(ech) Erase-characters start testing")) {
549 if (augment > columns - 2) {
550 augment = columns - 2;
555 for (i = 2; i < lines; i++) {
556 for (j = 0; j <= repeats; j++) {
560 tt_putparm(erase_chars, repeats, repeats, 0);
564 for (i = 1; i <= repeats; i++) {
570 } while(still_testing());
571 pad_test_shutdown(t, 0);
573 pad_done_message(t, state, ch);
578 ** pad_el1(test_list, status, ch)
580 ** Test (el1) erase to start of line also (cub1) and (nel)
592 ptext("(el1) Erase-to-beginning-of-line, not present. ");
593 pad_done_message(t, state, ch);
596 if (skip_pad_test(t, state, ch,
597 "(el1) Erase-to-beginning-of-line start testing")) {
600 if (augment > columns - 2) {
601 augment = columns - 2;
606 for (i = 2; i < lines; i++) {
607 for (j = 0; j <= repeats; j++) {
610 tt_putp(cursor_left);
611 tt_putp(cursor_left);
612 tt_tputs(clr_bol, repeats);
616 for (i = 1; i <= repeats; i++) {
622 } while(still_testing());
623 pad_test_shutdown(t, 0);
625 pad_done_message(t, state, ch);
630 ** pad_el(test_list, status, ch)
632 ** Test (el) clear to end of line also (nel)
644 ptext("(el) Clear-to-end-of-line, not present. ");
645 pad_done_message(t, state, ch);
648 if (skip_pad_test(t, state, ch,
649 "(el) Clear-to-end-of-line start testing")) {
652 hzcc = columns * 8 / 10; /* horizontal character count */
653 if (augment > hzcc) {
659 for (i = 2; i < lines; i++) {
660 for (j = -1; j < augment; j++) {
672 } while(still_testing());
673 pad_test_shutdown(t, 0);
675 pad_done_message(t, state, ch);
680 ** pad_smdc(test_list, status, ch)
682 ** Test (smdc) (rmdc) Delete mode
692 if (!enter_delete_mode) {
694 ptext("(smdc) Enter-delete-mode");
695 if (!exit_delete_mode) {
696 ptext(", (rmdc) Exit-delete-mode");
698 ptext(", not present. ");
699 pad_done_message(t, state, ch);
702 if (skip_pad_test(t, state, ch,
703 "(smdc) (rmdc) Enter/Exit-delete-mode start testing")) {
709 for (i = 1; i < columns; i++) {
710 tt_putp(enter_delete_mode);
711 tt_putp(exit_delete_mode);
714 } while(still_testing());
715 pad_test_shutdown(t, 0);
718 pad_done_message(t, state, ch);
723 ** pad_dch(test_list, status, ch)
725 ** Test (smdc) (rmdc) Delete mode and (dch)
737 ptext("(dch) Delete-characters, not present. ");
738 pad_done_message(t, state, ch);
741 if (skip_pad_test(t, state, ch,
742 "(dch) Delete-characters start testing")) {
745 hzcc = columns * 8 / 10; /* horizontal character count */
746 if (augment > hzcc) {
752 for (i = 2; i < lines; i++) {
753 for (j = 0; j <= repeats; j++) {
757 tt_putp(enter_delete_mode);
758 tt_putparm(parm_dch, repeats, repeats, 0);
759 tt_putp(exit_delete_mode);
766 } while(still_testing());
767 pad_test_shutdown(t, 0);
770 pad_done_message(t, state, ch);
775 ** pad_dch1(test_list, status, ch)
777 ** Test (smdc) (rmdc) Delete mode and (dch1)
787 if (!delete_character) {
789 /* if the other one is defined then its OK */
793 ptext("(dch1) Delete-character, not present. ");
794 pad_done_message(t, state, ch);
797 if (skip_pad_test(t, state, ch,
798 "(dch1) Delete-character start testing")) {
801 hzcc = columns * 8 / 10; /* horizontal character count */
802 if (augment > hzcc) {
808 for (i = 2; i < lines; i++) {
809 for (j = -1; j < augment; j++) {
813 tt_putp(enter_delete_mode);
814 for (j = 0; j < augment; j++) {
815 tt_putp(delete_character);
817 tt_putp(exit_delete_mode);
824 } while(still_testing());
825 pad_test_shutdown(t, 0);
827 pad_done_message(t, state, ch);
832 ** pad_smir(test_list, status, ch)
834 ** Test (smir) (rmir) Insert mode
844 if (!enter_insert_mode) {
846 ptext("(smir) Enter-insert-mode");
847 if (!exit_insert_mode) {
848 ptext(", (rmir) Exit-insert-mode");
850 ptext(", not present. ");
851 pad_done_message(t, state, ch);
854 if (skip_pad_test(t, state, ch,
855 "(smir) (rmir) Enter/Exit-insert-mode start testing")) {
861 for (i = 1; i < columns; i++) {
862 tt_putp(enter_insert_mode);
863 tt_putp(exit_insert_mode);
866 } while(still_testing());
867 pad_test_shutdown(t, 0);
870 pad_done_message(t, state, ch);
875 ** pad_ich(test_list, status, ch)
877 ** Test (smir) (rmir) Insert mode and (ich) and (ip)
889 ptext("(ich) Insert-characters, not present. ");
890 pad_done_message(t, state, ch);
893 if (skip_pad_test(t, state, ch,
894 "(ich) Insert-characters, (ip) Insert-padding start testing")) {
897 j = columns * 9 / 10;
904 for (i = 2; i < lines; i++) {
907 tt_putp(enter_insert_mode);
909 tt_putparm(parm_ich, repeats, repeats, 0);
910 tt_putp(exit_insert_mode);
915 for (i = 0; i < repeats; i++) {
921 } while(still_testing());
922 pad_test_shutdown(t, 0);
924 pad_done_message(t, state, ch);
925 tc_putp(exit_insert_mode);
929 ** pad_ich1(test_list, status, ch)
931 ** Test (smir) (rmir) Insert mode and (ich1) and (ip)
941 if (!insert_character) {
943 ptext("(ich1) Insert-character, not present. ");
944 pad_done_message(t, state, ch);
947 if (skip_pad_test(t, state, ch,
948 "(ich1) Insert-character, (ip) Insert-padding start testing")) {
951 if (augment > columns - 2) {
952 augment = columns - 2;
957 for (i = 2; i < lines; i++) {
960 tt_putp(enter_insert_mode);
962 if (!insert_padding && !insert_character) {
963 /* only enter/exit is needed */
964 for (j = 0; j < augment; j++) {
968 for (j = 0; j < augment; j++) {
969 tt_putp(insert_character);
971 tt_putp(insert_padding);
974 tt_putp(exit_insert_mode);
979 for (j = 0; j < augment; j++) {
985 } while(still_testing());
986 pad_test_shutdown(t, 0);
988 pad_done_message(t, state, ch);
989 tc_putp(exit_insert_mode);
993 ** pad_xch1(test_list, status, ch)
995 ** Test (ich1) (ip) (dch1)
1003 static char xch1[] =
1004 "This line should not be garbled. It should be left justified.";
1006 if (enter_insert_mode || exit_insert_mode ||
1007 enter_delete_mode || exit_delete_mode ||
1008 !insert_character || !delete_character) {
1009 /* this test is quietly ignored */
1012 if (skip_pad_test(t, state, ch,
1013 "(ich1) Insert-character, (dch1) Delete-character start testing")) {
1019 pad_test_startup(0);
1021 tt_putp(insert_character);
1022 tt_putp(delete_character);
1023 } while(still_testing());
1024 pad_test_shutdown(t, 1);
1026 ptext("The preceding two lines should be the same. ");
1027 pad_done_message(t, state, ch);
1031 ** pad_rep(test_list, status, ch)
1033 ** Test (rep) repeat character
1037 struct test_list *t,
1045 ptext("(rep) Repeat-character, not present. ");
1046 pad_done_message(t, state, ch);
1049 if (skip_pad_test(t, state, ch,
1050 "(rep) Repeat-character start testing")) {
1053 if (augment > columns - 2) {
1054 augment = columns - 2;
1059 pad_test_startup(1);
1062 for (i = 2; i < lines; i++) {
1063 tt_putparm(repeat_char, repeats, letter, repeats);
1066 for (j = 0; j < repeats; j++) {
1071 } while(still_testing());
1072 pad_test_shutdown(t, 0);
1074 pad_done_message(t, state, ch);
1078 ** pad_cup(test_list, status, ch)
1080 ** Test (cup) Cursor address
1084 struct test_list *t,
1090 if (!cursor_address) {
1092 ptext("(cup) Cursor-address not present. ");
1093 pad_done_message(t, state, ch);
1096 if (skip_pad_test(t, state, ch,
1097 "(cup) Cursor-address start testing")) {
1101 ptext("Each line should be filled with the same letter. There should");
1102 ptext(" be no gaps, or single letters scattered over the screen. ");
1103 if (char_count + 15 > columns) {
1106 if (((lines - line_count) & 1) == 0) {
1107 /* this removes the gap in the middle of the test when the
1108 number of lines is odd. */
1113 l = (columns - 4) >> 1;
1114 pad_test_startup(0);
1116 for (i = 1; i + i + r < lines; i++) {
1117 for (j = 0; j <= l; j++) {
1118 tt_putparm(cursor_address, 1, r + i, j);
1120 tt_putparm(cursor_address, 1, r + i, l + l + 1 - j);
1122 tt_putparm(cursor_address, 1, lines - i, j);
1124 tt_putparm(cursor_address, 1, lines - i, l + l + 1 - j);
1130 } while(still_testing());
1131 pad_test_shutdown(t, 0);
1132 tt_putparm(cursor_address, 1, line_count = r, char_count = c);
1133 pad_done_message(t, state, ch);
1138 ** pad_hd(test_list, status, ch)
1140 ** Test (hd) Half down
1144 struct test_list *t,
1150 if (!down_half_line) {
1152 ptext("(hd) Half-line-down not present. ");
1153 pad_done_message(t, state, ch);
1156 if (skip_pad_test(t, state, ch,
1157 "(hd) Half-line-down start testing")) {
1160 pad_test_startup(1);
1162 for (i = 1; i < columns; i += 2) {
1163 for (j = 1; j < i; ++j) {
1166 tt_putp(down_half_line);
1167 for (k = lines + lines; k > 4; k--) {
1168 if (j++ >= columns) {
1171 tt_putp(down_half_line);
1178 } while(still_testing());
1179 pad_test_shutdown(t, 0);
1180 pad_done_message(t, state, ch);
1185 ** pad_hu(test_list, status, ch)
1187 ** Test (hu) Half line up
1191 struct test_list *t,
1197 if (!up_half_line) {
1199 ptext("(hu) Half-line-up not present. ");
1200 pad_done_message(t, state, ch);
1203 if (skip_pad_test(t, state, ch,
1204 "(hu) Half-line-up start testing")) {
1207 pad_test_startup(1);
1209 for (i = 1; i < columns; i += 2) {
1211 for (j = 1; j < i; ++j) {
1214 tt_putp(up_half_line);
1215 for (k = lines + lines; k > 4; k--) {
1216 if (j++ >= columns) {
1219 tt_putp(up_half_line);
1226 } while(still_testing());
1227 pad_test_shutdown(t, 0);
1228 pad_done_message(t, state, ch);
1233 ** pad_rin(test_list, status, ch)
1235 ** Test (rin) and (ri) Reverse index
1239 struct test_list *t,
1244 const char *start_message;
1250 ptext("(rin) Scroll-reverse-n-lines not present. ");
1251 pad_done_message(t, state, ch);
1254 start_message = "(rin) Scroll-reverse-n-lines start testing";
1257 if (!scroll_reverse) {
1259 ptext("(ri) Scroll-reverse not present. ");
1260 pad_done_message(t, state, ch);
1263 start_message = "(ri) Scroll-reverse start testing";
1266 if (skip_pad_test(t, state, ch, start_message)) {
1269 pad_test_startup(1);
1271 sprintf(temp, "%d\r", test_complete);
1273 if (scroll_reverse && repeats == 1) {
1274 tt_putp(scroll_reverse);
1276 tt_putparm(parm_rindex, repeats, repeats, 0);
1278 } while(still_testing());
1279 put_str("This line should be on the bottom.\r");
1280 if (scroll_reverse && augment == 1) {
1281 for (i = 1; i < lines; i++) {
1282 tt_putp(scroll_reverse);
1285 tt_putparm(parm_rindex, lines - 1, lines - 1, 0);
1287 putln("The screen should have text on the bottom line.");
1288 sprintf(temp, "Scroll reverse %d line%s. ", augment,
1289 augment == 1 ? "" : "s");
1291 pad_test_shutdown(t, 0);
1292 pad_done_message(t, state, ch);
1297 ** pad_il(test_list, status, ch)
1299 ** Test (il) and (il1) Insert line
1303 struct test_list *t,
1308 const char *start_message;
1312 if (!parm_insert_line) {
1314 ptext("(il) Insert-lines not present. ");
1315 pad_done_message(t, state, ch);
1318 start_message = "(il) Insert-lines start testing";
1323 ptext("(il1) Insert-line not present. ");
1324 pad_done_message(t, state, ch);
1327 start_message = "(il1) Insert-line start testing";
1330 if (skip_pad_test(t, state, ch, start_message)) {
1333 pad_test_startup(1);
1335 sprintf(temp, "%d\r", test_complete);
1337 if (insert_line && repeats == 1) {
1338 tt_putp(insert_line);
1340 tt_putparm(parm_insert_line, repeats, repeats, 0);
1342 } while(still_testing());
1343 put_str("This line should be on the bottom.\r");
1344 if (insert_line && augment == 1) {
1345 for (i = 1; i < lines; i++) {
1346 tt_putp(insert_line);
1349 tt_putparm(parm_insert_line, lines - 1, lines - 1, 0);
1351 putln("The screen should have text on the bottom line.");
1352 sprintf(temp, "Insert %d line%s. ", augment,
1353 augment == 1 ? "" : "s");
1355 pad_test_shutdown(t, 0);
1356 pad_done_message(t, state, ch);
1361 ** pad_indn(test_list, status, ch)
1363 ** Test (indn) and (ind) Scroll forward
1367 struct test_list *t,
1372 const char *start_message;
1378 ptext("(indn) Scroll-forward-n-lines not present. ");
1379 pad_done_message(t, state, ch);
1382 start_message = "(indn) Scroll-forward-n-lines start testing";
1385 if (!scroll_forward) {
1387 ptext("(ind) Scroll-forward not present. ");
1388 pad_done_message(t, state, ch);
1392 ptext("(ind) Scroll-forward not tested on overstrike terminals. ");
1393 pad_done_message(t, state, ch);
1396 start_message = "(ind) Scroll-forward start testing";
1399 if (skip_pad_test(t, state, ch, start_message)) {
1402 pad_test_startup(1);
1403 /* go to the bottom of the screen */
1406 sprintf(temp, "%d\r", test_complete);
1408 if (scroll_forward && repeats == 1) {
1411 tt_putparm(parm_index, repeats, repeats, 0);
1413 } while(still_testing());
1414 put_str("This line should be on the top.\r");
1415 if (scroll_forward && augment == 1) {
1416 for (i = 1; i < lines; i++) {
1420 tt_putparm(parm_index, lines - 1, lines - 1, 0);
1423 sprintf(temp, "\nScroll forward %d line%s. ", augment,
1424 augment == 1 ? "" : "s");
1426 pad_test_shutdown(t, 0);
1427 pad_done_message(t, state, ch);
1431 ** pad_dl(test_list, status, ch)
1433 ** Test (dl) and (dl1) Delete lines
1437 struct test_list *t,
1442 const char *start_message;
1446 if (!parm_delete_line) {
1448 ptext("(dl) Delete-lines not present. ");
1449 pad_done_message(t, state, ch);
1452 start_message = "(dl) Delete-lines start testing";
1457 ptext("(dl1) Delete-line not present. ");
1458 pad_done_message(t, state, ch);
1461 start_message = "(dl1) Delete-line start testing";
1464 if (skip_pad_test(t, state, ch, start_message)) {
1467 pad_test_startup(1);
1469 sprintf(temp, "%d\r", test_complete);
1470 if (augment < lines - 1) {
1475 if (delete_line && repeats == 1) {
1476 tt_putp(delete_line);
1478 tt_putparm(parm_delete_line, repeats, repeats, 0);
1480 } while(still_testing());
1482 put_str("This line should be on the top.");
1484 if (delete_line && augment == 1) {
1485 for (i = 1; i < lines; i++) {
1486 tt_putp(delete_line);
1489 tt_putparm(parm_delete_line, lines - 1, lines - 1, 0);
1491 sprintf(temp, "\nDelete %d line%s. ", augment,
1492 augment == 1 ? "" : "s");
1494 pad_test_shutdown(t, 0);
1495 pad_done_message(t, state, ch);
1499 ** pad_xl(test_list, status, ch)
1501 ** Test (il1) Insert and (dl1) Delete lines
1505 struct test_list *t,
1509 if (!insert_line && !delete_line) {
1510 /* quietly skip this test */
1513 if (skip_pad_test(t, state, ch,
1514 "(il1) Insert-line, (dl1) Delete-line start testing")) {
1518 putln("\rThis text is written on the first line.");
1519 ptext("This sentence begins on the second line. As this");
1520 ptext(" test runs the bottom part of this paragraph will");
1521 ptext(" jump up and down. Don't worry, that's normal. When");
1522 ptext(" the jumping stops, the entire paragraph should");
1523 ptext(" still be on the screen and in the same place as when");
1524 ptext(" the test started. If this paragraph has scrolled");
1525 ptext(" off the top or bottom of the screen then the test");
1526 ptext(" has failed. Scrolling off the top of the screen");
1527 ptext(" usually means that the delete line capability is");
1528 ptext(" working better than the insert line capability. If");
1529 ptext(" the text scrolls off the bottom then delete line may");
1530 ptext(" be broken. If parts of the text are missing then");
1531 ptext(" you should get professional help.");
1535 pad_test_startup(0);
1537 tt_putp(insert_line);
1539 tt_putp(delete_line);
1540 } while(still_testing());
1541 pad_test_shutdown(t, 0);
1543 ptext("The top of the screen should have a paragraph of text. ");
1544 pad_done_message(t, state, ch);
1548 ** pad_scrc(test_list, status, ch)
1550 ** Test (sc) (rc) Save/restore cursor
1554 struct test_list *t,
1560 if (!save_cursor || !restore_cursor) {
1563 ptext("(rc) Restore-cursor");
1565 if (restore_cursor) {
1566 ptext("(sc) Save-cursor");
1568 ptext("(sc) Save-cursor, (rc) Restore-cursor");
1570 ptext(" not present. ");
1571 pad_done_message(t, state, ch);
1574 if (skip_pad_test(t, state, ch,
1575 "(sc) (rc) Save/Restore-cursor start testing")) {
1578 pad_test_startup(1);
1581 for (i = 1; i < columns; i++) {
1582 tt_putp(save_cursor);
1584 tt_putp(restore_cursor);
1587 } while(still_testing());
1588 pad_test_shutdown(t, 0);
1591 pad_done_message(t, state, ch);
1595 ** pad_csrind(test_list, status, ch)
1597 ** Test (csr) and (ind) Change scroll region and index.
1601 struct test_list *t,
1607 if (!change_scroll_region) {
1609 ptext("(csr) Change-scroll-region not present. ");
1610 pad_done_message(t, state, ch);
1613 if (skip_pad_test(t, state, ch,
1614 "(csr) Save/Restore-cursor, (ind) index start testing")) {
1620 if (augment > lines - 1) {
1621 augment = lines - 1;
1624 ptext("This text is on the top line.");
1625 tt_putparm(change_scroll_region, 1, lines - augment, lines - 1);
1626 /* go to the bottom of the screen */
1628 pad_test_startup(0);
1630 sprintf(temp, "%d\r", test_complete);
1633 } while(still_testing());
1634 ptextln("(csr) is broken.");
1635 for (i = augment; i > 1; i--) {
1638 pad_test_shutdown(t, 0);
1639 ptext("All but top and bottom lines should be blank. ");
1640 pad_done_message(t, state, ch);
1641 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1646 ** pad_sccsrrc(test_list, status, ch)
1648 ** Test (sc) (csr) and (rc) Save/Change/Restore scroll region
1652 struct test_list *t,
1658 if (!save_cursor || !change_scroll_region || !restore_cursor) {
1659 /* quietly ignore this test */
1662 if (skip_pad_test(t, state, ch,
1663 "(sc) (csr) (rc) Save/Change/Restore-cursor, start testing")) {
1666 pad_test_startup(1);
1669 for (i = 1; i < columns; i++) {
1670 tt_putp(save_cursor);
1672 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1673 tt_putp(restore_cursor);
1676 } while(still_testing());
1677 pad_test_shutdown(t, 0);
1680 pad_done_message(t, state, ch);
1681 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1685 ** pad_csr_nel(test_list, status, ch)
1687 ** Test (sc) (csr) (nel) and (rc) Save/Change/Restore scroll region
1691 struct test_list *t,
1697 if (!save_cursor || !change_scroll_region || !restore_cursor) {
1698 /* quietly ignore this test */
1701 if (skip_pad_test(t, state, ch,
1702 "(csr) Change-scroll-region, (nel) newline start testing")) {
1705 pad_test_startup(1);
1707 for (i = 0; i < lines; i++) {
1708 for (j = lines - i; j > 0; j--) {
1711 tt_putp(save_cursor);
1712 tt_putparm(change_scroll_region, 1, i, lines - 1);
1713 tt_putp(restore_cursor);
1714 put_str(every_line);
1716 tt_putp(save_cursor);
1717 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1718 tt_putp(restore_cursor);
1719 } while(still_testing());
1720 pad_test_shutdown(t, 0);
1722 pad_done_message(t, state, ch);
1723 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1727 ** pad_csr_cup(test_list, status, ch)
1729 ** Test (csr) (cup) Change scroll region and cursor address
1733 struct test_list *t,
1739 if (!change_scroll_region || !cursor_address) {
1740 /* quietly ignore this test */
1743 if (skip_pad_test(t, state, ch,
1744 "(csr) Change-scroll-region, (cup) cursor-address start testing")) {
1747 pad_test_startup(1);
1749 for (i = 0; i < lines; i++) {
1750 for (j = lines - i; j > 0; j--) {
1753 tt_putparm(change_scroll_region, 1, i, lines - 1);
1754 tt_putparm(cursor_address, 1, lines - 1, 0);
1755 put_str(every_line);
1757 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1758 tt_putparm(cursor_address, 1, lines - 1, (int) strlen(every_line));
1759 } while(still_testing());
1760 pad_test_shutdown(t, 0);
1762 pad_done_message(t, state, ch);
1763 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1767 ** pad_ht(test_list, status, ch)
1773 struct test_list *t,
1779 if (!set_tab && init_tabs <= 0) {
1781 ptext("(ht) Tab not tested. (hts) Set-tabs and (it) initial-tabs not present. ");
1782 pad_done_message(t, state, ch);
1785 if (skip_pad_test(t, state, ch, "(ht) Tab start testing")) {
1788 pad_test_startup(1);
1791 it is not always possible to test tabs with caps
1792 that do not already have padding. The following
1793 test uses a mixed bag of tests in order to avoid
1794 this problem. Note: I do not scroll
1796 if (auto_right_margin && can_go_home)
1797 for (i = 1, go_home(); i < lines - 2; i++) {
1798 for (j = 8; j < columns; j += 8) {
1803 if (cursor_down && can_go_home)
1804 for (i = 1, go_home(); i < lines - 2; i++) {
1805 for (j = 8; j < columns; j += 8) {
1809 tt_putp(cursor_down);
1812 for (i = 1; i < lines - 2; i++) {
1813 tt_putparm(cursor_address, 1, i - 1, 0);
1814 for (j = 8; j < columns; j += 8) {
1820 for (i = 1; i < lines - 2; i++) {
1821 for (j = 8; j < columns; j += 8) {
1826 } while(still_testing());
1827 pad_test_shutdown(t, 0);
1828 ptextln("Letters on the screen other than Ns at the right margin indicate failure.");
1829 ptext("A-(am) D-(cud1) C-(cup) N-(nel) ");
1830 pad_done_message(t, state, ch);
1834 ** pad_smso(test_list, status, ch)
1836 ** Test (smso) (rmso) Enter/exit mode
1840 struct test_list *t,
1846 if (!enter_standout_mode || !exit_standout_mode) {
1848 ptext("(smso) (rmso) Enter/Exit-standout-mode not present. ");
1849 pad_done_message(t, state, ch);
1852 if (skip_pad_test(t, state, ch,
1853 "(smso) (rmso) Enter/Exit-standout-mode start testing")) {
1857 In terminals that emulate non-hidden attributes with hidden
1858 attributes, the amount of time that it takes to fill the screen
1859 with an attribute is nontrivial. The following test is designed to
1862 pad_test_startup(1);
1865 j = magic_cookie_glitch > 0 ? magic_cookie_glitch : 0;
1866 for (i = 2 + j + j; i < columns;) {
1867 put_mode(enter_standout_mode);
1870 put_mode(exit_standout_mode);
1873 } while(still_testing());
1874 pad_test_shutdown(t, 0);
1877 pad_done_message(t, state, ch);
1878 put_mode(exit_standout_mode);
1882 ** pad_smacs(test_list, status, ch)
1884 ** Test (smacs) (rmacs) Enter/exit altcharset mode
1888 struct test_list *t,
1894 /* test enter even if exit is missing */
1895 if (!enter_alt_charset_mode) {
1897 ptext("(smacs) Enter-altcharset-mode not present. ");
1898 pad_done_message(t, state, ch);
1901 if (skip_pad_test(t, state, ch,
1902 "(smacs) (rmacs) Enter/Exit-altcharset-mode start testing")) {
1905 pad_test_startup(1);
1908 j = magic_cookie_glitch > 0 ? magic_cookie_glitch : 0;
1909 for (i = 2 + j + j; i < columns;) {
1910 put_mode(enter_alt_charset_mode);
1913 put_mode(exit_alt_charset_mode);
1916 } while(still_testing());
1917 pad_test_shutdown(t, 0);
1919 ptext("Every other character is from the alternate character set. ");
1920 pad_done_message(t, state, ch);
1921 put_mode(exit_alt_charset_mode);
1925 ** pad_crash(test_list, status, ch)
1927 ** Test (clear) without padding
1931 struct test_list *t,
1937 if (!clear_screen) {
1938 ptext("(clear) Clear-screen not present. ");
1939 pad_done_message(t, state, ch);
1942 ptext("If you would like to see if the terminal will really lock up.");
1943 ptextln(" I will send the clear screen sequence without the pads.");
1944 if (skip_pad_test(t, state, ch,
1945 "(clear) Clear-screen start crash testing")) {
1948 save_xon_xoff = xon_xoff;
1950 pad_test_startup(0);
1952 put_str("Erase this!");
1953 tt_putp(clear_screen);
1954 } while(still_testing());
1955 xon_xoff = save_xon_xoff;
1956 pad_test_shutdown(t, 1);
1957 pad_done_message(t, state, ch);