xref: /netbsd-src/tests/lib/libcurses/tests/addbytes (revision 627f7eb200a4419d89b531d55fccd2ee3ffdcde0)
1# $NetBSD: addbytes,v 1.4 2021/02/25 01:07:43 rillig Exp $
2#
3# Tests adding bytes to stdscr.
4#
5# Note that addbytes is not part of the official curses API, it is merely
6# an internal helper function.
7
8include start
9
10call OK addbytes "\t" 1
11call2 0 8 getyx STDSCR
12
13call OK addbytes "123456" 6
14call2 0 14 getyx STDSCR
15
16call OK addbytes "\t" 1
17call2 0 16 getyx STDSCR
18
19call OK addbytes "\n" 1
20call2 1 0 getyx STDSCR
21
22# Ensure that backspace works as intended.
23# See tests/addch.
24call OK addbytes "12345\010" 6
25call2 1 4 getyx STDSCR
26
27call OK addbytes "\010\010\010\010" 4
28call2 1 0 getyx STDSCR
29
30# If curx is already 0, backspace is a no-op.
31call OK addbytes "\010" 1
32call2 1 0 getyx STDSCR
33
34call OK addbytes "123\t" 4
35call2 1 8 getyx STDSCR
36
37# Backspace affects the cursor position, no matter whether the previously
38# output char was a tab or a space.
39call OK addbytes "\010" 1
40call2 1 7 getyx STDSCR
41