1 /****************************************************************************
2 * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
27 ****************************************************************************/
29 * Test lower-right-hand corner access
31 * originally by Eric S. Raymond <esr@thyrsus.com>, written for animation
32 * and resizing -T.Dickey
34 * This can't be part of the ncurses test-program, because ncurses rips off the
35 * bottom line to do labels.
37 * $Id: lrtest.c,v 1.22 2010/05/01 19:11:55 tom Exp $
40 #include <test.priv.h>
43 int y
, x
, mode
, dir
, inc
;
48 * Make a couple of markers go 'round the border to demonstrate that we can
49 * really write to all positions properly.
54 MvAddCh(m
->y
, m
->x
, m
->value
);
55 if (m
->mode
== 0) { /* along the x-direction */
59 m
->inc
= -m
->dir
* m
->inc
;
62 } else if (m
->x
< 0) {
64 m
->inc
= -m
->dir
* m
->inc
;
68 } else { /* along the y-direction */
72 m
->inc
= m
->dir
* m
->inc
;
75 } else if (m
->y
< 0) {
77 m
->inc
= m
->dir
* m
->inc
;
87 char *argv
[]GCC_UNUSED
)
91 {0, 0, 0, -1, 1, '+' | A_BOLD
},
93 {0, 0, 1, -1, 3, 'Y'},
94 {0, 8, 0, -1, 1, '+' | A_BOLD
},
95 {0, 9, 0, -1, 1, '+' | A_BOLD
},
96 {1, 0, 1, 1, 1, '*' | A_REVERSE
},
97 {2, 0, 1, 1, 1, '*' | A_REVERSE
}
100 setlocale(LC_ALL
, "");
105 nodelay(stdscr
, TRUE
);
109 keypad(stdscr
, TRUE
);
112 move(LINES
/ 2 - 1, 4);
115 /* see PutCharLR() */
117 || (enter_am_mode
&& exit_am_mode
)
120 addstr("Your terminal lacks the capabilities needed to address the\n");
122 addstr("lower-right-hand corner of the screen.\n");
124 addstr("This is a test of access to the lower right corner.\n");
126 addstr("If the top of the box is missing, the test failed.\n");
127 move(LINES
/ 2 + 1, 4);
128 addstr("Please report this (with a copy of your terminfo entry).\n");
129 move(LINES
/ 2 + 2, 4);
130 addstr("to the ncurses maintainers, at bug-ncurses@gnu.org.\n");
138 for (n
= 0; n
< SIZEOF(marks
); n
++) {
142 if ((ch
= getch()) > 0) {
146 nodelay(stdscr
, FALSE
);
148 nodelay(stdscr
, TRUE
);
153 trace(TRACE_CALLS
| TRACE_ICALLS
| TRACE_UPDATE
);
156 else if (ch
== KEY_RESIZE
) {
157 for (n
= 0; n
< SIZEOF(marks
); n
++) {
158 if (marks
[n
].mode
== 0) { /* moving along x-direction */
160 marks
[n
].y
= LINES
- 1;
163 marks
[n
].x
= COLS
- 1;
179 ExitProgram(EXIT_SUCCESS
);
182 /* lrtest.c ends here */