1 /****************************************************************************
2 * Copyright 2019,2020 Thomas E. Dickey *
3 * Copyright 1998-2010,2017 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************/
30 * Test lower-right-hand corner access
32 * originally by Eric S. Raymond <esr@thyrsus.com>, written for animation
33 * and resizing -T.Dickey
35 * This can't be part of the ncurses test-program, because ncurses rips off the
36 * bottom line to do labels.
38 * $Id: lrtest.c,v 1.27 2020/02/02 23:34:34 tom Exp $
41 #include <test.priv.h>
44 int y, x, mode, dir, inc;
49 * Make a couple of markers go 'round the border to demonstrate that we can
50 * really write to all positions properly.
55 MvAddCh(m->y, m->x, m->value);
56 if (m->mode == 0) { /* along the x-direction */
60 m->inc = -m->dir * m->inc;
63 } else if (m->x < 0) {
65 m->inc = -m->dir * m->inc;
69 } else { /* along the y-direction */
73 m->inc = m->dir * m->inc;
76 } else if (m->y < 0) {
78 m->inc = m->dir * m->inc;
88 char *argv[]GCC_UNUSED)
92 {0, 0, 0, -1, 1, '+' | A_BOLD},
94 {0, 0, 1, -1, 3, 'Y'},
95 {0, 8, 0, -1, 1, '+' | A_BOLD},
96 {0, 9, 0, -1, 1, '+' | A_BOLD},
97 {1, 0, 1, 1, 1, '*' | A_REVERSE},
98 {2, 0, 1, 1, 1, '*' | A_REVERSE}
101 setlocale(LC_ALL, "");
106 nodelay(stdscr, TRUE);
110 keypad(stdscr, TRUE);
113 move(LINES / 2 - 1, 4);
116 /* see PutCharLR() */
118 || (enter_am_mode && exit_am_mode)
121 addstr("Your terminal lacks the capabilities needed to address the\n");
123 addstr("lower-right-hand corner of the screen.\n");
125 addstr("This is a test of access to the lower right corner.\n");
127 addstr("If the top of the box is missing, the test failed.\n");
128 move(LINES / 2 + 1, 4);
129 addstr("Please report this (with a copy of your terminfo entry).\n");
130 move(LINES / 2 + 2, 4);
131 addstr("to the ncurses maintainers, at bug-ncurses@gnu.org.\n");
139 for (n = 0; n < SIZEOF(marks); n++) {
143 if ((ch = getch()) > 0) {
147 nodelay(stdscr, FALSE);
149 nodelay(stdscr, TRUE);
154 curses_trace(TRACE_CALLS | TRACE_ICALLS | TRACE_UPDATE);
157 else if (ch == KEY_RESIZE) {
158 for (n = 0; n < SIZEOF(marks); n++) {
159 if (marks[n].mode == 0) { /* moving along x-direction */
161 marks[n].y = LINES - 1;
164 marks[n].x = COLS - 1;
179 ExitProgram(EXIT_SUCCESS);
182 /* lrtest.c ends here */