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., 59 Temple Place - Suite 330,
19 ** Boston, MA 02111-1307, USA.
24 MODULE_ID("$Id: pad.c,v 1.1 1998/01/10 00:30:27 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 *);
64 extern struct test_menu change_pad_menu;
67 Any command found in this list, executed from a "Done" prompt
68 will force the default action to repeat rather than next.
70 const char *pad_repeat_test = {"ep-+<>"};
72 struct test_list pad_test_list[] = {
73 {0, 0, 0, 0, "e) edit terminfo", 0, &edit_menu},
74 {0, 0, 0, 0, "p) change padding", 0, &change_pad_menu},
75 {0, 0, 0, 0, "@) display statistics about the last test", dump_test_stats, 0},
76 {0, 0, 0, 0, "c) clear screen", menu_clear_screen, 0},
77 {0, 0, 0, 0, "i) send reset and init", menu_reset_init, 0},
78 {0, 0, 0, 0, txt_longer_test_time, longer_test_time, 0},
79 {0, 0, 0, 0, txt_shorter_test_time, shorter_test_time, 0},
80 {0, 0, 0, 0, txt_longer_augment, longer_augment, 0},
81 {0, 0, 0, 0, txt_shorter_augment, shorter_augment, 0},
83 Phase 1: Test initialization and reset strings.
85 (rs1) (rs2) (rs3) (is1) (is2) (is3) are very difficult to test.
86 They have no defined output. To make matters worse, the cap
87 builder could partition (rs1) (rs2) (rs3) by length, leaving the
88 terminal in some unknown state between (rs1) and (rs2) or between
89 (r2) and (rs3). Some reset strings clear the screen when done.
91 We have no control over this. The only thing we can do for
92 certain is to test the pad times by checking for overruns.
94 {MENU_NEXT, 3, "rs1", 0, 0, pad_standard, 0},
95 {MENU_NEXT, 3, "rs2", 0, 0, pad_standard, 0},
96 {MENU_NEXT, 3, "rs3", 0, 0, pad_standard, 0},
97 {MENU_NEXT | MENU_INIT, 0, 0, 0, 0, init_xon_xoff, 0},
98 {MENU_NEXT, 3, "is1", 0, 0, pad_standard, 0},
99 {MENU_NEXT, 3, "is2", 0, 0, pad_standard, 0},
100 {MENU_NEXT, 3, "is3", 0, 0, pad_standard, 0},
101 {MENU_NEXT, 3, "rmxon", "smxon", 0, pad_rmxon, 0},
102 {MENU_NEXT | MENU_INIT, 0, 0, 0, 0, init_cup, 0},
104 Phase 2: Test home, screen clears and erases.
106 {MENU_NEXT, 0, "home", 0, 0, pad_home1, 0},
107 {MENU_NEXT, 0, "home) (nel", 0, 0, pad_home2, 0},
108 {MENU_NEXT | 1, 0, "clear", 0, 0, pad_clear, 0},
109 {MENU_NEXT | MENU_LM1, 0, "ed", 0, 0, pad_clear, 0},
110 {MENU_NEXT | MENU_80c, 0, "ech", 0, 0, pad_ech, 0},
111 {MENU_NEXT | MENU_80c, 0, "el1", "cub1 nel", 0, pad_el1, 0},
112 {MENU_NEXT | MENU_10c, 0, "el", "nel", 0, pad_el, 0},
114 Phase 3: Character deletions and insertions
116 {MENU_NEXT, 0, "smdc) (rmdc", 0, 0, pad_smdc, 0},
117 {MENU_NEXT | MENU_80c, 0, "dch", "smdc rmdc", 0, pad_dch, 0},
118 {MENU_NEXT | MENU_80c, 0, "dch1", "smdc rmdc", 0, pad_dch1, 0},
119 {MENU_NEXT, 0, "smir) (rmir", 0, 0, pad_smir, 0},
120 {MENU_NEXT | MENU_90c, 0, "ich) (ip", "smir rmir", 0, pad_ich, 0},
121 {MENU_NEXT | MENU_90c, 0, "ich1) (ip", "smir rmir", 0, pad_ich1, 0},
122 {MENU_NEXT, 4, "ich1) (dch1", "smir rmir", 0, pad_xch1, 0},
123 {MENU_NEXT | MENU_90c, 0, "rep", 0, 0, pad_rep, 0},
125 Phase 4: Test cursor addressing pads.
127 {MENU_NEXT, 0, "cup", 0, 0, pad_cup, 0},
129 Phase 5: Test scrolling and cursor save/restore.
131 {MENU_NEXT, 0, "hd", 0, 0, pad_hd, 0},
132 {MENU_NEXT, 0, "hu", 0, 0, pad_hu, 0},
133 {MENU_NEXT | MENU_LM1 | 1, 0, "rin", 0, 0, pad_rin, 0},
134 {MENU_NEXT, 0, "ri", 0, 0, pad_rin, 0},
135 {MENU_NEXT | MENU_LM1 | 1, 0, "il", 0, 0, pad_il, 0},
136 {MENU_NEXT, 0, "il1", 0, 0, pad_il, 0},
137 {MENU_NEXT | MENU_LM1 | 1, 0, "indn", 0, 0, pad_indn, 0},
138 {MENU_NEXT, 0, "ind", 0, 0, pad_indn, 0},
139 {MENU_NEXT | MENU_LM1 | 1, 0, "dl", 0, 0, pad_dl, 0},
140 {MENU_NEXT, 0, "dl1", 0, 0, pad_dl, 0},
141 {MENU_NEXT, 0, "il1) (dl1", 0, 0, pad_xl, 0},
142 {MENU_NEXT, 0, "sc) (rc", 0, 0, pad_scrc, 0},
143 {MENU_NEXT | MENU_50l, 0, "csr) (ind", 0, 0, pad_csrind, 0},
144 {MENU_NEXT, 0, "sc) (csr) (rc", 0, 0, pad_sccsrrc, 0},
145 {MENU_NEXT, 0, "csr) (nel", "sc rc", 0, pad_csr_nel, 0},
146 {MENU_NEXT, 0, "csr) (cup", 0, 0, pad_csr_cup, 0},
150 {MENU_NEXT, 0, "ht", 0, 0, pad_ht, 0},
152 Phase 7: Test character-set-switch pads.
154 {MENU_NEXT, 0, "smso) (rmso", 0, 0, pad_smso, 0},
155 {MENU_NEXT, 0, "smacs) (rmacs", 0, 0, pad_smacs, 0},
157 Phase 8: Tests for miscellaneous mode-switch pads.
159 {MENU_NEXT, 3, "flash", 0, 0, pad_standard, 0},
160 {MENU_NEXT, 3, "smkx", 0, 0, pad_standard, 0},
161 {MENU_NEXT, 3, "rmkx", 0, 0, pad_standard, 0},
162 {MENU_NEXT, 3, "smm", 0, 0, pad_standard, 0},
163 {MENU_NEXT, 3, "rmm", 0, 0, pad_standard, 0},
165 Phase 9: Test crash-and-burn properties of unpadded (clear).
167 {0, 0, "clear", "xon", "k) run clear test with no padding", pad_crash, 0},
168 {MENU_LAST, 0, 0, 0, 0, 0, 0}
171 extern int test_complete; /* counts number of tests completed */
174 int hzcc; /* horizontal character count */
175 char letter; /* current character being displayed */
176 int letter_number; /* points into letters[] */
177 int augment, repeats; /* number of characters (or lines) effected */
178 char letters[] = "AbCdefghiJklmNopQrStuVwXyZ";
180 static char every_line[] = "This text should be on every line.";
181 static char all_lines[] = "Each char on any line should be the same. ";
182 static char above_line[] = "The above lines should be all Xs. ";
183 static char no_visual[] = "This loop test has no visual failure indicator. ";
186 ** pad_standard(test_list, status, ch)
188 ** Run a single cap pad test.
196 const char *long_name;
201 if ((cap = get_string_cap_byname(t->caps_done, &long_name))) {
202 sprintf(tbuf, "(%s) %s, start testing", t->caps_done,
204 if (skip_pad_test(t, state, ch, tbuf)) {
218 } while(still_testing());
219 pad_test_shutdown(t, 0);
228 /* Note: get_string_cap_byname() always sets long_name */
229 sprintf(temp, "(%s) %s, not present. ", t->caps_done,
233 pad_done_message(t, state, ch);
237 ** init_xon_xoff(test_list, status, ch)
239 ** Initialize the xon_xoff values
243 struct test_list *t GCC_UNUSED,
244 int *state GCC_UNUSED,
247 /* the reset strings may dink with the XON/XOFF modes */
248 if (select_xon_xoff == 0 && exit_xon_mode) {
249 tc_putp(exit_xon_mode);
251 if (select_xon_xoff == 1 && enter_xon_mode) {
252 tc_putp(enter_xon_mode);
257 ** pad_rmxon(test_list, status, ch)
259 ** Test (rmxon) exit XON/XOFF mode
267 if (select_xon_xoff == 0 && exit_xon_mode) {
268 pad_standard(t, state, ch);
273 ** init_cup(test_list, status, ch)
275 ** Send the initialization strings for XON/XOFF and (smcup)
276 ** Stop pad testing if clear screen is missing.
284 init_xon_xoff(t, state, ch);
286 tc_putp(enter_ca_mode);
288 if (!can_clear_screen) {
289 ptext("(clear) clear screen not present,");
290 ptext(" pad processing terminated. ");
291 pad_done_message(t, state, ch);
292 if (*ch == 0 || *ch == 'n' || *ch == 's' || *ch == 'r') {
300 ** pad_home1(test_list, status, ch)
302 ** Test (home) when (am) is set.
312 if (can_go_home && auto_right_margin) {
314 truly brain damaged terminals will fail this test because
315 they cannot accept data at full rate
317 if (skip_pad_test(t, state, ch, "(home) Home start testing")) {
323 for (j = 1; j < lines; j++) {
324 for (k = 0; k < columns; k++) {
334 } while(still_testing());
335 pad_test_shutdown(t, 0);
336 ptext("All the dots should line up. ");
337 pad_done_message(t, state, ch);
343 ** pad_home2(test_list, status, ch)
345 ** Test (home) and (nel). (am) is reset.
356 if (skip_pad_test(t, state, ch,
357 "(home) Home, (nel) newline start testing")) {
363 for (j = 1; j < lines; j++) {
364 for (k = 2; k < columns; k++) {
371 put_crlf(); /* this does the (nel) */
375 } while(still_testing());
376 pad_test_shutdown(t, 0);
377 ptext("All the dots should line up. ");
378 pad_done_message(t, state, ch);
384 ** pad_clear(test_list, status, ch)
386 ** Test (clear) and (ed)
387 ** run the clear screen tests (also clear-to-end-of-screen)
401 const char *end_message = 0;
404 int clear_select; /* select the test number */
406 is_clear = t->flags & 1;
407 clear_select = auto_right_margin ? 0 : 1;
409 txt = "(clear) clear-screen start testing";
413 ptext("(ed) erase-to-end-of-display, not present. ");
414 pad_done_message(t, state, ch);
417 txt = "(ed) erase-to-end-of-display start testing";
419 if (skip_pad_test(t, state, ch, txt)) {
423 tc_putp(enter_am_mode);
426 for (; clear_select < 5; clear_select++) {
427 if (augment > lines || is_clear || !cursor_address) {
433 if (augment < lines) {
435 tt_putparm(cursor_address, 1,
436 lines - augment - 1, 0);
437 ptextln("This line should not be erased (ed)");
441 switch (clear_select) {
443 end_message = "Clear full screen. ";
446 end_message = "Clear sparse screen. ";
452 end_message = "Clear one character per line. ";
458 end_message = "Clear one full line. ";
461 end_message = "Clear single short line. ";
466 switch (clear_select) {
467 case 0: /* full screen test */
468 for (j = 1; j < repeats; j++) {
469 for (k = 0; k < columns; k++) {
479 case 1: /* sparse screen test */
480 for (j = columns - repeats; j > 2; j--) {
483 for (j = 2; j < repeats; j++) {
484 tt_putp(cursor_down);
488 case 2: /* short lines */
489 for (j = 2; j < repeats; j++) {
495 case 3: /* one full line */
496 for (j = columns - 5; j > 1; j--) {
500 case 4: /* one short line */
501 put_str("Erase this!");
507 if (augment == lines) {
510 tt_putparm(cursor_address, 1,
513 tt_tputs(clr_eos, repeats);
516 } while(still_testing());
517 pad_test_shutdown(t, 1);
520 pad_done_message(t, state, ch);
522 if (*ch != 0 && *ch != 'n') {
529 ** pad_ech(test_list, status, ch)
531 ** Test (ech) erase characters
543 ptext("(ech) Erase-characters, not present. ");
544 pad_done_message(t, state, ch);
547 if (skip_pad_test(t, state, ch,
548 "(ech) Erase-characters start testing")) {
551 if (augment > columns - 2) {
552 augment = columns - 2;
557 for (i = 2; i < lines; i++) {
558 for (j = 0; j <= repeats; j++) {
562 tt_putparm(erase_chars, repeats, repeats, 0);
566 for (i = 1; i <= repeats; i++) {
572 } while(still_testing());
573 pad_test_shutdown(t, 0);
575 pad_done_message(t, state, ch);
580 ** pad_el1(test_list, status, ch)
582 ** Test (el1) erase to start of line also (cub1) and (nel)
594 ptext("(el1) Erase-to-beginning-of-line, not present. ");
595 pad_done_message(t, state, ch);
598 if (skip_pad_test(t, state, ch,
599 "(el1) Erase-to-beginning-of-line start testing")) {
602 if (augment > columns - 2) {
603 augment = columns - 2;
608 for (i = 2; i < lines; i++) {
609 for (j = 0; j <= repeats; j++) {
612 tt_putp(cursor_left);
613 tt_putp(cursor_left);
614 tt_tputs(clr_bol, repeats);
618 for (i = 1; i <= repeats; i++) {
624 } while(still_testing());
625 pad_test_shutdown(t, 0);
627 pad_done_message(t, state, ch);
632 ** pad_el(test_list, status, ch)
634 ** Test (el) clear to end of line also (nel)
646 ptext("(el) Clear-to-end-of-line, not present. ");
647 pad_done_message(t, state, ch);
650 if (skip_pad_test(t, state, ch,
651 "(el) Clear-to-end-of-line start testing")) {
654 hzcc = columns * 8 / 10; /* horizontal character count */
655 if (augment > hzcc) {
661 for (i = 2; i < lines; i++) {
662 for (j = -1; j < augment; j++) {
674 } while(still_testing());
675 pad_test_shutdown(t, 0);
677 pad_done_message(t, state, ch);
682 ** pad_smdc(test_list, status, ch)
684 ** Test (smdc) (rmdc) Delete mode
694 if (!enter_delete_mode) {
696 ptext("(smdc) Enter-delete-mode");
697 if (!exit_delete_mode) {
698 ptext(", (rmdc) Exit-delete-mode");
700 ptext(", not present. ");
701 pad_done_message(t, state, ch);
704 if (skip_pad_test(t, state, ch,
705 "(smdc) (rmdc) Enter/Exit-delete-mode start testing")) {
711 for (i = 1; i < columns; i++) {
712 tt_putp(enter_delete_mode);
713 tt_putp(exit_delete_mode);
716 } while(still_testing());
717 pad_test_shutdown(t, 0);
720 pad_done_message(t, state, ch);
725 ** pad_dch(test_list, status, ch)
727 ** Test (smdc) (rmdc) Delete mode and (dch)
739 ptext("(dch) Delete-characters, not present. ");
740 pad_done_message(t, state, ch);
743 if (skip_pad_test(t, state, ch,
744 "(dch) Delete-characters start testing")) {
747 hzcc = columns * 8 / 10; /* horizontal character count */
748 if (augment > hzcc) {
754 for (i = 2; i < lines; i++) {
755 for (j = 0; j <= repeats; j++) {
759 tt_putp(enter_delete_mode);
760 tt_putparm(parm_dch, repeats, repeats, 0);
761 tt_putp(exit_delete_mode);
768 } while(still_testing());
769 pad_test_shutdown(t, 0);
772 pad_done_message(t, state, ch);
777 ** pad_dch1(test_list, status, ch)
779 ** Test (smdc) (rmdc) Delete mode and (dch1)
789 if (!delete_character) {
791 /* if the other one is defined then its OK */
795 ptext("(dch1) Delete-character, not present. ");
796 pad_done_message(t, state, ch);
799 if (skip_pad_test(t, state, ch,
800 "(dch1) Delete-character start testing")) {
803 hzcc = columns * 8 / 10; /* horizontal character count */
804 if (augment > hzcc) {
810 for (i = 2; i < lines; i++) {
811 for (j = -1; j < augment; j++) {
815 tt_putp(enter_delete_mode);
816 for (j = 0; j < augment; j++) {
817 tt_putp(delete_character);
819 tt_putp(exit_delete_mode);
826 } while(still_testing());
827 pad_test_shutdown(t, 0);
829 pad_done_message(t, state, ch);
834 ** pad_smir(test_list, status, ch)
836 ** Test (smir) (rmir) Insert mode
846 if (!enter_insert_mode) {
848 ptext("(smir) Enter-insert-mode");
849 if (!exit_insert_mode) {
850 ptext(", (rmir) Exit-insert-mode");
852 ptext(", not present. ");
853 pad_done_message(t, state, ch);
856 if (skip_pad_test(t, state, ch,
857 "(smir) (rmir) Enter/Exit-insert-mode start testing")) {
863 for (i = 1; i < columns; i++) {
864 tt_putp(enter_insert_mode);
865 tt_putp(exit_insert_mode);
868 } while(still_testing());
869 pad_test_shutdown(t, 0);
872 pad_done_message(t, state, ch);
877 ** pad_ich(test_list, status, ch)
879 ** Test (smir) (rmir) Insert mode and (ich) and (ip)
891 ptext("(ich) Insert-characters, not present. ");
892 pad_done_message(t, state, ch);
895 if (skip_pad_test(t, state, ch,
896 "(ich) Insert-characters, (ip) Insert-padding start testing")) {
899 j = columns * 9 / 10;
906 for (i = 2; i < lines; i++) {
909 tt_putp(enter_insert_mode);
911 tt_putparm(parm_ich, repeats, repeats, 0);
912 tt_putp(exit_insert_mode);
917 for (i = 0; i < repeats; i++) {
923 } while(still_testing());
924 pad_test_shutdown(t, 0);
926 pad_done_message(t, state, ch);
927 tc_putp(exit_insert_mode);
931 ** pad_ich1(test_list, status, ch)
933 ** Test (smir) (rmir) Insert mode and (ich1) and (ip)
943 if (!insert_character) {
945 ptext("(ich1) Insert-character, not present. ");
946 pad_done_message(t, state, ch);
949 if (skip_pad_test(t, state, ch,
950 "(ich1) Insert-character, (ip) Insert-padding start testing")) {
953 if (augment > columns - 2) {
954 augment = columns - 2;
959 for (i = 2; i < lines; i++) {
962 tt_putp(enter_insert_mode);
964 if (!insert_padding && !insert_character) {
965 /* only enter/exit is needed */
966 for (j = 0; j < augment; j++) {
970 for (j = 0; j < augment; j++) {
971 tt_putp(insert_character);
973 tt_putp(insert_padding);
976 tt_putp(exit_insert_mode);
981 for (j = 0; j < augment; j++) {
987 } while(still_testing());
988 pad_test_shutdown(t, 0);
990 pad_done_message(t, state, ch);
991 tc_putp(exit_insert_mode);
995 ** pad_xch1(test_list, status, ch)
997 ** Test (ich1) (ip) (dch1)
1001 struct test_list *t,
1005 static char xch1[] =
1006 "This line should not be garbled. It should be left justified.";
1008 if (enter_insert_mode || exit_insert_mode ||
1009 enter_delete_mode || exit_delete_mode ||
1010 !insert_character || !delete_character) {
1011 /* this test is quitely ignored */
1014 if (skip_pad_test(t, state, ch,
1015 "(ich1) Insert-character, (dch1) Delete-character start testing")) {
1021 pad_test_startup(0);
1023 tt_putp(insert_character);
1024 tt_putp(delete_character);
1025 } while(still_testing());
1026 pad_test_shutdown(t, 1);
1028 ptext("The preceeding two lines should be the same. ");
1029 pad_done_message(t, state, ch);
1033 ** pad_rep(test_list, status, ch)
1035 ** Test (rep) repeat character
1039 struct test_list *t,
1047 ptext("(rep) Repeat-character, not present. ");
1048 pad_done_message(t, state, ch);
1051 if (skip_pad_test(t, state, ch,
1052 "(rep) Repeat-character start testing")) {
1055 if (augment > columns - 2) {
1056 augment = columns - 2;
1061 pad_test_startup(1);
1064 for (i = 2; i < lines; i++) {
1065 tt_putparm(repeat_char, repeats, letter, repeats);
1068 for (j = 0; j < repeats; j++) {
1073 } while(still_testing());
1074 pad_test_shutdown(t, 0);
1076 pad_done_message(t, state, ch);
1080 ** pad_cup(test_list, status, ch)
1082 ** Test (cup) Cursor address
1086 struct test_list *t,
1092 if (!cursor_address) {
1094 ptext("(cup) Cursor-address not present. ");
1095 pad_done_message(t, state, ch);
1098 if (skip_pad_test(t, state, ch,
1099 "(cup) Cursor-address start testing")) {
1103 ptext("Each line should be filled with the same letter. There should");
1104 ptext(" be no gaps, or single letters scattered over the screen. ");
1105 if (char_count + 15 > columns) {
1108 if (((lines - line_count) & 1) == 0) {
1109 /* this removes the gap in the middle of the test when the
1110 number of lines is odd. */
1115 l = (columns - 4) >> 1;
1116 pad_test_startup(0);
1118 for (i = 1; i + i + r < lines; i++) {
1119 for (j = 0; j <= l; j++) {
1120 tt_putparm(cursor_address, 1, r + i, j);
1122 tt_putparm(cursor_address, 1, r + i, l + l + 1 - j);
1124 tt_putparm(cursor_address, 1, lines - i, j);
1126 tt_putparm(cursor_address, 1, lines - i, l + l + 1 - j);
1132 } while(still_testing());
1133 pad_test_shutdown(t, 0);
1134 tt_putparm(cursor_address, 1, line_count = r, char_count = c);
1135 pad_done_message(t, state, ch);
1140 ** pad_hd(test_list, status, ch)
1142 ** Test (hd) Half down
1146 struct test_list *t,
1152 if (!down_half_line) {
1154 ptext("(hd) Half-line-down not present. ");
1155 pad_done_message(t, state, ch);
1158 if (skip_pad_test(t, state, ch,
1159 "(hd) Half-line-down start testing")) {
1162 pad_test_startup(1);
1164 for (i = 1; i < columns; i += 2) {
1165 for (j = 1; j < i; ++j) {
1168 tt_putp(down_half_line);
1169 for (k = lines + lines; k > 4; k--) {
1170 if (j++ >= columns) {
1173 tt_putp(down_half_line);
1180 } while(still_testing());
1181 pad_test_shutdown(t, 0);
1182 pad_done_message(t, state, ch);
1187 ** pad_hu(test_list, status, ch)
1189 ** Test (hu) Half line up
1193 struct test_list *t,
1199 if (!up_half_line) {
1201 ptext("(hu) Half-line-up not present. ");
1202 pad_done_message(t, state, ch);
1205 if (skip_pad_test(t, state, ch,
1206 "(hu) Half-line-up start testing")) {
1209 pad_test_startup(1);
1211 for (i = 1; i < columns; i += 2) {
1213 for (j = 1; j < i; ++j) {
1216 tt_putp(up_half_line);
1217 for (k = lines + lines; k > 4; k--) {
1218 if (j++ >= columns) {
1221 tt_putp(up_half_line);
1228 } while(still_testing());
1229 pad_test_shutdown(t, 0);
1230 pad_done_message(t, state, ch);
1235 ** pad_rin(test_list, status, ch)
1237 ** Test (rin) and (ri) Reverse index
1241 struct test_list *t,
1246 const char *start_message;
1252 ptext("(rin) Scroll-reverse-n-lines not present. ");
1253 pad_done_message(t, state, ch);
1256 start_message = "(rin) Scroll-reverse-n-lines start testing";
1259 if (!scroll_reverse) {
1261 ptext("(ri) Scroll-reverse not present. ");
1262 pad_done_message(t, state, ch);
1265 start_message = "(ri) Scroll-reverse start testing";
1268 if (skip_pad_test(t, state, ch, start_message)) {
1271 pad_test_startup(1);
1273 sprintf(temp, "%d\r", test_complete);
1275 if (scroll_reverse && augment == 1) {
1276 tt_putp(scroll_reverse);
1278 tt_putparm(parm_rindex, repeats, repeats, 0);
1280 } while(still_testing());
1281 put_str("This line should be on the bottom.\r");
1282 if (scroll_reverse && augment == 1) {
1283 for (i = 1; i < lines; i++) {
1284 tt_putp(scroll_reverse);
1287 tt_putparm(parm_rindex, lines - 1, lines - 1, 0);
1289 putln("The screen should have text on the bottom line.");
1290 sprintf(temp, "Scroll reverse %d line%s. ", augment,
1291 augment == 1 ? "" : "s");
1293 pad_test_shutdown(t, 0);
1294 pad_done_message(t, state, ch);
1299 ** pad_il(test_list, status, ch)
1301 ** Test (il) and (il1) Insert line
1305 struct test_list *t,
1310 const char *start_message;
1314 if (!parm_insert_line) {
1316 ptext("(il) Insert-lines not present. ");
1317 pad_done_message(t, state, ch);
1320 start_message = "(il) Insert-lines start testing";
1325 ptext("(il1) Insert-line not present. ");
1326 pad_done_message(t, state, ch);
1329 start_message = "(il1) Insert-line start testing";
1332 if (skip_pad_test(t, state, ch, start_message)) {
1335 pad_test_startup(1);
1337 sprintf(temp, "%d\r", test_complete);
1339 if (insert_line && repeats == 1) {
1340 tt_putp(insert_line);
1342 tt_putparm(parm_insert_line, repeats, repeats, 0);
1344 } while(still_testing());
1345 put_str("This line should be on the bottom.\r");
1346 if (scroll_reverse && augment == 1) {
1347 for (i = 1; i < lines; i++) {
1348 tt_putp(insert_line);
1351 tt_putparm(parm_insert_line, lines - 1, lines - 1, 0);
1353 putln("The screen should have text on the bottom line.");
1354 sprintf(temp, "Insert %d line%s. ", augment,
1355 augment == 1 ? "" : "s");
1357 pad_test_shutdown(t, 0);
1358 pad_done_message(t, state, ch);
1363 ** pad_indn(test_list, status, ch)
1365 ** Test (indn) and (ind) Scroll forward
1369 struct test_list *t,
1374 const char *start_message;
1380 ptext("(indn) Scroll-forward-n-lines not present. ");
1381 pad_done_message(t, state, ch);
1384 start_message = "(indn) Scroll-forward-n-lines start testing";
1387 if (!scroll_forward && over_strike) {
1389 ptext("(ind) Scroll-forward not tested on overstrike terminals. ");
1390 pad_done_message(t, state, ch);
1393 start_message = "(ind) Scroll-forward start testing";
1396 if (skip_pad_test(t, state, ch, start_message)) {
1399 pad_test_startup(1);
1400 /* go to the bottom of the screen */
1403 sprintf(temp, "%d\r", test_complete);
1406 tt_putparm(parm_index, repeats, repeats, 0);
1410 } while(still_testing());
1411 put_str("This line should be on the top.\r");
1413 for (i = 1; i < lines; i++) {
1417 tt_putparm(parm_index, lines - 1, lines - 1, 0);
1420 sprintf(temp, "\nScroll forward %d line%s. ", augment,
1421 augment == 1 ? "" : "s");
1423 pad_test_shutdown(t, 0);
1424 pad_done_message(t, state, ch);
1428 ** pad_dl(test_list, status, ch)
1430 ** Test (dl) and (dl1) Delete lines
1434 struct test_list *t,
1439 const char *start_message;
1443 if (!parm_delete_line) {
1445 ptext("(dl) Delete-lines not present. ");
1446 pad_done_message(t, state, ch);
1449 start_message = "(dl) Delete-lines start testing";
1454 ptext("(dl1) Delete-line not present. ");
1455 pad_done_message(t, state, ch);
1458 start_message = "(dl1) Delete-line start testing";
1461 if (skip_pad_test(t, state, ch, start_message)) {
1464 pad_test_startup(1);
1466 sprintf(temp, "%d\r", test_complete);
1467 if ((i & 0x7f) == 0 && augment < lines - 1) {
1472 if (repeats || !delete_line) {
1473 tt_putparm(parm_delete_line, repeats, repeats, 0);
1475 tt_putp(delete_line);
1477 } while(still_testing());
1479 put_str("This line should be on the top.");
1481 if (repeats || !delete_line) {
1482 tt_putparm(parm_delete_line, lines - 1, lines - 1, 0);
1484 for (i = 1; i < lines; i++) {
1485 tt_putp(delete_line);
1488 sprintf(temp, "\nDelete %d line%s. ", augment,
1489 augment == 1 ? "" : "s");
1491 pad_test_shutdown(t, 0);
1492 pad_done_message(t, state, ch);
1496 ** pad_xl(test_list, status, ch)
1498 ** Test (il1) Insert and (dl1) Delete lines
1502 struct test_list *t,
1506 if (!insert_line && !delete_line) {
1507 /* quietly skip this test */
1510 if (skip_pad_test(t, state, ch,
1511 "(il1) Insert-line, (dl1) Delete-line start testing")) {
1515 putln("\rThis text is written on the first line.");
1516 ptext("This sentence begins on the second line. As this");
1517 ptext(" test runs the bottom part of this paragraph will");
1518 ptext(" jump up and down. Don't worry, that's normal. When");
1519 ptext(" the jumping stops, the entire paragraph should");
1520 ptext(" still be on the screen and in the same place as when");
1521 ptext(" the test started. If this paragraph has scrolled");
1522 ptext(" off the top or bottom of the screen then the test");
1523 ptext(" has failed. Scrolling off the top of the screen");
1524 ptext(" usually means that the delete line capability is");
1525 ptext(" working better than the insert line capability. If");
1526 ptext(" the text scrolls off the bottom then delete line may");
1527 ptext(" be broken. If parts of the text are missing then");
1528 ptext(" you should get professional help.");
1532 pad_test_startup(0);
1534 tt_putp(insert_line);
1536 tt_putp(delete_line);
1537 } while(still_testing());
1538 pad_test_shutdown(t, 0);
1540 ptext("The top of the screen should have a paragraph of text. ");
1541 pad_done_message(t, state, ch);
1545 ** pad_scrc(test_list, status, ch)
1547 ** Test (sc) (rc) Save/restore cursor
1551 struct test_list *t,
1557 if (!save_cursor || !restore_cursor) {
1560 ptext("(rc) Restore-cursor");
1562 if (restore_cursor) {
1563 ptext("(sc) Save-cursor");
1565 ptext("(sc) Save-cursor, (rc) Restore-cursor");
1567 ptext(" not present. ");
1568 pad_done_message(t, state, ch);
1571 if (skip_pad_test(t, state, ch,
1572 "(sc) (rc) Save/Restore-cursor start testing")) {
1575 pad_test_startup(1);
1578 for (i = 1; i < columns; i++) {
1579 tt_putp(save_cursor);
1581 tt_putp(restore_cursor);
1584 } while(still_testing());
1585 pad_test_shutdown(t, 0);
1588 pad_done_message(t, state, ch);
1592 ** pad_csrind(test_list, status, ch)
1594 ** Test (csr) and (ind) Change scroll region and index.
1598 struct test_list *t,
1604 if (!change_scroll_region) {
1606 ptext("(csr) Change-scroll-region not present. ");
1607 pad_done_message(t, state, ch);
1610 if (skip_pad_test(t, state, ch,
1611 "(csr) Save/Restore-cursor, (ind) index start testing")) {
1617 if (augment > lines - 1) {
1618 augment = lines - 1;
1621 ptext("This text is on the top line.");
1622 tt_putparm(change_scroll_region, 1, lines - augment, lines - 1);
1623 /* go to the bottom of the screen */
1625 pad_test_startup(0);
1627 sprintf(temp, "%d\r", test_complete);
1630 } while(still_testing());
1631 ptextln("(csr) is broken.");
1632 for (i = augment; i > 1; i--) {
1635 pad_test_shutdown(t, 0);
1636 ptext("All but top and bottom lines should be blank. ");
1637 pad_done_message(t, state, ch);
1638 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1643 ** pad_sccsrrc(test_list, status, ch)
1645 ** Test (sc) (csr) and (rc) Save/Change/Restore scroll region
1649 struct test_list *t,
1655 if (!save_cursor || !change_scroll_region || !restore_cursor) {
1656 /* quietly ignore this test */
1659 if (skip_pad_test(t, state, ch,
1660 "(sc) (csr) (rc) Save/Change/Restore-cursor, start testing")) {
1663 pad_test_startup(1);
1666 for (i = 1; i < columns; i++) {
1667 tt_putp(save_cursor);
1669 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1670 tt_putp(restore_cursor);
1673 } while(still_testing());
1674 pad_test_shutdown(t, 0);
1677 pad_done_message(t, state, ch);
1678 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1682 ** pad_csr_nel(test_list, status, ch)
1684 ** Test (sc) (csr) (nel) and (rc) Save/Change/Restore scroll region
1688 struct test_list *t,
1694 if (!save_cursor || !change_scroll_region || !restore_cursor) {
1695 /* quietly ignore this test */
1698 if (skip_pad_test(t, state, ch,
1699 "(csr) Change-scroll-region, (nel) newline start testing")) {
1702 pad_test_startup(1);
1704 for (i = 0; i < lines; i++) {
1705 for (j = lines - i; j > 0; j--) {
1708 tt_putp(save_cursor);
1709 tt_putparm(change_scroll_region, 1, i, lines - 1);
1710 tt_putp(restore_cursor);
1711 put_str(every_line);
1713 tt_putp(save_cursor);
1714 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1715 tt_putp(restore_cursor);
1716 } while(still_testing());
1717 pad_test_shutdown(t, 0);
1719 pad_done_message(t, state, ch);
1720 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1724 ** pad_csr_cup(test_list, status, ch)
1726 ** Test (csr) (cup) Change scroll region and cursor address
1730 struct test_list *t,
1736 if (!change_scroll_region || !cursor_address) {
1737 /* quietly ignore this test */
1740 if (skip_pad_test(t, state, ch,
1741 "(csr) Change-scroll-region, (cup) cursor-address start testing")) {
1744 pad_test_startup(1);
1746 for (i = 0; i < lines; i++) {
1747 for (j = lines - i; j > 0; j--) {
1750 tt_putparm(change_scroll_region, 1, i, lines - 1);
1751 tt_putparm(cursor_address, 1, lines - 1, 0);
1752 put_str(every_line);
1754 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1755 tt_putparm(cursor_address, 1, lines - 1, strlen(every_line));
1756 } while(still_testing());
1757 pad_test_shutdown(t, 0);
1759 pad_done_message(t, state, ch);
1760 tt_putparm(change_scroll_region, 1, 0, lines - 1);
1764 ** pad_ht(test_list, status, ch)
1770 struct test_list *t,
1776 if (!set_tab && init_tabs <= 0) {
1778 ptext("(ht) Tab not tested. (hts) Set-tabs and (it) initial-tabs not present. ");
1779 pad_done_message(t, state, ch);
1782 if (skip_pad_test(t, state, ch, "(ht) Tab start testing")) {
1785 pad_test_startup(1);
1788 it is not always possible to test tabs with caps
1789 that do not already have padding. The following
1790 test uses a mixed bag of tests in order to avoid
1791 this problem. Note: I do not scroll
1793 if (auto_right_margin && can_go_home)
1794 for (i = 1, go_home(); i < lines - 2; i++) {
1795 for (j = 8; j < columns; j += 8) {
1800 if (cursor_down && can_go_home)
1801 for (i = 1, go_home(); i < lines - 2; i++) {
1802 for (j = 8; j < columns; j += 8) {
1806 tt_putp(cursor_down);
1809 for (i = 1; i < lines - 2; i++) {
1810 tt_putparm(cursor_address, 1, i - 1, 0);
1811 for (j = 8; j < columns; j += 8) {
1817 for (i = 1; i < lines - 2; i++) {
1818 for (j = 8; j < columns; j += 8) {
1823 } while(still_testing());
1824 pad_test_shutdown(t, 0);
1825 ptextln("Letters on the screen other than Ns at the right margin indicate failure.");
1826 ptext("A-(am) D-(cud1) C-(cup) N-(nel) ");
1827 pad_done_message(t, state, ch);
1831 ** pad_smso(test_list, status, ch)
1833 ** Test (smso) (rmso) Enter/exit mode
1837 struct test_list *t,
1843 if (!enter_standout_mode || !exit_standout_mode) {
1845 ptext("(smso) (rmso) Enter/Exit-standout-mode not present. ");
1846 pad_done_message(t, state, ch);
1849 if (skip_pad_test(t, state, ch,
1850 "(smso) (rmso) Enter/Exit-standout-mode start testing")) {
1854 In terminals that emulate non-hidden attributes with hidden
1855 attributes, the amount of time that it takes to fill the screen
1856 with an attribute is nontrivial. The following test is designed to
1859 pad_test_startup(1);
1862 j = magic_cookie_glitch > 0 ? magic_cookie_glitch : 0;
1863 for (i = 2 + j + j; i < columns;) {
1864 put_mode(enter_standout_mode);
1867 put_mode(exit_standout_mode);
1870 } while(still_testing());
1871 pad_test_shutdown(t, 0);
1874 pad_done_message(t, state, ch);
1875 put_mode(exit_standout_mode);
1879 ** pad_smacs(test_list, status, ch)
1881 ** Test (smacs) (rmacs) Enter/exit altcharset mode
1885 struct test_list *t,
1891 /* test enter even if exit is missing */
1892 if (!enter_alt_charset_mode) {
1894 ptext("(smacs) Enter-altcharset-mode not present. ");
1895 pad_done_message(t, state, ch);
1898 if (skip_pad_test(t, state, ch,
1899 "(smacs) (rmacs) Enter/Exit-altcharset-mode start testing")) {
1902 pad_test_startup(1);
1905 j = magic_cookie_glitch > 0 ? magic_cookie_glitch : 0;
1906 for (i = 2 + j + j; i < columns;) {
1907 put_mode(enter_alt_charset_mode);
1910 put_mode(exit_alt_charset_mode);
1913 } while(still_testing());
1914 pad_test_shutdown(t, 0);
1916 ptext("Every other character is from the alternate character set. ");
1917 pad_done_message(t, state, ch);
1918 put_mode(exit_alt_charset_mode);
1922 ** pad_crash(test_list, status, ch)
1924 ** Test (clear) without padding
1928 struct test_list *t,
1934 if (!clear_screen) {
1935 ptext("(clear) Clear-screen not present. ");
1936 pad_done_message(t, state, ch);
1939 ptext("If you would like to see if the terminal will really lock up.");
1940 ptextln(" I will send the clear screen sequence without the pads.");
1941 if (skip_pad_test(t, state, ch,
1942 "(clear) Clear-screen start crash testing")) {
1945 save_xon_xoff = xon_xoff;
1947 pad_test_startup(0);
1949 put_str("Erase this!");
1950 tt_putp(clear_screen);
1951 } while(still_testing());
1952 xon_xoff = save_xon_xoff;
1953 pad_test_shutdown(t, 1);
1954 pad_done_message(t, state, ch);