summaryrefslogtreecommitdiffstats
path: root/lib/libncurses/TESTS/copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libncurses/TESTS/copy.c')
-rw-r--r--lib/libncurses/TESTS/copy.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/libncurses/TESTS/copy.c b/lib/libncurses/TESTS/copy.c
new file mode 100644
index 0000000..013f9db
--- /dev/null
+++ b/lib/libncurses/TESTS/copy.c
@@ -0,0 +1,39 @@
+#include <ncurses.h>
+
+main()
+{
+WINDOW *win1, *win2;
+int h, i;
+
+ initscr();
+ cbreak();
+ noecho();
+ win1 = newwin(20, 50, 0, 20);
+ for (h = 0; h < 20; h++)
+ for (i = 0; i < 50; i++)
+ mvwaddch(win1, h, i, 'X');
+ wrefresh(win1);
+ getch();
+
+ win2 = newwin(20, 50, 3, 30);
+ for (h = 0; h < 20; h++)
+ for (i = 0; i < 50; i++)
+ mvwaddch(win2, h, i, 'Y');
+ wnoutrefresh(win1);
+ wnoutrefresh(win2);
+ doupdate();
+ getch();
+
+ /* now, remove window 2 and restore the contents of window 1 */
+ i = copywin(win1, win2, 5, 10, 0, 0, 14, 39, 0);
+ wnoutrefresh(win1);
+ wnoutrefresh(win2);
+ printw("copywin returns %d\n", i);
+ wnoutrefresh(stdscr);
+ doupdate();
+
+ getch();
+
+ endwin();
+}
+
OpenPOWER on IntegriCloud