]> ncurses.scripts.mit.edu Git - ncurses.git/blob - test/firstlast.c
ncurses 5.0
[ncurses.git] / test / firstlast.c
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.2 1997/10/18 21:34:53 tom Exp $
6  */
7
8 #include <test.priv.h>
9
10 static void fill(WINDOW *w,const char *str)
11 {
12         const char *s;
13         for(;;) {
14                 for(s=str; *s; s++) {
15                         if(waddch(w,*s)==ERR)
16                         {
17                                 wmove(w,0,0);
18                                 return;
19                         }
20                 }
21         }
22 }
23
24 int main(
25         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         return EXIT_SUCCESS;
89 }