| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * This test was written by Alexander V. Lukyanov to demonstrate difference
|
|---|
| 3 | * between ncurses 4.1 and SVR4 curses
|
|---|
| 4 | *
|
|---|
| 5 | * $Id: firstlast.c,v 1.4 2005/04/16 16:34:05 tom Exp $
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include <test.priv.h>
|
|---|
| 9 |
|
|---|
| 10 | static void
|
|---|
| 11 | fill(WINDOW *w, const char *str)
|
|---|
| 12 | {
|
|---|
| 13 | const char *s;
|
|---|
| 14 | for (;;) {
|
|---|
| 15 | for (s = str; *s; s++) {
|
|---|
| 16 | if (waddch(w, UChar(*s)) == ERR) {
|
|---|
| 17 | wmove(w, 0, 0);
|
|---|
| 18 | return;
|
|---|
| 19 | }
|
|---|
| 20 | }
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | int
|
|---|
| 25 | main(int argc GCC_UNUSED,
|
|---|
| 26 | char *argv[]GCC_UNUSED)
|
|---|
| 27 | {
|
|---|
| 28 | WINDOW *large, *small;
|
|---|
| 29 | initscr();
|
|---|
| 30 | noecho();
|
|---|
| 31 |
|
|---|
| 32 | large = newwin(20, 60, 2, 10);
|
|---|
| 33 | small = newwin(10, 30, 7, 25);
|
|---|
| 34 |
|
|---|
| 35 | /* test 1 - addch */
|
|---|
| 36 | fill(large, "LargeWindow");
|
|---|
| 37 |
|
|---|
| 38 | refresh();
|
|---|
| 39 | wrefresh(large);
|
|---|
| 40 | wrefresh(small);
|
|---|
| 41 |
|
|---|
| 42 | mvwaddstr(small, 5, 5, " Test <place to change> String ");
|
|---|
| 43 | wrefresh(small);
|
|---|
| 44 | getch();
|
|---|
| 45 |
|
|---|
| 46 | touchwin(large);
|
|---|
| 47 | wrefresh(large);
|
|---|
| 48 |
|
|---|
| 49 | mvwaddstr(small, 5, 5, " Test <***************> String ");
|
|---|
| 50 | wrefresh(small);
|
|---|
| 51 |
|
|---|
| 52 | /* DIFFERENCE! */
|
|---|
| 53 | getch();
|
|---|
| 54 |
|
|---|
| 55 | /* test 2: erase */
|
|---|
| 56 | erase();
|
|---|
| 57 | refresh();
|
|---|
| 58 | getch();
|
|---|
| 59 |
|
|---|
| 60 | /* test 3: clrtoeol */
|
|---|
| 61 | werase(small);
|
|---|
| 62 | wrefresh(small);
|
|---|
| 63 | touchwin(large);
|
|---|
| 64 | wrefresh(large);
|
|---|
| 65 | wmove(small, 5, 0);
|
|---|
| 66 | waddstr(small, " clrtoeol>");
|
|---|
| 67 | wclrtoeol(small);
|
|---|
| 68 | wrefresh(small);
|
|---|
| 69 |
|
|---|
| 70 | /* DIFFERENCE! */ ;
|
|---|
| 71 | getch();
|
|---|
| 72 |
|
|---|
| 73 | /* test 4: clrtobot */
|
|---|
| 74 | werase(small);
|
|---|
| 75 | wrefresh(small);
|
|---|
| 76 | touchwin(large);
|
|---|
| 77 | wrefresh(large);
|
|---|
| 78 | wmove(small, 5, 3);
|
|---|
| 79 | waddstr(small, " clrtobot>");
|
|---|
| 80 | wclrtobot(small);
|
|---|
| 81 | wrefresh(small);
|
|---|
| 82 |
|
|---|
| 83 | /* DIFFERENCE! */
|
|---|
| 84 | getch();
|
|---|
| 85 |
|
|---|
| 86 | endwin();
|
|---|
| 87 |
|
|---|
| 88 | ExitProgram(EXIT_SUCCESS);
|
|---|
| 89 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.