| 1 | /*
|
|---|
| 2 | ** Copyright (C) 1991, 1997 Free Software Foundation, Inc.
|
|---|
| 3 | **
|
|---|
| 4 | ** This file is part of TACK.
|
|---|
| 5 | **
|
|---|
| 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)
|
|---|
| 9 | ** any later version.
|
|---|
| 10 | **
|
|---|
| 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.
|
|---|
| 15 | **
|
|---|
| 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
|
|---|
| 20 | */
|
|---|
| 21 |
|
|---|
| 22 | #include <tack.h>
|
|---|
| 23 |
|
|---|
| 24 | MODULE_ID("$Id: modes.c,v 1.2 2005/09/17 19:49:16 tom Exp $")
|
|---|
| 25 |
|
|---|
| 26 | /*
|
|---|
| 27 | * Tests boolean flags and terminal modes.
|
|---|
| 28 | */
|
|---|
| 29 | static void subtest_os(struct test_list *, int *, int *);
|
|---|
| 30 | static void subtest_rmam(struct test_list *, int *, int *);
|
|---|
| 31 | static void subtest_smam(struct test_list *, int *, int *);
|
|---|
| 32 | static void subtest_am(struct test_list *, int *, int *);
|
|---|
| 33 | static void subtest_ul(struct test_list *, int *, int *);
|
|---|
| 34 | static void subtest_uc(struct test_list *, int *, int *);
|
|---|
| 35 | static void subtest_bw(struct test_list *, int *, int *);
|
|---|
| 36 | static void subtest_xenl(struct test_list *, int *, int *);
|
|---|
| 37 | static void subtest_eo(struct test_list *, int *, int *);
|
|---|
| 38 | static void subtest_xmc(struct test_list *, int *, int *);
|
|---|
| 39 | static void subtest_xhp(struct test_list *, int *, int *);
|
|---|
| 40 | static void subtest_mir(struct test_list *, int *, int *);
|
|---|
| 41 | static void subtest_msgr(struct test_list *, int *, int *);
|
|---|
| 42 | static void subtest_tbc(struct test_list *, int *, int *);
|
|---|
| 43 | static void subtest_xt(struct test_list *, int *, int *);
|
|---|
| 44 | static void subtest_hts(struct test_list *, int *, int *);
|
|---|
| 45 | static void subtest_cbt(struct test_list *, int *, int *);
|
|---|
| 46 | static void subtest_in(struct test_list *, int *, int *);
|
|---|
| 47 | static void subtest_dadb(struct test_list *, int *, int *);
|
|---|
| 48 |
|
|---|
| 49 | struct test_list mode_test_list[] = {
|
|---|
| 50 | {0, 0, 0, 0, "e) edit terminfo", 0, &edit_menu},
|
|---|
| 51 | {MENU_NEXT, 3, "os", 0, 0, subtest_os, 0},
|
|---|
| 52 | {MENU_NEXT, 1, "rmam", 0, 0, subtest_rmam, 0},
|
|---|
| 53 | {MENU_NEXT, 1, "smam", 0, 0, subtest_smam, 0},
|
|---|
| 54 | {MENU_NEXT, 1, "am", 0, 0, subtest_am, 0},
|
|---|
| 55 | {MENU_NEXT, 3, "ul", 0, 0, subtest_ul, 0},
|
|---|
| 56 | {MENU_NEXT, 3, "uc", 0, 0, subtest_uc, 0},
|
|---|
| 57 | {MENU_NEXT, 3, "bw", 0, 0, subtest_bw, 0},
|
|---|
| 58 | {MENU_NEXT, 4, "xenl", 0, 0, subtest_xenl, 0},
|
|---|
| 59 | {MENU_NEXT, 3, "eo", 0, 0, subtest_eo, 0},
|
|---|
| 60 | {MENU_NEXT, 3, "xmc", 0, 0, subtest_xmc, 0},
|
|---|
| 61 | {MENU_NEXT, 3, "xhp", 0, 0, subtest_xhp, 0},
|
|---|
| 62 | {MENU_NEXT, 6, "mir", 0, 0, subtest_mir, 0},
|
|---|
| 63 | {MENU_NEXT, 6, "msgr", 0, 0, subtest_msgr, 0},
|
|---|
| 64 | {MENU_NEXT | MENU_CLEAR, 0, "tbc", "it", 0, subtest_tbc, 0},
|
|---|
| 65 | {MENU_NEXT | MENU_CLEAR, 0, "hts", "it", 0, subtest_hts, 0},
|
|---|
| 66 | {MENU_NEXT, 4, "xt", "it", 0, subtest_xt, 0},
|
|---|
| 67 | {MENU_NEXT, 1, "cbt", "it", 0, subtest_cbt, 0},
|
|---|
| 68 | {MENU_NEXT, 6, "in", 0, 0, subtest_in, 0},
|
|---|
| 69 | {MENU_NEXT, 1, "da) (db", 0, 0, subtest_dadb, 0},
|
|---|
| 70 | {MENU_LAST, 0, 0, 0, 0, 0, 0}
|
|---|
| 71 | };
|
|---|
| 72 |
|
|---|
| 73 | /*
|
|---|
| 74 | ** subtest_os(test_list, status, ch)
|
|---|
| 75 | **
|
|---|
| 76 | ** test over strike mode (os)
|
|---|
| 77 | */
|
|---|
| 78 | static void
|
|---|
| 79 | subtest_os(
|
|---|
| 80 | struct test_list *t,
|
|---|
| 81 | int *state,
|
|---|
| 82 | int *ch)
|
|---|
| 83 | {
|
|---|
| 84 | ptext("(os) should be true, not false.");
|
|---|
| 85 | put_cr();
|
|---|
| 86 | ptextln("(os) should be false.");
|
|---|
| 87 | sprintf(temp, "(os) over-strike is %s in the data base. ",
|
|---|
| 88 | over_strike ? "true" : "false");
|
|---|
| 89 | ptext(temp);
|
|---|
| 90 | generic_done_message(t, state, ch);
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | /*
|
|---|
| 94 | ** subtest_rmam(test_list, status, ch)
|
|---|
| 95 | **
|
|---|
| 96 | ** test exit automatic margins mode (rmam)
|
|---|
| 97 | */
|
|---|
| 98 | static void
|
|---|
| 99 | subtest_rmam(
|
|---|
| 100 | struct test_list *t,
|
|---|
| 101 | int *state,
|
|---|
| 102 | int *ch)
|
|---|
| 103 | {
|
|---|
| 104 | int j;
|
|---|
| 105 |
|
|---|
| 106 | if (!exit_am_mode) {
|
|---|
| 107 | ptext("(rmam) not present. ");
|
|---|
| 108 | } else
|
|---|
| 109 | if (!can_go_home) {
|
|---|
| 110 | ptext("(rmam) not tested, no way to home cursor. ");
|
|---|
| 111 | } else
|
|---|
| 112 | if (over_strike) {
|
|---|
| 113 | put_clear();
|
|---|
| 114 | go_home();
|
|---|
| 115 | tc_putp(exit_am_mode);
|
|---|
| 116 | ptext("\n(rmam) will reset (am)");
|
|---|
| 117 | go_home();
|
|---|
| 118 | for (j = 0; j < columns; j++)
|
|---|
| 119 | put_this(' ');
|
|---|
| 120 | ptext("(rmam) will not reset (am)");
|
|---|
| 121 | go_home();
|
|---|
| 122 | put_newlines(2);
|
|---|
| 123 | } else {
|
|---|
| 124 | put_clear();
|
|---|
| 125 | go_home();
|
|---|
| 126 | tc_putp(exit_am_mode);
|
|---|
| 127 | ptext("\n(rmam) will reset (am)");
|
|---|
| 128 | go_home();
|
|---|
| 129 | for (j = 0; j < columns; j++)
|
|---|
| 130 | put_this(' ');
|
|---|
| 131 | ptext("(rmam) will not reset (am) ");
|
|---|
| 132 | go_home();
|
|---|
| 133 | put_str(" ");
|
|---|
| 134 | go_home();
|
|---|
| 135 | put_newlines(2);
|
|---|
| 136 | }
|
|---|
| 137 | ptext("Exit-automatic-margins ");
|
|---|
| 138 | generic_done_message(t, state, ch);
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| 141 | /*
|
|---|
| 142 | ** subtest_smam(test_list, status, ch)
|
|---|
| 143 | **
|
|---|
| 144 | ** test enter automatic margins mode (smam)
|
|---|
| 145 | */
|
|---|
| 146 | static void
|
|---|
| 147 | subtest_smam(
|
|---|
| 148 | struct test_list *t,
|
|---|
| 149 | int *state,
|
|---|
| 150 | int *ch)
|
|---|
| 151 | {
|
|---|
| 152 | int i, j;
|
|---|
| 153 |
|
|---|
| 154 | if (!enter_am_mode) {
|
|---|
| 155 | ptext("(smam) not present. ");
|
|---|
| 156 | } else
|
|---|
| 157 | if (!can_go_home) {
|
|---|
| 158 | ptext("(smam) not tested, no way to home cursor. ");
|
|---|
| 159 | } else
|
|---|
| 160 | if (over_strike) {
|
|---|
| 161 | put_clear();
|
|---|
| 162 | go_home();
|
|---|
| 163 | tc_putp(enter_am_mode);
|
|---|
| 164 | ptext("\n(smam) will ");
|
|---|
| 165 | i = char_count;
|
|---|
| 166 | ptext("not set (am)");
|
|---|
| 167 | go_home();
|
|---|
| 168 | for (j = -i; j < columns; j++)
|
|---|
| 169 | put_this(' ');
|
|---|
| 170 | put_str("@@@");
|
|---|
| 171 | put_newlines(2);
|
|---|
| 172 | } else {
|
|---|
| 173 | put_clear();
|
|---|
| 174 | go_home();
|
|---|
| 175 | tc_putp(enter_am_mode);
|
|---|
| 176 | ptext("\n(smam) will not set (am)");
|
|---|
| 177 | go_home();
|
|---|
| 178 | for (j = 0; j < columns; j++)
|
|---|
| 179 | put_this(' ');
|
|---|
| 180 | ptext("(smam) will set (am) ");
|
|---|
| 181 | go_home();
|
|---|
| 182 | put_str(" ");
|
|---|
| 183 | put_newlines(2);
|
|---|
| 184 | }
|
|---|
| 185 | ptext("Enter-automatic-margins ");
|
|---|
| 186 | generic_done_message(t, state, ch);
|
|---|
| 187 | }
|
|---|
| 188 |
|
|---|
| 189 | /*
|
|---|
| 190 | ** subtest_am(test_list, status, ch)
|
|---|
| 191 | **
|
|---|
| 192 | ** test automatic margins (am)
|
|---|
| 193 | */
|
|---|
| 194 | static void
|
|---|
| 195 | subtest_am(
|
|---|
| 196 | struct test_list *t,
|
|---|
| 197 | int *state,
|
|---|
| 198 | int *ch)
|
|---|
| 199 | {
|
|---|
| 200 | int i, j;
|
|---|
| 201 |
|
|---|
| 202 | if (!can_go_home) {
|
|---|
| 203 | ptextln("(am) not tested, no way to home cursor. ");
|
|---|
| 204 | } else
|
|---|
| 205 | if (over_strike) {
|
|---|
| 206 | put_clear();
|
|---|
| 207 | go_home();
|
|---|
| 208 | ptext("\n(am) should ");
|
|---|
| 209 | i = char_count;
|
|---|
| 210 | ptext("not be set");
|
|---|
| 211 | go_home();
|
|---|
| 212 | for (j = -i; j < columns; j++)
|
|---|
| 213 | put_this(' ');
|
|---|
| 214 | put_str("@@@");
|
|---|
| 215 | go_home();
|
|---|
| 216 | put_newlines(2);
|
|---|
| 217 | sprintf(temp, "(am) is %s in the data base",
|
|---|
| 218 | auto_right_margin ? "true" : "false");
|
|---|
| 219 | ptextln(temp);
|
|---|
| 220 | } else {
|
|---|
| 221 | put_clear();
|
|---|
| 222 | go_home();
|
|---|
| 223 | ptext("\n(am) should not be set");
|
|---|
| 224 | go_home();
|
|---|
| 225 | for (j = 0; j < columns; j++)
|
|---|
| 226 | put_this(' ');
|
|---|
| 227 | ptext("(am) should be set ");
|
|---|
| 228 | go_home();
|
|---|
| 229 | put_str(" \n\n");
|
|---|
| 230 | sprintf(temp, "(am) is %s in the data base",
|
|---|
| 231 | auto_right_margin ? "true" : "false");
|
|---|
| 232 | ptextln(temp);
|
|---|
| 233 | }
|
|---|
| 234 | ptext("Automatic-right-margin ");
|
|---|
| 235 | generic_done_message(t, state, ch);
|
|---|
| 236 | }
|
|---|
| 237 |
|
|---|
| 238 | /* Note: uprint() sends underscore back-space character, and
|
|---|
| 239 | ucprint() sends character back-space underscore. */
|
|---|
| 240 |
|
|---|
| 241 | /*
|
|---|
| 242 | ** uprint(string)
|
|---|
| 243 | **
|
|---|
| 244 | ** underline string for (ul) test
|
|---|
| 245 | */
|
|---|
| 246 | static void
|
|---|
| 247 | uprint(const char *s)
|
|---|
| 248 | {
|
|---|
| 249 | if (s) {
|
|---|
| 250 | while (*s) {
|
|---|
| 251 | put_str("_\b");
|
|---|
| 252 | putchp(*s++);
|
|---|
| 253 | }
|
|---|
| 254 | }
|
|---|
| 255 | }
|
|---|
| 256 |
|
|---|
| 257 | /*
|
|---|
| 258 | ** ucprint(string)
|
|---|
| 259 | **
|
|---|
| 260 | ** underline string for (uc) test
|
|---|
| 261 | */
|
|---|
| 262 | static void
|
|---|
| 263 | ucprint(const char *s)
|
|---|
| 264 | {
|
|---|
| 265 | if (s) {
|
|---|
| 266 | while (*s) {
|
|---|
| 267 | putchp(*s++);
|
|---|
| 268 | putchp('\b');
|
|---|
| 269 | tc_putp(underline_char);
|
|---|
| 270 | }
|
|---|
| 271 | }
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| 274 | /*
|
|---|
| 275 | ** subtest_ul(test_list, status, ch)
|
|---|
| 276 | **
|
|---|
| 277 | ** test transparent underline (ul)
|
|---|
| 278 | */
|
|---|
| 279 | static void
|
|---|
| 280 | subtest_ul(
|
|---|
| 281 | struct test_list *t,
|
|---|
| 282 | int *state,
|
|---|
| 283 | int *ch)
|
|---|
| 284 | {
|
|---|
| 285 | if (!over_strike) {
|
|---|
| 286 | /* (ul) is used only if (os) is reset */
|
|---|
| 287 | put_crlf();
|
|---|
| 288 | sprintf(temp, "This text should %sbe underlined.",
|
|---|
| 289 | transparent_underline ? "" : "not ");
|
|---|
| 290 | uprint(temp);
|
|---|
| 291 | put_crlf();
|
|---|
| 292 | ptextln("If the above line is not underlined the (ul) should be false.");
|
|---|
| 293 | sprintf(temp, "(ul) Transparent-underline is %s in the data base",
|
|---|
| 294 | transparent_underline ? "true" : "false");
|
|---|
| 295 | ptextln(temp);
|
|---|
| 296 | generic_done_message(t, state, ch);
|
|---|
| 297 | }
|
|---|
| 298 | }
|
|---|
| 299 |
|
|---|
| 300 | /*
|
|---|
| 301 | ** subtest_uc(test_list, status, ch)
|
|---|
| 302 | **
|
|---|
| 303 | ** test underline character (uc)
|
|---|
| 304 | */
|
|---|
| 305 | static void
|
|---|
| 306 | subtest_uc(
|
|---|
| 307 | struct test_list *t,
|
|---|
| 308 | int *state,
|
|---|
| 309 | int *ch)
|
|---|
| 310 | {
|
|---|
| 311 | if (!over_strike) {
|
|---|
| 312 | if (underline_char) {
|
|---|
| 313 | ucprint("This text should be underlined.");
|
|---|
| 314 | put_crlf();
|
|---|
| 315 | ptextln("If the above text is not underlined the (uc) has failed.");
|
|---|
| 316 | ptext("Underline-character ");
|
|---|
| 317 | } else {
|
|---|
| 318 | ptext("(uc) underline-character is not defined. ");
|
|---|
| 319 | }
|
|---|
| 320 | generic_done_message(t, state, ch);
|
|---|
| 321 | }
|
|---|
| 322 | }
|
|---|
| 323 |
|
|---|
| 324 | /*
|
|---|
| 325 | ** subtest_bw(test_list, status, ch)
|
|---|
| 326 | **
|
|---|
| 327 | ** test auto left margin (bw)
|
|---|
| 328 | */
|
|---|
| 329 | static void
|
|---|
| 330 | subtest_bw(
|
|---|
| 331 | struct test_list *t,
|
|---|
| 332 | int *state,
|
|---|
| 333 | int *ch)
|
|---|
| 334 | {
|
|---|
| 335 | int i, j;
|
|---|
| 336 |
|
|---|
| 337 | if (over_strike) {
|
|---|
| 338 | /* test (bw) */
|
|---|
| 339 | ptext("\n(bw) should ");
|
|---|
| 340 | i = char_count;
|
|---|
| 341 | ptextln("not be set.");
|
|---|
| 342 | for (j = i; j < columns; j++)
|
|---|
| 343 | put_str("\b");
|
|---|
| 344 | put_str("@@@");
|
|---|
| 345 | put_crlf();
|
|---|
| 346 | sprintf(temp, "(bw) Auto-left-margin is %s in the data base",
|
|---|
| 347 | auto_left_margin ? "true" : "false");
|
|---|
| 348 | ptextln(temp);
|
|---|
| 349 | } else {
|
|---|
| 350 | /* test (bw) */
|
|---|
| 351 | ptextln("(bw) should not be set.");
|
|---|
| 352 | for (i = 12; i < columns; i++)
|
|---|
| 353 | put_str("\b");
|
|---|
| 354 | if (delete_character) {
|
|---|
| 355 | for (i = 0; i < 4; i++)
|
|---|
| 356 | tc_putp(delete_character);
|
|---|
| 357 | } else {
|
|---|
| 358 | put_str(" ");
|
|---|
| 359 | }
|
|---|
| 360 | put_crlf();
|
|---|
| 361 | sprintf(temp, "(bw) Auto-left-margin is %s in the data base",
|
|---|
| 362 | auto_left_margin ? "true" : "false");
|
|---|
| 363 | ptextln(temp);
|
|---|
| 364 | }
|
|---|
| 365 | generic_done_message(t, state, ch);
|
|---|
| 366 | }
|
|---|
| 367 |
|
|---|
| 368 | /*
|
|---|
| 369 | ** subtest_tbc(test_list, status, ch)
|
|---|
| 370 | **
|
|---|
| 371 | ** test clear tabs (tbc)
|
|---|
| 372 | */
|
|---|
| 373 | static void
|
|---|
| 374 | subtest_tbc(
|
|---|
| 375 | struct test_list *t,
|
|---|
| 376 | int *state,
|
|---|
| 377 | int *ch)
|
|---|
| 378 | {
|
|---|
| 379 | int tabat; /* the tab spacing we end up with */
|
|---|
| 380 | int i;
|
|---|
| 381 |
|
|---|
| 382 | if (clear_all_tabs && !set_tab) {
|
|---|
| 383 | ptext("(tbc) Clear-all-tabs is defined but (hts) set-tab is not. ");
|
|---|
| 384 | ptext("Once the tabs are cleared there is no way to set them. ");
|
|---|
| 385 | } else
|
|---|
| 386 | if (clear_all_tabs) {
|
|---|
| 387 | tabat = set_tab ? 8 : init_tabs;
|
|---|
| 388 | tc_putp(clear_all_tabs);
|
|---|
| 389 | ptext("Clear tabs (tbc)");
|
|---|
| 390 | go_home();
|
|---|
| 391 | put_crlf();
|
|---|
| 392 | putchp('\t');
|
|---|
| 393 | putchp('T');
|
|---|
| 394 | go_home();
|
|---|
| 395 | put_newlines(2);
|
|---|
| 396 | for (i = 0; i < columns; i++) {
|
|---|
| 397 | if (i == tabat) {
|
|---|
| 398 | putchp('T');
|
|---|
| 399 | } else {
|
|---|
| 400 | putchp('.');
|
|---|
| 401 | }
|
|---|
| 402 | }
|
|---|
| 403 | go_home();
|
|---|
| 404 | ptext("\n\n\nIf the above two lines have T's in the same column then (tbc) has failed. ");
|
|---|
| 405 | } else {
|
|---|
| 406 | ptext("(tbc) Clear-all-tabs is not defined. ");
|
|---|
| 407 | }
|
|---|
| 408 | generic_done_message(t, state, ch);
|
|---|
| 409 | }
|
|---|
| 410 |
|
|---|
| 411 | /*
|
|---|
| 412 | ** subtest_hts(test_list, status, ch)
|
|---|
| 413 | **
|
|---|
| 414 | ** (ht) and set tabs with (hts)
|
|---|
| 415 | */
|
|---|
| 416 | static void
|
|---|
| 417 | subtest_hts(
|
|---|
| 418 | struct test_list *t,
|
|---|
| 419 | int *state,
|
|---|
| 420 | int *ch)
|
|---|
| 421 | {
|
|---|
| 422 | int tabat; /* the tab spacing we end up with */
|
|---|
| 423 | int i;
|
|---|
| 424 |
|
|---|
| 425 | tabat = init_tabs;
|
|---|
| 426 | if (set_tab) {
|
|---|
| 427 | ptext("Tabs set with (hts)");
|
|---|
| 428 | put_crlf();
|
|---|
| 429 | for (i = 1; i < columns; i++) {
|
|---|
| 430 | if (i % 8 == 1) {
|
|---|
| 431 | tc_putp(set_tab);
|
|---|
| 432 | }
|
|---|
| 433 | putchp(' ');
|
|---|
| 434 | }
|
|---|
| 435 | tabat = 8;
|
|---|
| 436 | } else {
|
|---|
| 437 | sprintf(temp, "(hts) Set-tabs not defined. (it) Initial-tabs at %d", init_tabs);
|
|---|
| 438 | ptext(temp);
|
|---|
| 439 | }
|
|---|
| 440 | go_home();
|
|---|
| 441 | put_newlines(2);
|
|---|
| 442 | if (tabat <= 0) {
|
|---|
| 443 | tabat = 8;
|
|---|
| 444 | }
|
|---|
| 445 | for (i = tabat; i < columns; i += tabat) {
|
|---|
| 446 | putchp('\t');
|
|---|
| 447 | putchp('T');
|
|---|
| 448 | }
|
|---|
| 449 | go_home();
|
|---|
| 450 | put_newlines(3);
|
|---|
| 451 | for (i = 1; i < columns; i++) {
|
|---|
| 452 | putchp('.');
|
|---|
| 453 | }
|
|---|
| 454 | go_home();
|
|---|
| 455 | put_newlines(3);
|
|---|
| 456 | for (i = tabat; i < columns; i += tabat) {
|
|---|
| 457 | putchp('\t');
|
|---|
| 458 | putchp('T');
|
|---|
| 459 | }
|
|---|
| 460 | go_home();
|
|---|
| 461 | put_newlines(4);
|
|---|
| 462 | putchp('.');
|
|---|
| 463 | for (i = 2; i < columns; i++) {
|
|---|
| 464 | if (i % tabat == 1) {
|
|---|
| 465 | putchp('T');
|
|---|
| 466 | } else {
|
|---|
| 467 | putchp('.');
|
|---|
| 468 | }
|
|---|
| 469 | }
|
|---|
| 470 | go_home();
|
|---|
| 471 | put_newlines(5);
|
|---|
| 472 | if (set_tab) {
|
|---|
| 473 | ptextln("If the last two lines are not the same then (hts) has failed.");
|
|---|
| 474 | } else
|
|---|
| 475 | if (init_tabs > 0) {
|
|---|
| 476 | ptextln("If the last two lines are not the same then (it) is wrong.");
|
|---|
| 477 | } else {
|
|---|
| 478 | ptextln("If the last two lines are the same then maybe you do have tabs and (it) should be changed.");
|
|---|
| 479 | }
|
|---|
| 480 | generic_done_message(t, state, ch);
|
|---|
| 481 | }
|
|---|
| 482 |
|
|---|
| 483 | /*
|
|---|
| 484 | ** subtest_xt(test_list, status, ch)
|
|---|
| 485 | **
|
|---|
| 486 | ** (xt) glitch
|
|---|
| 487 | */
|
|---|
| 488 | static void
|
|---|
| 489 | subtest_xt(
|
|---|
| 490 | struct test_list *t,
|
|---|
| 491 | int *state,
|
|---|
| 492 | int *ch)
|
|---|
| 493 | {
|
|---|
| 494 | int tabat; /* the tab spacing we end up with */
|
|---|
| 495 | int cc;
|
|---|
| 496 |
|
|---|
| 497 | tabat = set_tab ? 8 : init_tabs;
|
|---|
| 498 | if (!over_strike && (tabat > 0)) {
|
|---|
| 499 | ptext("(xt) should not ");
|
|---|
| 500 | put_cr();
|
|---|
| 501 | ptext("(xt) should");
|
|---|
| 502 | cc = char_count;
|
|---|
| 503 | while (cc < 16) {
|
|---|
| 504 | putchp('\t');
|
|---|
| 505 | cc = ((cc / tabat) + 1) * tabat;
|
|---|
| 506 | }
|
|---|
| 507 | putln("be set.");
|
|---|
| 508 | sprintf(temp, "(xt) Destructive-tab is %s in the data base.",
|
|---|
| 509 | dest_tabs_magic_smso ? "true" : "false");
|
|---|
| 510 | ptextln(temp);
|
|---|
| 511 | generic_done_message(t, state, ch);
|
|---|
| 512 | }
|
|---|
| 513 | }
|
|---|
| 514 |
|
|---|
| 515 | /*
|
|---|
| 516 | ** subtest_cbt(test_list, status, ch)
|
|---|
| 517 | **
|
|---|
| 518 | ** (cbt) back tab
|
|---|
| 519 | */
|
|---|
| 520 | static void
|
|---|
| 521 | subtest_cbt(
|
|---|
| 522 | struct test_list *t,
|
|---|
| 523 | int *state,
|
|---|
| 524 | int *ch)
|
|---|
| 525 | {
|
|---|
| 526 | int i;
|
|---|
| 527 |
|
|---|
| 528 | if (back_tab) {
|
|---|
| 529 | put_clear();
|
|---|
| 530 | ptext("Back-tab (cbt)");
|
|---|
| 531 | go_home();
|
|---|
| 532 | put_crlf();
|
|---|
| 533 | for (i = 1; i < columns; i++) {
|
|---|
| 534 | putchp(' ');
|
|---|
| 535 | }
|
|---|
| 536 | for (i = 0; i < columns; i += 8) {
|
|---|
| 537 | tc_putp(back_tab);
|
|---|
| 538 | putchp('T');
|
|---|
| 539 | tc_putp(back_tab);
|
|---|
| 540 | }
|
|---|
| 541 | go_home();
|
|---|
| 542 | put_newlines(2);
|
|---|
| 543 | for (i = 1; i < columns; i++) {
|
|---|
| 544 | if (i % 8 == 1) {
|
|---|
| 545 | putchp('T');
|
|---|
| 546 | } else {
|
|---|
| 547 | putchp(' ');
|
|---|
| 548 | }
|
|---|
| 549 | }
|
|---|
| 550 | go_home();
|
|---|
| 551 | put_newlines(3);
|
|---|
| 552 | ptextln("The preceding two lines should be the same.");
|
|---|
| 553 | } else {
|
|---|
| 554 | ptextln("(cbt) Back-tab not present");
|
|---|
| 555 | }
|
|---|
| 556 | generic_done_message(t, state, ch);
|
|---|
| 557 | }
|
|---|
| 558 |
|
|---|
| 559 | /*
|
|---|
| 560 | ** subtest_xenl(test_list, status, ch)
|
|---|
| 561 | **
|
|---|
| 562 | ** (xenl) eat newline glitch
|
|---|
| 563 | */
|
|---|
| 564 | static void
|
|---|
| 565 | subtest_xenl(
|
|---|
| 566 | struct test_list *t,
|
|---|
| 567 | int *state,
|
|---|
| 568 | int *ch)
|
|---|
| 569 | {
|
|---|
| 570 | int i, j, k;
|
|---|
| 571 |
|
|---|
| 572 | if (over_strike) {
|
|---|
| 573 | /* test (xenl) on overstrike terminals */
|
|---|
| 574 | if (!can_go_home || !can_clear_screen) {
|
|---|
| 575 | ptextln("(xenl) Newline-glitch not tested, can't home cursor and clear.");
|
|---|
| 576 | generic_done_message(t, state, ch);
|
|---|
| 577 | return;
|
|---|
| 578 | }
|
|---|
| 579 | put_clear();
|
|---|
| 580 | /*
|
|---|
| 581 | this test must be done in raw mode. Otherwise UNIX will
|
|---|
| 582 | translate CR to CRLF.
|
|---|
| 583 | */
|
|---|
| 584 | if (stty_query(TTY_OUT_TRANS))
|
|---|
| 585 | tty_raw(1, char_mask);
|
|---|
| 586 | ptext("\nreset (xenl). Does ");
|
|---|
| 587 | i = char_count;
|
|---|
| 588 | put_str("not ignore CR, does ");
|
|---|
| 589 | k = char_count;
|
|---|
| 590 | put_str("not ignore LF");
|
|---|
| 591 | go_home();
|
|---|
| 592 | for (j = 0; j < columns; j++)
|
|---|
| 593 | put_this(' ');
|
|---|
| 594 | put_cr();
|
|---|
| 595 | for (j = 0; j < i; j++)
|
|---|
| 596 | putchp(' ');
|
|---|
| 597 | put_str("@@@\n@@");
|
|---|
| 598 | go_home();
|
|---|
| 599 | for (j = 0; j < columns; j++)
|
|---|
| 600 | put_this(' ');
|
|---|
| 601 | put_lf();
|
|---|
| 602 | for (j = 0; j < k; j++)
|
|---|
| 603 | putchp(' ');
|
|---|
| 604 | put_str("@@@\r@@");
|
|---|
| 605 | tty_set();
|
|---|
| 606 | go_home();
|
|---|
| 607 | put_newlines(4);
|
|---|
| 608 | sprintf(temp, "(xenl) Newline-glitch is %s in the data base",
|
|---|
| 609 | eat_newline_glitch ? "true" : "false");
|
|---|
| 610 | ptextln(temp);
|
|---|
| 611 | } else {
|
|---|
| 612 | /* test (xenl) when (os) is reset */
|
|---|
| 613 | if (!can_go_home) {
|
|---|
| 614 | ptextln("(xenl) Newline-glitch not tested, can't home cursor");
|
|---|
| 615 | generic_done_message(t, state, ch);
|
|---|
| 616 | return;
|
|---|
| 617 | }
|
|---|
| 618 | /* (xenl) test */
|
|---|
| 619 | put_clear();
|
|---|
| 620 | /*
|
|---|
| 621 | this test must be done in raw mode. Otherwise
|
|---|
| 622 | UNIX will translate CR to CRLF.
|
|---|
| 623 | */
|
|---|
| 624 | if (stty_query(TTY_OUT_TRANS))
|
|---|
| 625 | tty_raw(1, char_mask);
|
|---|
| 626 | for (j = 0; j < columns; j++)
|
|---|
| 627 | put_this(' ');
|
|---|
| 628 | put_cr();
|
|---|
| 629 | ptext("(xenl) should be set. Does not ignore CR");
|
|---|
| 630 | go_home();
|
|---|
| 631 | put_crlf();
|
|---|
| 632 | for (j = 0; j < columns; j++)
|
|---|
| 633 | put_this(' ');
|
|---|
| 634 | put_lf(); /* test (cud1) */
|
|---|
| 635 | ptext("(xenl) should be set. Ignores (cud1)");
|
|---|
| 636 | go_home();
|
|---|
| 637 | put_newlines(3);
|
|---|
| 638 | if (scroll_forward && cursor_down &&
|
|---|
| 639 | strcmp(scroll_forward, cursor_down)) {
|
|---|
| 640 | for (j = 0; j < columns; j++)
|
|---|
| 641 | put_this(' ');
|
|---|
| 642 | put_ind(); /* test (ind) */
|
|---|
| 643 | ptext("(xenl) should be set. Ignores (ind)");
|
|---|
| 644 | go_home();
|
|---|
| 645 | put_newlines(5);
|
|---|
| 646 | }
|
|---|
| 647 | tty_set();
|
|---|
| 648 | ptextln("If you don't see text above telling you to set it, (xenl) should be false");
|
|---|
| 649 | sprintf(temp, "(xenl) Newline-glitch is %s in the data base",
|
|---|
| 650 | eat_newline_glitch ? "true" : "false");
|
|---|
| 651 | ptextln(temp);
|
|---|
| 652 | }
|
|---|
| 653 | generic_done_message(t, state, ch);
|
|---|
| 654 | }
|
|---|
| 655 |
|
|---|
| 656 | /*
|
|---|
| 657 | ** subtest_eo(test_list, status, ch)
|
|---|
| 658 | **
|
|---|
| 659 | ** (eo) erase overstrike
|
|---|
| 660 | */
|
|---|
| 661 | static void
|
|---|
| 662 | subtest_eo(
|
|---|
| 663 | struct test_list *t,
|
|---|
| 664 | int *state,
|
|---|
| 665 | int *ch)
|
|---|
| 666 | {
|
|---|
| 667 | if (transparent_underline || over_strike || underline_char) {
|
|---|
| 668 | ptext("(eo) should ");
|
|---|
| 669 | if (underline_char) {
|
|---|
| 670 | ucprint("not");
|
|---|
| 671 | } else {
|
|---|
| 672 | uprint("not");
|
|---|
| 673 | }
|
|---|
| 674 | put_cr();
|
|---|
| 675 | ptextln("(eo) should be set");
|
|---|
| 676 | sprintf(temp, "\n(eo) Erase-overstrike is %s in the data base",
|
|---|
| 677 | erase_overstrike ? "true" : "false");
|
|---|
| 678 | ptextln(temp);
|
|---|
| 679 | generic_done_message(t, state, ch);
|
|---|
| 680 | }
|
|---|
| 681 | }
|
|---|
| 682 |
|
|---|
| 683 | /*
|
|---|
| 684 | ** subtest_xmc(test_list, status, ch)
|
|---|
| 685 | **
|
|---|
| 686 | ** (xmc) magic cookie glitch
|
|---|
| 687 | */
|
|---|
| 688 | static void
|
|---|
| 689 | subtest_xmc(
|
|---|
| 690 | struct test_list *t,
|
|---|
| 691 | int *state,
|
|---|
| 692 | int *ch)
|
|---|
| 693 | {
|
|---|
| 694 | int i, j;
|
|---|
| 695 |
|
|---|
| 696 | if (enter_standout_mode) {
|
|---|
| 697 | sprintf(temp, "\n(xmc) Magic-cookie-glitch is %d in the data base", magic_cookie_glitch);
|
|---|
| 698 | ptextln(temp);
|
|---|
| 699 | j = magic_cookie_glitch * 8;
|
|---|
| 700 | for (i = 0; i < j; i++) {
|
|---|
| 701 | put_str(" ");
|
|---|
| 702 | }
|
|---|
| 703 | ptextln(" These two lines should line up.");
|
|---|
| 704 | if (j > 0) {
|
|---|
| 705 | char_count += j;
|
|---|
| 706 | }
|
|---|
| 707 | for (i = 0; i < 4; i++) {
|
|---|
| 708 | put_mode(enter_standout_mode);
|
|---|
| 709 | putchp(' ');
|
|---|
| 710 | put_mode(exit_standout_mode);
|
|---|
| 711 | putchp(' ');
|
|---|
| 712 | }
|
|---|
| 713 | ptextln("These two lines should line up.");
|
|---|
| 714 | ptext("If they don't line up then (xmc) magic-cookie-glitch should be greater than zero. ");
|
|---|
| 715 | generic_done_message(t, state, ch);
|
|---|
| 716 | }
|
|---|
| 717 | }
|
|---|
| 718 |
|
|---|
| 719 | /*
|
|---|
| 720 | ** subtest_xhp(test_list, status, ch)
|
|---|
| 721 | **
|
|---|
| 722 | ** (xhp) erase does not clear standout mode
|
|---|
| 723 | */
|
|---|
| 724 | static void
|
|---|
| 725 | subtest_xhp(
|
|---|
| 726 | struct test_list *t,
|
|---|
| 727 | int *state,
|
|---|
| 728 | int *ch)
|
|---|
| 729 | {
|
|---|
| 730 | if (enter_standout_mode) {
|
|---|
| 731 | put_crlf();
|
|---|
| 732 | put_mode(enter_standout_mode);
|
|---|
| 733 | put_str("Stand out");
|
|---|
| 734 | put_mode(exit_standout_mode);
|
|---|
| 735 | put_cr();
|
|---|
| 736 | ptextln("If any part of this line is standout then (xhp) should be set.");
|
|---|
| 737 | sprintf(temp, "(xhp) Erase-standout-glitch is %s in the data base",
|
|---|
| 738 | ceol_standout_glitch ? "true" : "false");
|
|---|
| 739 | ptextln(temp);
|
|---|
| 740 | generic_done_message(t, state, ch);
|
|---|
| 741 | }
|
|---|
| 742 | }
|
|---|
| 743 |
|
|---|
| 744 | /*
|
|---|
| 745 | ** subtest_mir(test_list, status, ch)
|
|---|
| 746 | **
|
|---|
| 747 | ** (mir) move in insert mode
|
|---|
| 748 | */
|
|---|
| 749 | static void
|
|---|
| 750 | subtest_mir(
|
|---|
| 751 | struct test_list *t,
|
|---|
| 752 | int *state,
|
|---|
| 753 | int *ch)
|
|---|
| 754 | {
|
|---|
| 755 | int i;
|
|---|
| 756 | char *s;
|
|---|
| 757 |
|
|---|
| 758 | if (enter_insert_mode && exit_insert_mode && cursor_address) {
|
|---|
| 759 | put_clear();
|
|---|
| 760 | i = line_count;
|
|---|
| 761 | put_str("\nXXX\nXXX\nXXX\nXXX");
|
|---|
| 762 | tc_putp(enter_insert_mode);
|
|---|
| 763 | s = tparm(cursor_address, i + 1, 0);
|
|---|
| 764 | tputs(s, lines, tc_putch);
|
|---|
| 765 | putchp('X');
|
|---|
| 766 | s = tparm(cursor_address, i + 2, 1);
|
|---|
| 767 | tputs(s, lines, tc_putch);
|
|---|
| 768 | putchp('X');
|
|---|
| 769 | s = tparm(cursor_address, i + 3, 2);
|
|---|
| 770 | tputs(s, lines, tc_putch);
|
|---|
| 771 | putchp('X');
|
|---|
| 772 | s = tparm(cursor_address, i + 4, 3);
|
|---|
| 773 | tputs(s, lines, tc_putch);
|
|---|
| 774 | putchp('X');
|
|---|
| 775 | tc_putp(exit_insert_mode);
|
|---|
| 776 | put_newlines(2);
|
|---|
| 777 | ptextln("If you see a 4 by 4 block of X's then (mir) should be true.");
|
|---|
| 778 | sprintf(temp, "(mir) Move-in-insert-mode is %s in the data base",
|
|---|
| 779 | move_insert_mode ? "true" : "false");
|
|---|
| 780 | ptextln(temp);
|
|---|
| 781 | } else {
|
|---|
| 782 | ptext("(mir) Move-in-insert-mode not tested, ");
|
|---|
| 783 | if (!enter_insert_mode) {
|
|---|
| 784 | ptext("(smir) ");
|
|---|
| 785 | }
|
|---|
| 786 | if (!exit_insert_mode) {
|
|---|
| 787 | ptext("(rmir) ");
|
|---|
| 788 | }
|
|---|
| 789 | if (!cursor_address) {
|
|---|
| 790 | ptext("(cup) ");
|
|---|
| 791 | }
|
|---|
| 792 | ptext("not present. ");
|
|---|
| 793 | }
|
|---|
| 794 | generic_done_message(t, state, ch);
|
|---|
| 795 | }
|
|---|
| 796 |
|
|---|
| 797 | /*
|
|---|
| 798 | ** subtest_msgr(test_list, status, ch)
|
|---|
| 799 | **
|
|---|
| 800 | ** (msgr) move in sgr mode
|
|---|
| 801 | */
|
|---|
| 802 | static void
|
|---|
| 803 | subtest_msgr(
|
|---|
| 804 | struct test_list *t,
|
|---|
| 805 | int *state,
|
|---|
| 806 | int *ch)
|
|---|
| 807 | {
|
|---|
| 808 | int i;
|
|---|
| 809 |
|
|---|
| 810 | if (cursor_address &&
|
|---|
| 811 | ((enter_standout_mode && exit_standout_mode) ||
|
|---|
| 812 | (enter_alt_charset_mode && exit_alt_charset_mode))) {
|
|---|
| 813 | put_crlf();
|
|---|
| 814 | i = line_count + 1;
|
|---|
| 815 | tputs(tparm(cursor_address, i, 0), lines, tc_putch);
|
|---|
| 816 | put_mode(enter_alt_charset_mode);
|
|---|
| 817 | put_crlf();
|
|---|
| 818 | /*
|
|---|
| 819 | some versions of the wy-120 can not clear lines or
|
|---|
| 820 | screen when in alt charset mode. If (el) and (ed)
|
|---|
| 821 | are defined then I can test them. If they are not
|
|---|
| 822 | defined then they can not break (msgr)
|
|---|
| 823 | */
|
|---|
| 824 | tc_putp(clr_eos);
|
|---|
| 825 | tc_putp(clr_eol);
|
|---|
| 826 | put_mode(exit_alt_charset_mode);
|
|---|
| 827 | put_mode(enter_standout_mode);
|
|---|
| 828 | putchp('X');
|
|---|
| 829 | tputs(tparm(cursor_address, i + 2, 1), lines, tc_putch);
|
|---|
| 830 | putchp('X');
|
|---|
| 831 | tputs(tparm(cursor_address, i + 3, 2), lines, tc_putch);
|
|---|
| 832 | putchp('X');
|
|---|
| 833 | tputs(tparm(cursor_address, i + 4, 3), lines, tc_putch);
|
|---|
| 834 | putchp('X');
|
|---|
| 835 | put_mode(exit_standout_mode);
|
|---|
| 836 | put_crlf();
|
|---|
| 837 | tc_putp(clr_eos); /* OK if missing */
|
|---|
| 838 | put_crlf();
|
|---|
| 839 | ptextln("If you see a diagonal line of standout X's then (msgr) should be true. If any of the blanks are standout then (msgr) should be false.");
|
|---|
| 840 | sprintf(temp, "(msgr) Move-in-SGR-mode is %s in the data base",
|
|---|
| 841 | move_standout_mode ? "true" : "false");
|
|---|
| 842 | ptextln(temp);
|
|---|
| 843 | } else {
|
|---|
| 844 | ptextln("(smso) (rmso) (smacs) (rmacs) missing; (msgr) Move-in-SGR-mode not tested.");
|
|---|
| 845 | }
|
|---|
| 846 | generic_done_message(t, state, ch);
|
|---|
| 847 | }
|
|---|
| 848 |
|
|---|
| 849 | /*
|
|---|
| 850 | ** subtest_in(test_list, status, ch)
|
|---|
| 851 | **
|
|---|
| 852 | ** (in) insert null glitch
|
|---|
| 853 | */
|
|---|
| 854 | static void
|
|---|
| 855 | subtest_in(
|
|---|
| 856 | struct test_list *t,
|
|---|
| 857 | int *state,
|
|---|
| 858 | int *ch)
|
|---|
| 859 | {
|
|---|
| 860 | if (enter_insert_mode && exit_insert_mode) {
|
|---|
| 861 | ptextln("\nTesting (in) with (smir) and (rmir)");
|
|---|
| 862 | putln("\tIf these two lines line up ...");
|
|---|
| 863 | put_str("\tIf these two lines line up ...");
|
|---|
| 864 | put_cr();
|
|---|
| 865 | tc_putp(enter_insert_mode);
|
|---|
| 866 | putchp(' ');
|
|---|
| 867 | tc_putp(exit_insert_mode);
|
|---|
| 868 | ptext("\nthen (in) should be set. ");
|
|---|
| 869 | sprintf(temp,
|
|---|
| 870 | "(in) Insert-null-glitch is %s in the data base.",
|
|---|
| 871 | insert_null_glitch ? "true" : "false");
|
|---|
| 872 | ptextln(temp);
|
|---|
| 873 | generic_done_message(t, state, ch);
|
|---|
| 874 | }
|
|---|
| 875 | }
|
|---|
| 876 |
|
|---|
| 877 | /*
|
|---|
| 878 | ** subtest_dadb(test_list, status, ch)
|
|---|
| 879 | **
|
|---|
| 880 | ** (da) (db) data above, (db) data below
|
|---|
| 881 | */
|
|---|
| 882 | static void
|
|---|
| 883 | subtest_dadb(
|
|---|
| 884 | struct test_list *t,
|
|---|
| 885 | int *state,
|
|---|
| 886 | int *ch)
|
|---|
| 887 | {
|
|---|
| 888 | if (can_clear_screen && scroll_reverse && scroll_forward) {
|
|---|
| 889 | put_clear();
|
|---|
| 890 | if (scroll_reverse)
|
|---|
| 891 | ptext("(da) Data-above should be set\r");
|
|---|
| 892 | home_down();
|
|---|
| 893 | if (scroll_forward)
|
|---|
| 894 | ptext("(db) Data-below should be set\r");
|
|---|
| 895 | tc_putp(scroll_forward);
|
|---|
| 896 | go_home();
|
|---|
| 897 | tc_putp(scroll_reverse);
|
|---|
| 898 | tc_putp(scroll_reverse);
|
|---|
| 899 | home_down();
|
|---|
| 900 | tc_putp(scroll_forward);
|
|---|
| 901 | go_home();
|
|---|
| 902 | ptextln("\n\n\n\n\nIf the top line is blank then (da) should be false.");
|
|---|
| 903 | ptextln("If the bottom line is blank then (db) should be false.");
|
|---|
| 904 | sprintf(temp, "\n(da) Data-above is %s, and (db) Data-below is %s, in the data base.",
|
|---|
| 905 | memory_above ? "true" : "false",
|
|---|
| 906 | memory_below ? "true" : "false");
|
|---|
| 907 | ptextln(temp);
|
|---|
| 908 | line_count = lines;
|
|---|
| 909 | } else {
|
|---|
| 910 | ptextln("(da) Data-above, (db) Data-below not tested, scrolls or (clear) is missing.");
|
|---|
| 911 | }
|
|---|
| 912 | generic_done_message(t, state, ch);
|
|---|
| 913 | }
|
|---|