xref: /freebsd/contrib/netbsd-tests/lib/libcurses/t_curses.sh (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1
2h_run()
3{
4	file="$(atf_get_srcdir)/tests/${1}"
5
6	export COLUMNS=80
7	export LINES=24
8	$(atf_get_srcdir)/director \
9	    -T $(atf_get_srcdir) \
10	    -t atf \
11	    -I $(atf_get_srcdir)/tests \
12	    -C $(atf_get_srcdir)/check_files \
13	    -s $(atf_get_srcdir)/slave $file || atf_fail "test ${file} failed"
14}
15
16atf_test_case startup
17startup_head()
18{
19	atf_set "descr" "Checks curses initialisation sequence"
20}
21startup_body()
22{
23	h_run start
24}
25
26atf_test_case addch
27addch_head()
28{
29	atf_set "descr" "Tests adding a chtype to stdscr"
30}
31addch_body()
32{
33	h_run addch
34}
35
36atf_test_case addchstr
37addchstr_head()
38{
39	atf_set "descr" "Tests adding a chtype string to stdscr"
40}
41addchstr_body()
42{
43	h_run addchstr
44}
45
46atf_test_case addchnstr
47addchnstr_head()
48{
49	atf_set "descr" "Tests adding bytes from a chtype string to stdscr"
50}
51addchnstr_body()
52{
53	h_run addchnstr
54}
55
56atf_test_case addstr
57addstr_head()
58{
59	atf_set "descr" "Tests adding bytes from a string to stdscr"
60}
61addstr_body()
62{
63	h_run addstr
64}
65
66atf_test_case addnstr
67addnstr_head()
68{
69	atf_set "descr" "Tests adding bytes from a string to stdscr"
70}
71addnstr_body()
72{
73	h_run addnstr
74}
75
76atf_test_case getch
77getch_head()
78{
79	atf_set "descr" "Checks reading a character input"
80}
81getch_body()
82{
83	h_run getch
84}
85
86atf_test_case timeout
87timeout_head()
88{
89	atf_set "descr" "Checks timeout when reading a character"
90}
91timeout_body()
92{
93	h_run timeout
94}
95
96atf_test_case window
97window_head()
98{
99	atf_set "descr" "Checks window creation"
100}
101window_body()
102{
103	h_run window
104}
105
106atf_test_case wborder
107wborder_head()
108{
109	atf_set "descr" "Checks drawing a border around a window"
110}
111wborder_body()
112{
113	h_run wborder
114}
115
116atf_test_case box
117box_head()
118{
119	atf_set "descr" "Checks drawing a box around a window"
120}
121box_body()
122{
123	h_run box
124}
125
126atf_test_case wprintw
127wprintw_head()
128{
129	atf_set "descr" "Checks printing to a window"
130}
131wprintw_body()
132{
133	h_run wprintw
134}
135
136atf_test_case wscrl
137wscrl_head()
138{
139	atf_set "descr" "Check window scrolling"
140}
141wscrl_body()
142{
143	h_run wscrl
144}
145
146atf_test_case mvwin
147mvwin_head()
148{
149	atf_set "descr" "Check moving a window"
150}
151mvwin_body()
152{
153	h_run mvwin
154}
155
156atf_test_case getstr
157getstr_head()
158{
159	atf_set "descr" "Check getting a string from input"
160}
161getstr_body()
162{
163	h_run getstr
164}
165
166atf_test_case termattrs
167termattrs_head()
168{
169	atf_set "descr" "Check the terminal attributes"
170}
171termattrs_body()
172{
173	h_run termattrs
174}
175
176atf_test_case assume_default_colors
177assume_default_colors_head()
178{
179	atf_set "descr" "Check setting the default color pair"
180}
181assume_default_colors_body()
182{
183	h_run assume_default_colors
184}
185
186atf_test_case attributes
187attributes_head()
188{
189	atf_set "descr" "Check setting, clearing and getting of attributes"
190}
191attributes_body()
192{
193	h_run attributes
194}
195
196atf_test_case beep
197beep_head()
198{
199	atf_set "descr" "Check sending a beep"
200}
201beep_body()
202{
203	h_run beep
204}
205
206atf_test_case background
207background_head()
208{
209	atf_set "descr" "Check setting background character and attributes for both stdscr and a window."
210}
211background_body()
212{
213	h_run background
214}
215
216atf_test_case can_change_color
217can_change_color_head()
218{
219	atf_set "descr" "Check if the terminal can change colours"
220}
221can_change_color_body()
222{
223	h_run can_change_color
224}
225
226atf_test_case cbreak
227cbreak_head()
228{
229	atf_set "descr" "Check cbreak mode works"
230}
231cbreak_body()
232{
233	h_run cbreak
234}
235
236atf_test_case clear
237clear_head()
238{
239	atf_set "descr" "Check clear and erase work"
240}
241clear_body()
242{
243	h_run clear
244}
245
246atf_test_case copywin
247copywin_head()
248{
249	atf_set "descr" "Check all the modes of copying a window work"
250}
251copywin_body()
252{
253	h_run copywin
254}
255
256atf_test_case curs_set
257curs_set_head()
258{
259	atf_set "descr" "Check setting the cursor visibility works"
260}
261curs_set_body()
262{
263	h_run curs_set
264}
265
266atf_init_test_cases()
267{
268	atf_add_test_case startup
269	atf_add_test_case addch
270	atf_add_test_case addchstr
271	atf_add_test_case addchnstr
272	atf_add_test_case addstr
273	atf_add_test_case addnstr
274	atf_add_test_case getch
275	atf_add_test_case timeout
276	atf_add_test_case window
277	atf_add_test_case wborder
278	atf_add_test_case box
279	atf_add_test_case wprintw
280	atf_add_test_case wscrl
281	atf_add_test_case mvwin
282	atf_add_test_case getstr
283	atf_add_test_case termattrs
284	atf_add_test_case can_change_color
285	atf_add_test_case assume_default_colors
286	atf_add_test_case attributes
287#	atf_add_test_case beep  # comment out for now - return is wrong
288	atf_add_test_case background
289	atf_add_test_case cbreak
290	atf_add_test_case clear
291	atf_add_test_case copywin
292	atf_add_test_case curs_set
293}
294
295