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.3 2003/10/18 22:11:29 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. ";
453 end_message
= "Clear one character per line. ";
460 end_message
= "Clear one full line. ";
463 end_message
= "Clear single short line. ";
468 switch (clear_select
) {
469 case 0: /* full screen test */
470 for (j
= 1; j
< repeats
; j
++) {
471 for (k
= 0; k
< columns
; k
++) {
481 case 1: /* sparse screen test */
482 for (j
= columns
- repeats
; j
> 2; j
--) {
485 for (j
= 2; j
< repeats
; j
++) {
486 tt_putp(cursor_down
);
490 case 2: /* short lines */
491 for (j
= 2; j
< repeats
; j
++) {
497 case 3: /* one full line */
498 for (j
= columns
- 5; j
> 1; j
--) {
502 case 4: /* one short line */
503 put_str("Erase this!");
509 if (augment
== lines
) {
512 tt_putparm(cursor_address
, 1,
515 tt_tputs(clr_eos
, repeats
);
518 } while(still_testing());
519 pad_test_shutdown(t
, 1);
522 pad_done_message(t
, state
, ch
);
524 if (*ch
!= 0 && *ch
!= 'n') {
531 ** pad_ech(test_list, status, ch)
533 ** Test (ech) erase characters
545 ptext("(ech) Erase-characters, not present. ");
546 pad_done_message(t
, state
, ch
);
549 if (skip_pad_test(t
, state
, ch
,
550 "(ech) Erase-characters start testing")) {
553 if (augment
> columns
- 2) {
554 augment
= columns
- 2;
559 for (i
= 2; i
< lines
; i
++) {
560 for (j
= 0; j
<= repeats
; j
++) {
564 tt_putparm(erase_chars
, repeats
, repeats
, 0);
568 for (i
= 1; i
<= repeats
; i
++) {
574 } while(still_testing());
575 pad_test_shutdown(t
, 0);
577 pad_done_message(t
, state
, ch
);
582 ** pad_el1(test_list, status, ch)
584 ** Test (el1) erase to start of line also (cub1) and (nel)
596 ptext("(el1) Erase-to-beginning-of-line, not present. ");
597 pad_done_message(t
, state
, ch
);
600 if (skip_pad_test(t
, state
, ch
,
601 "(el1) Erase-to-beginning-of-line start testing")) {
604 if (augment
> columns
- 2) {
605 augment
= columns
- 2;
610 for (i
= 2; i
< lines
; i
++) {
611 for (j
= 0; j
<= repeats
; j
++) {
614 tt_putp(cursor_left
);
615 tt_putp(cursor_left
);
616 tt_tputs(clr_bol
, repeats
);
620 for (i
= 1; i
<= repeats
; i
++) {
626 } while(still_testing());
627 pad_test_shutdown(t
, 0);
629 pad_done_message(t
, state
, ch
);
634 ** pad_el(test_list, status, ch)
636 ** Test (el) clear to end of line also (nel)
648 ptext("(el) Clear-to-end-of-line, not present. ");
649 pad_done_message(t
, state
, ch
);
652 if (skip_pad_test(t
, state
, ch
,
653 "(el) Clear-to-end-of-line start testing")) {
656 hzcc
= columns
* 8 / 10; /* horizontal character count */
657 if (augment
> hzcc
) {
663 for (i
= 2; i
< lines
; i
++) {
664 for (j
= -1; j
< augment
; j
++) {
676 } while(still_testing());
677 pad_test_shutdown(t
, 0);
679 pad_done_message(t
, state
, ch
);
684 ** pad_smdc(test_list, status, ch)
686 ** Test (smdc) (rmdc) Delete mode
696 if (!enter_delete_mode
) {
698 ptext("(smdc) Enter-delete-mode");
699 if (!exit_delete_mode
) {
700 ptext(", (rmdc) Exit-delete-mode");
702 ptext(", not present. ");
703 pad_done_message(t
, state
, ch
);
706 if (skip_pad_test(t
, state
, ch
,
707 "(smdc) (rmdc) Enter/Exit-delete-mode start testing")) {
713 for (i
= 1; i
< columns
; i
++) {
714 tt_putp(enter_delete_mode
);
715 tt_putp(exit_delete_mode
);
718 } while(still_testing());
719 pad_test_shutdown(t
, 0);
722 pad_done_message(t
, state
, ch
);
727 ** pad_dch(test_list, status, ch)
729 ** Test (smdc) (rmdc) Delete mode and (dch)
741 ptext("(dch) Delete-characters, not present. ");
742 pad_done_message(t
, state
, ch
);
745 if (skip_pad_test(t
, state
, ch
,
746 "(dch) Delete-characters start testing")) {
749 hzcc
= columns
* 8 / 10; /* horizontal character count */
750 if (augment
> hzcc
) {
756 for (i
= 2; i
< lines
; i
++) {
757 for (j
= 0; j
<= repeats
; j
++) {
761 tt_putp(enter_delete_mode
);
762 tt_putparm(parm_dch
, repeats
, repeats
, 0);
763 tt_putp(exit_delete_mode
);
770 } while(still_testing());
771 pad_test_shutdown(t
, 0);
774 pad_done_message(t
, state
, ch
);
779 ** pad_dch1(test_list, status, ch)
781 ** Test (smdc) (rmdc) Delete mode and (dch1)
791 if (!delete_character
) {
793 /* if the other one is defined then its OK */
797 ptext("(dch1) Delete-character, not present. ");
798 pad_done_message(t
, state
, ch
);
801 if (skip_pad_test(t
, state
, ch
,
802 "(dch1) Delete-character start testing")) {
805 hzcc
= columns
* 8 / 10; /* horizontal character count */
806 if (augment
> hzcc
) {
812 for (i
= 2; i
< lines
; i
++) {
813 for (j
= -1; j
< augment
; j
++) {
817 tt_putp(enter_delete_mode
);
818 for (j
= 0; j
< augment
; j
++) {
819 tt_putp(delete_character
);
821 tt_putp(exit_delete_mode
);
828 } while(still_testing());
829 pad_test_shutdown(t
, 0);
831 pad_done_message(t
, state
, ch
);
836 ** pad_smir(test_list, status, ch)
838 ** Test (smir) (rmir) Insert mode
848 if (!enter_insert_mode
) {
850 ptext("(smir) Enter-insert-mode");
851 if (!exit_insert_mode
) {
852 ptext(", (rmir) Exit-insert-mode");
854 ptext(", not present. ");
855 pad_done_message(t
, state
, ch
);
858 if (skip_pad_test(t
, state
, ch
,
859 "(smir) (rmir) Enter/Exit-insert-mode start testing")) {
865 for (i
= 1; i
< columns
; i
++) {
866 tt_putp(enter_insert_mode
);
867 tt_putp(exit_insert_mode
);
870 } while(still_testing());
871 pad_test_shutdown(t
, 0);
874 pad_done_message(t
, state
, ch
);
879 ** pad_ich(test_list, status, ch)
881 ** Test (smir) (rmir) Insert mode and (ich) and (ip)
893 ptext("(ich) Insert-characters, not present. ");
894 pad_done_message(t
, state
, ch
);
897 if (skip_pad_test(t
, state
, ch
,
898 "(ich) Insert-characters, (ip) Insert-padding start testing")) {
901 j
= columns
* 9 / 10;
908 for (i
= 2; i
< lines
; i
++) {
911 tt_putp(enter_insert_mode
);
913 tt_putparm(parm_ich
, repeats
, repeats
, 0);
914 tt_putp(exit_insert_mode
);
919 for (i
= 0; i
< repeats
; i
++) {
925 } while(still_testing());
926 pad_test_shutdown(t
, 0);
928 pad_done_message(t
, state
, ch
);
929 tc_putp(exit_insert_mode
);
933 ** pad_ich1(test_list, status, ch)
935 ** Test (smir) (rmir) Insert mode and (ich1) and (ip)
945 if (!insert_character
) {
947 ptext("(ich1) Insert-character, not present. ");
948 pad_done_message(t
, state
, ch
);
951 if (skip_pad_test(t
, state
, ch
,
952 "(ich1) Insert-character, (ip) Insert-padding start testing")) {
955 if (augment
> columns
- 2) {
956 augment
= columns
- 2;
961 for (i
= 2; i
< lines
; i
++) {
964 tt_putp(enter_insert_mode
);
966 if (!insert_padding
&& !insert_character
) {
967 /* only enter/exit is needed */
968 for (j
= 0; j
< augment
; j
++) {
972 for (j
= 0; j
< augment
; j
++) {
973 tt_putp(insert_character
);
975 tt_putp(insert_padding
);
978 tt_putp(exit_insert_mode
);
983 for (j
= 0; j
< augment
; j
++) {
989 } while(still_testing());
990 pad_test_shutdown(t
, 0);
992 pad_done_message(t
, state
, ch
);
993 tc_putp(exit_insert_mode
);
997 ** pad_xch1(test_list, status, ch)
999 ** Test (ich1) (ip) (dch1)
1003 struct test_list
*t
,
1007 static char xch1
[] =
1008 "This line should not be garbled. It should be left justified.";
1010 if (enter_insert_mode
|| exit_insert_mode
||
1011 enter_delete_mode
|| exit_delete_mode
||
1012 !insert_character
|| !delete_character
) {
1013 /* this test is quietly ignored */
1016 if (skip_pad_test(t
, state
, ch
,
1017 "(ich1) Insert-character, (dch1) Delete-character start testing")) {
1023 pad_test_startup(0);
1025 tt_putp(insert_character
);
1026 tt_putp(delete_character
);
1027 } while(still_testing());
1028 pad_test_shutdown(t
, 1);
1030 ptext("The preceding two lines should be the same. ");
1031 pad_done_message(t
, state
, ch
);
1035 ** pad_rep(test_list, status, ch)
1037 ** Test (rep) repeat character
1041 struct test_list
*t
,
1049 ptext("(rep) Repeat-character, not present. ");
1050 pad_done_message(t
, state
, ch
);
1053 if (skip_pad_test(t
, state
, ch
,
1054 "(rep) Repeat-character start testing")) {
1057 if (augment
> columns
- 2) {
1058 augment
= columns
- 2;
1063 pad_test_startup(1);
1066 for (i
= 2; i
< lines
; i
++) {
1067 tt_putparm(repeat_char
, repeats
, letter
, repeats
);
1070 for (j
= 0; j
< repeats
; j
++) {
1075 } while(still_testing());
1076 pad_test_shutdown(t
, 0);
1078 pad_done_message(t
, state
, ch
);
1082 ** pad_cup(test_list, status, ch)
1084 ** Test (cup) Cursor address
1088 struct test_list
*t
,
1094 if (!cursor_address
) {
1096 ptext("(cup) Cursor-address not present. ");
1097 pad_done_message(t
, state
, ch
);
1100 if (skip_pad_test(t
, state
, ch
,
1101 "(cup) Cursor-address start testing")) {
1105 ptext("Each line should be filled with the same letter. There should");
1106 ptext(" be no gaps, or single letters scattered over the screen. ");
1107 if (char_count
+ 15 > columns
) {
1110 if (((lines
- line_count
) & 1) == 0) {
1111 /* this removes the gap in the middle of the test when the
1112 number of lines is odd. */
1117 l
= (columns
- 4) >> 1;
1118 pad_test_startup(0);
1120 for (i
= 1; i
+ i
+ r
< lines
; i
++) {
1121 for (j
= 0; j
<= l
; j
++) {
1122 tt_putparm(cursor_address
, 1, r
+ i
, j
);
1124 tt_putparm(cursor_address
, 1, r
+ i
, l
+ l
+ 1 - j
);
1126 tt_putparm(cursor_address
, 1, lines
- i
, j
);
1128 tt_putparm(cursor_address
, 1, lines
- i
, l
+ l
+ 1 - j
);
1134 } while(still_testing());
1135 pad_test_shutdown(t
, 0);
1136 tt_putparm(cursor_address
, 1, line_count
= r
, char_count
= c
);
1137 pad_done_message(t
, state
, ch
);
1142 ** pad_hd(test_list, status, ch)
1144 ** Test (hd) Half down
1148 struct test_list
*t
,
1154 if (!down_half_line
) {
1156 ptext("(hd) Half-line-down not present. ");
1157 pad_done_message(t
, state
, ch
);
1160 if (skip_pad_test(t
, state
, ch
,
1161 "(hd) Half-line-down start testing")) {
1164 pad_test_startup(1);
1166 for (i
= 1; i
< columns
; i
+= 2) {
1167 for (j
= 1; j
< i
; ++j
) {
1170 tt_putp(down_half_line
);
1171 for (k
= lines
+ lines
; k
> 4; k
--) {
1172 if (j
++ >= columns
) {
1175 tt_putp(down_half_line
);
1182 } while(still_testing());
1183 pad_test_shutdown(t
, 0);
1184 pad_done_message(t
, state
, ch
);
1189 ** pad_hu(test_list, status, ch)
1191 ** Test (hu) Half line up
1195 struct test_list
*t
,
1201 if (!up_half_line
) {
1203 ptext("(hu) Half-line-up not present. ");
1204 pad_done_message(t
, state
, ch
);
1207 if (skip_pad_test(t
, state
, ch
,
1208 "(hu) Half-line-up start testing")) {
1211 pad_test_startup(1);
1213 for (i
= 1; i
< columns
; i
+= 2) {
1215 for (j
= 1; j
< i
; ++j
) {
1218 tt_putp(up_half_line
);
1219 for (k
= lines
+ lines
; k
> 4; k
--) {
1220 if (j
++ >= columns
) {
1223 tt_putp(up_half_line
);
1230 } while(still_testing());
1231 pad_test_shutdown(t
, 0);
1232 pad_done_message(t
, state
, ch
);
1237 ** pad_rin(test_list, status, ch)
1239 ** Test (rin) and (ri) Reverse index
1243 struct test_list
*t
,
1248 const char *start_message
;
1254 ptext("(rin) Scroll-reverse-n-lines not present. ");
1255 pad_done_message(t
, state
, ch
);
1258 start_message
= "(rin) Scroll-reverse-n-lines start testing";
1261 if (!scroll_reverse
) {
1263 ptext("(ri) Scroll-reverse not present. ");
1264 pad_done_message(t
, state
, ch
);
1267 start_message
= "(ri) Scroll-reverse start testing";
1270 if (skip_pad_test(t
, state
, ch
, start_message
)) {
1273 pad_test_startup(1);
1275 sprintf(temp
, "%d\r", test_complete
);
1277 if (scroll_reverse
&& repeats
== 1) {
1278 tt_putp(scroll_reverse
);
1280 tt_putparm(parm_rindex
, repeats
, repeats
, 0);
1282 } while(still_testing());
1283 put_str("This line should be on the bottom.\r");
1284 if (scroll_reverse
&& augment
== 1) {
1285 for (i
= 1; i
< lines
; i
++) {
1286 tt_putp(scroll_reverse
);
1289 tt_putparm(parm_rindex
, lines
- 1, lines
- 1, 0);
1291 putln("The screen should have text on the bottom line.");
1292 sprintf(temp
, "Scroll reverse %d line%s. ", augment
,
1293 augment
== 1 ? "" : "s");
1295 pad_test_shutdown(t
, 0);
1296 pad_done_message(t
, state
, ch
);
1301 ** pad_il(test_list, status, ch)
1303 ** Test (il) and (il1) Insert line
1307 struct test_list
*t
,
1312 const char *start_message
;
1316 if (!parm_insert_line
) {
1318 ptext("(il) Insert-lines not present. ");
1319 pad_done_message(t
, state
, ch
);
1322 start_message
= "(il) Insert-lines start testing";
1327 ptext("(il1) Insert-line not present. ");
1328 pad_done_message(t
, state
, ch
);
1331 start_message
= "(il1) Insert-line start testing";
1334 if (skip_pad_test(t
, state
, ch
, start_message
)) {
1337 pad_test_startup(1);
1339 sprintf(temp
, "%d\r", test_complete
);
1341 if (insert_line
&& repeats
== 1) {
1342 tt_putp(insert_line
);
1344 tt_putparm(parm_insert_line
, repeats
, repeats
, 0);
1346 } while(still_testing());
1347 put_str("This line should be on the bottom.\r");
1348 if (insert_line
&& augment
== 1) {
1349 for (i
= 1; i
< lines
; i
++) {
1350 tt_putp(insert_line
);
1353 tt_putparm(parm_insert_line
, lines
- 1, lines
- 1, 0);
1355 putln("The screen should have text on the bottom line.");
1356 sprintf(temp
, "Insert %d line%s. ", augment
,
1357 augment
== 1 ? "" : "s");
1359 pad_test_shutdown(t
, 0);
1360 pad_done_message(t
, state
, ch
);
1365 ** pad_indn(test_list, status, ch)
1367 ** Test (indn) and (ind) Scroll forward
1371 struct test_list
*t
,
1376 const char *start_message
;
1382 ptext("(indn) Scroll-forward-n-lines not present. ");
1383 pad_done_message(t
, state
, ch
);
1386 start_message
= "(indn) Scroll-forward-n-lines start testing";
1389 if (!scroll_forward
) {
1391 ptext("(ind) Scroll-forward not present. ");
1392 pad_done_message(t
, state
, ch
);
1396 ptext("(ind) Scroll-forward not tested on overstrike terminals. ");
1397 pad_done_message(t
, state
, ch
);
1400 start_message
= "(ind) Scroll-forward start testing";
1403 if (skip_pad_test(t
, state
, ch
, start_message
)) {
1406 pad_test_startup(1);
1407 /* go to the bottom of the screen */
1410 sprintf(temp
, "%d\r", test_complete
);
1412 if (scroll_forward
&& repeats
== 1) {
1415 tt_putparm(parm_index
, repeats
, repeats
, 0);
1417 } while(still_testing());
1418 put_str("This line should be on the top.\r");
1419 if (scroll_forward
&& augment
== 1) {
1420 for (i
= 1; i
< lines
; i
++) {
1424 tt_putparm(parm_index
, lines
- 1, lines
- 1, 0);
1427 sprintf(temp
, "\nScroll forward %d line%s. ", augment
,
1428 augment
== 1 ? "" : "s");
1430 pad_test_shutdown(t
, 0);
1431 pad_done_message(t
, state
, ch
);
1435 ** pad_dl(test_list, status, ch)
1437 ** Test (dl) and (dl1) Delete lines
1441 struct test_list
*t
,
1446 const char *start_message
;
1450 if (!parm_delete_line
) {
1452 ptext("(dl) Delete-lines not present. ");
1453 pad_done_message(t
, state
, ch
);
1456 start_message
= "(dl) Delete-lines start testing";
1461 ptext("(dl1) Delete-line not present. ");
1462 pad_done_message(t
, state
, ch
);
1465 start_message
= "(dl1) Delete-line start testing";
1468 if (skip_pad_test(t
, state
, ch
, start_message
)) {
1471 pad_test_startup(1);
1473 sprintf(temp
, "%d\r", test_complete
);
1474 if (augment
< lines
- 1) {
1479 if (delete_line
&& repeats
== 1) {
1480 tt_putp(delete_line
);
1482 tt_putparm(parm_delete_line
, repeats
, repeats
, 0);
1484 } while(still_testing());
1486 put_str("This line should be on the top.");
1488 if (delete_line
&& augment
== 1) {
1489 for (i
= 1; i
< lines
; i
++) {
1490 tt_putp(delete_line
);
1493 tt_putparm(parm_delete_line
, lines
- 1, lines
- 1, 0);
1495 sprintf(temp
, "\nDelete %d line%s. ", augment
,
1496 augment
== 1 ? "" : "s");
1498 pad_test_shutdown(t
, 0);
1499 pad_done_message(t
, state
, ch
);
1503 ** pad_xl(test_list, status, ch)
1505 ** Test (il1) Insert and (dl1) Delete lines
1509 struct test_list
*t
,
1513 if (!insert_line
&& !delete_line
) {
1514 /* quietly skip this test */
1517 if (skip_pad_test(t
, state
, ch
,
1518 "(il1) Insert-line, (dl1) Delete-line start testing")) {
1522 putln("\rThis text is written on the first line.");
1523 ptext("This sentence begins on the second line. As this");
1524 ptext(" test runs the bottom part of this paragraph will");
1525 ptext(" jump up and down. Don't worry, that's normal. When");
1526 ptext(" the jumping stops, the entire paragraph should");
1527 ptext(" still be on the screen and in the same place as when");
1528 ptext(" the test started. If this paragraph has scrolled");
1529 ptext(" off the top or bottom of the screen then the test");
1530 ptext(" has failed. Scrolling off the top of the screen");
1531 ptext(" usually means that the delete line capability is");
1532 ptext(" working better than the insert line capability. If");
1533 ptext(" the text scrolls off the bottom then delete line may");
1534 ptext(" be broken. If parts of the text are missing then");
1535 ptext(" you should get professional help.");
1539 pad_test_startup(0);
1541 tt_putp(insert_line
);
1543 tt_putp(delete_line
);
1544 } while(still_testing());
1545 pad_test_shutdown(t
, 0);
1547 ptext("The top of the screen should have a paragraph of text. ");
1548 pad_done_message(t
, state
, ch
);
1552 ** pad_scrc(test_list, status, ch)
1554 ** Test (sc) (rc) Save/restore cursor
1558 struct test_list
*t
,
1564 if (!save_cursor
|| !restore_cursor
) {
1567 ptext("(rc) Restore-cursor");
1569 if (restore_cursor
) {
1570 ptext("(sc) Save-cursor");
1572 ptext("(sc) Save-cursor, (rc) Restore-cursor");
1574 ptext(" not present. ");
1575 pad_done_message(t
, state
, ch
);
1578 if (skip_pad_test(t
, state
, ch
,
1579 "(sc) (rc) Save/Restore-cursor start testing")) {
1582 pad_test_startup(1);
1585 for (i
= 1; i
< columns
; i
++) {
1586 tt_putp(save_cursor
);
1588 tt_putp(restore_cursor
);
1591 } while(still_testing());
1592 pad_test_shutdown(t
, 0);
1595 pad_done_message(t
, state
, ch
);
1599 ** pad_csrind(test_list, status, ch)
1601 ** Test (csr) and (ind) Change scroll region and index.
1605 struct test_list
*t
,
1611 if (!change_scroll_region
) {
1613 ptext("(csr) Change-scroll-region not present. ");
1614 pad_done_message(t
, state
, ch
);
1617 if (skip_pad_test(t
, state
, ch
,
1618 "(csr) Save/Restore-cursor, (ind) index start testing")) {
1624 if (augment
> lines
- 1) {
1625 augment
= lines
- 1;
1628 ptext("This text is on the top line.");
1629 tt_putparm(change_scroll_region
, 1, lines
- augment
, lines
- 1);
1630 /* go to the bottom of the screen */
1632 pad_test_startup(0);
1634 sprintf(temp
, "%d\r", test_complete
);
1637 } while(still_testing());
1638 ptextln("(csr) is broken.");
1639 for (i
= augment
; i
> 1; i
--) {
1642 pad_test_shutdown(t
, 0);
1643 ptext("All but top and bottom lines should be blank. ");
1644 pad_done_message(t
, state
, ch
);
1645 tt_putparm(change_scroll_region
, 1, 0, lines
- 1);
1650 ** pad_sccsrrc(test_list, status, ch)
1652 ** Test (sc) (csr) and (rc) Save/Change/Restore scroll region
1656 struct test_list
*t
,
1662 if (!save_cursor
|| !change_scroll_region
|| !restore_cursor
) {
1663 /* quietly ignore this test */
1666 if (skip_pad_test(t
, state
, ch
,
1667 "(sc) (csr) (rc) Save/Change/Restore-cursor, start testing")) {
1670 pad_test_startup(1);
1673 for (i
= 1; i
< columns
; i
++) {
1674 tt_putp(save_cursor
);
1676 tt_putparm(change_scroll_region
, 1, 0, lines
- 1);
1677 tt_putp(restore_cursor
);
1680 } while(still_testing());
1681 pad_test_shutdown(t
, 0);
1684 pad_done_message(t
, state
, ch
);
1685 tt_putparm(change_scroll_region
, 1, 0, lines
- 1);
1689 ** pad_csr_nel(test_list, status, ch)
1691 ** Test (sc) (csr) (nel) and (rc) Save/Change/Restore scroll region
1695 struct test_list
*t
,
1701 if (!save_cursor
|| !change_scroll_region
|| !restore_cursor
) {
1702 /* quietly ignore this test */
1705 if (skip_pad_test(t
, state
, ch
,
1706 "(csr) Change-scroll-region, (nel) newline start testing")) {
1709 pad_test_startup(1);
1711 for (i
= 0; i
< lines
; i
++) {
1712 for (j
= lines
- i
; j
> 0; j
--) {
1715 tt_putp(save_cursor
);
1716 tt_putparm(change_scroll_region
, 1, i
, lines
- 1);
1717 tt_putp(restore_cursor
);
1718 put_str(every_line
);
1720 tt_putp(save_cursor
);
1721 tt_putparm(change_scroll_region
, 1, 0, lines
- 1);
1722 tt_putp(restore_cursor
);
1723 } while(still_testing());
1724 pad_test_shutdown(t
, 0);
1726 pad_done_message(t
, state
, ch
);
1727 tt_putparm(change_scroll_region
, 1, 0, lines
- 1);
1731 ** pad_csr_cup(test_list, status, ch)
1733 ** Test (csr) (cup) Change scroll region and cursor address
1737 struct test_list
*t
,
1743 if (!change_scroll_region
|| !cursor_address
) {
1744 /* quietly ignore this test */
1747 if (skip_pad_test(t
, state
, ch
,
1748 "(csr) Change-scroll-region, (cup) cursor-address start testing")) {
1751 pad_test_startup(1);
1753 for (i
= 0; i
< lines
; i
++) {
1754 for (j
= lines
- i
; j
> 0; j
--) {
1757 tt_putparm(change_scroll_region
, 1, i
, lines
- 1);
1758 tt_putparm(cursor_address
, 1, lines
- 1, 0);
1759 put_str(every_line
);
1761 tt_putparm(change_scroll_region
, 1, 0, lines
- 1);
1762 tt_putparm(cursor_address
, 1, lines
- 1, strlen(every_line
));
1763 } while(still_testing());
1764 pad_test_shutdown(t
, 0);
1766 pad_done_message(t
, state
, ch
);
1767 tt_putparm(change_scroll_region
, 1, 0, lines
- 1);
1771 ** pad_ht(test_list, status, ch)
1777 struct test_list
*t
,
1783 if (!set_tab
&& init_tabs
<= 0) {
1785 ptext("(ht) Tab not tested. (hts) Set-tabs and (it) initial-tabs not present. ");
1786 pad_done_message(t
, state
, ch
);
1789 if (skip_pad_test(t
, state
, ch
, "(ht) Tab start testing")) {
1792 pad_test_startup(1);
1795 it is not always possible to test tabs with caps
1796 that do not already have padding. The following
1797 test uses a mixed bag of tests in order to avoid
1798 this problem. Note: I do not scroll
1800 if (auto_right_margin
&& can_go_home
)
1801 for (i
= 1, go_home(); i
< lines
- 2; i
++) {
1802 for (j
= 8; j
< columns
; j
+= 8) {
1807 if (cursor_down
&& can_go_home
)
1808 for (i
= 1, go_home(); i
< lines
- 2; i
++) {
1809 for (j
= 8; j
< columns
; j
+= 8) {
1813 tt_putp(cursor_down
);
1816 for (i
= 1; i
< lines
- 2; i
++) {
1817 tt_putparm(cursor_address
, 1, i
- 1, 0);
1818 for (j
= 8; j
< columns
; j
+= 8) {
1824 for (i
= 1; i
< lines
- 2; i
++) {
1825 for (j
= 8; j
< columns
; j
+= 8) {
1830 } while(still_testing());
1831 pad_test_shutdown(t
, 0);
1832 ptextln("Letters on the screen other than Ns at the right margin indicate failure.");
1833 ptext("A-(am) D-(cud1) C-(cup) N-(nel) ");
1834 pad_done_message(t
, state
, ch
);
1838 ** pad_smso(test_list, status, ch)
1840 ** Test (smso) (rmso) Enter/exit mode
1844 struct test_list
*t
,
1850 if (!enter_standout_mode
|| !exit_standout_mode
) {
1852 ptext("(smso) (rmso) Enter/Exit-standout-mode not present. ");
1853 pad_done_message(t
, state
, ch
);
1856 if (skip_pad_test(t
, state
, ch
,
1857 "(smso) (rmso) Enter/Exit-standout-mode start testing")) {
1861 In terminals that emulate non-hidden attributes with hidden
1862 attributes, the amount of time that it takes to fill the screen
1863 with an attribute is nontrivial. The following test is designed to
1866 pad_test_startup(1);
1869 j
= magic_cookie_glitch
> 0 ? magic_cookie_glitch
: 0;
1870 for (i
= 2 + j
+ j
; i
< columns
;) {
1871 put_mode(enter_standout_mode
);
1874 put_mode(exit_standout_mode
);
1877 } while(still_testing());
1878 pad_test_shutdown(t
, 0);
1881 pad_done_message(t
, state
, ch
);
1882 put_mode(exit_standout_mode
);
1886 ** pad_smacs(test_list, status, ch)
1888 ** Test (smacs) (rmacs) Enter/exit altcharset mode
1892 struct test_list
*t
,
1898 /* test enter even if exit is missing */
1899 if (!enter_alt_charset_mode
) {
1901 ptext("(smacs) Enter-altcharset-mode not present. ");
1902 pad_done_message(t
, state
, ch
);
1905 if (skip_pad_test(t
, state
, ch
,
1906 "(smacs) (rmacs) Enter/Exit-altcharset-mode start testing")) {
1909 pad_test_startup(1);
1912 j
= magic_cookie_glitch
> 0 ? magic_cookie_glitch
: 0;
1913 for (i
= 2 + j
+ j
; i
< columns
;) {
1914 put_mode(enter_alt_charset_mode
);
1917 put_mode(exit_alt_charset_mode
);
1920 } while(still_testing());
1921 pad_test_shutdown(t
, 0);
1923 ptext("Every other character is from the alternate character set. ");
1924 pad_done_message(t
, state
, ch
);
1925 put_mode(exit_alt_charset_mode
);
1929 ** pad_crash(test_list, status, ch)
1931 ** Test (clear) without padding
1935 struct test_list
*t
,
1941 if (!clear_screen
) {
1942 ptext("(clear) Clear-screen not present. ");
1943 pad_done_message(t
, state
, ch
);
1946 ptext("If you would like to see if the terminal will really lock up.");
1947 ptextln(" I will send the clear screen sequence without the pads.");
1948 if (skip_pad_test(t
, state
, ch
,
1949 "(clear) Clear-screen start crash testing")) {
1952 save_xon_xoff
= xon_xoff
;
1954 pad_test_startup(0);
1956 put_str("Erase this!");
1957 tt_putp(clear_screen
);
1958 } while(still_testing());
1959 xon_xoff
= save_xon_xoff
;
1960 pad_test_shutdown(t
, 1);
1961 pad_done_message(t
, state
, ch
);