xref: /netbsd-src/tests/lib/libcurses/t_curses.sh (revision 8ecbf5f02b752fcb7debe1a8fab1dc82602bc760)
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 $2 \
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 chgat
237chgat_head()
238{
239	atf_set "descr" "Check changing attributes works"
240}
241chgat_body()
242{
243	h_run chgat
244}
245
246atf_test_case clear
247clear_head()
248{
249	atf_set "descr" "Check clear and erase work"
250}
251clear_body()
252{
253	h_run clear
254}
255
256atf_test_case copywin
257copywin_head()
258{
259	atf_set "descr" "Check all the modes of copying a window work"
260}
261copywin_body()
262{
263	h_run copywin
264}
265
266atf_test_case curs_set
267curs_set_head()
268{
269	atf_set "descr" "Check setting the cursor visibility works"
270}
271curs_set_body()
272{
273	h_run curs_set
274}
275
276atf_test_case define_key
277define_key_head()
278{
279	atf_set "descr" "Check defining a key and removing the definition works"
280}
281define_key_body()
282{
283	h_run define_key
284}
285
286atf_test_case delay_output
287delay_output_head()
288{
289	atf_set "descr" "Check that padding is inserted when delaying output"
290}
291delay_output_body()
292{
293	h_run delay_output -v
294}
295
296atf_test_case derwin
297derwin_head()
298{
299	atf_set "descr" "Check derived subwindow creation behaves correctly."
300}
301derwin_body()
302{
303	h_run derwin
304}
305
306atf_test_case doupdate
307doupdate_head()
308{
309	atf_set "descr" "Check doupdate performs an update"
310}
311doupdate_body()
312{
313	h_run doupdate
314}
315
316atf_test_case dupwin
317dupwin_head()
318{
319	atf_set "descr" "Check duplicating a window works"
320}
321dupwin_body()
322{
323	h_run dupwin
324}
325
326atf_test_case erasechar
327erasechar_head()
328{
329	atf_set "descr" "Validate erase char can be retrieved"
330}
331erasechar_body()
332{
333	h_run erasechar
334}
335
336atf_test_case flash
337flash_head()
338{
339	atf_set "descr" "Validate curses can flash the screen"
340}
341flash_body()
342{
343	h_run flash
344}
345
346atf_test_case getattrs
347getattrs_head()
348{
349	atf_set "descr" "Validate curses can get and set attributes on a window"
350}
351getattrs_body()
352{
353	h_run getattrs
354}
355
356atf_test_case bkgdset
357bkgdset_head()
358{
359	atf_set "descr" "Validate curses set the background attributes on stdscr"
360}
361bkgdset_body()
362{
363	h_run bkgdset
364}
365
366atf_test_case getbkgd
367getbkgd_head()
368{
369	atf_set "descr" "Validate curses getting the background attributes on stdscr"
370}
371getbkgd_body()
372{
373	h_run getbkgd
374}
375
376atf_test_case getcurx
377getcurx_head()
378{
379	atf_set "descr" "Validate curses getting cursor locations in a window"
380}
381getcurx_body()
382{
383	h_run getcurx
384}
385
386atf_test_case getmaxx
387getmaxx_head()
388{
389	atf_set "descr" "Validate curses getting the maximum x value of a window"
390}
391getmaxx_body()
392{
393	h_run getmaxx
394}
395
396atf_test_case getmaxy
397getmaxy_head()
398{
399	atf_set "descr" "Validate curses getting the maximum y value of a window"
400}
401getmaxy_body()
402{
403	h_run getmaxy
404}
405
406atf_test_case getnstr
407getnstr_head()
408{
409	atf_set "descr" "Check getting a string with a limit"
410}
411getnstr_body()
412{
413	h_run getnstr
414}
415
416atf_test_case getparx
417getparx_head()
418{
419	atf_set "descr" "Check getting the location of a window relative to its parent"
420}
421getparx_body()
422{
423	h_run getparx
424}
425
426atf_test_case has_colors
427has_colors_head()
428{
429	atf_set "descr" "Check if the terminal can support colours"
430}
431has_colors_body()
432{
433	h_run has_colors
434}
435
436atf_test_case has_ic
437has_ic_head()
438{
439	atf_set "descr" "Check if the terminal can insert characters and lines"
440}
441has_ic_body()
442{
443	h_run has_ic
444}
445
446atf_test_case hline
447hline_head()
448{
449	atf_set "descr" "Draw a horizontal line"
450}
451hline_body()
452{
453	h_run hline
454}
455
456atf_test_case inch
457inch_head()
458{
459	atf_set "descr" "Get the character under the cursor on stdscr"
460}
461inch_body()
462{
463	h_run inch
464}
465
466atf_test_case inchnstr
467inchnstr_head()
468{
469	atf_set "descr" "Get a limited chtype string from the screen"
470}
471inchnstr_body()
472{
473	h_run inchnstr
474}
475
476atf_test_case init_color
477init_color_head()
478{
479	atf_set "descr" "Set a custom color entry"
480}
481init_color_body()
482{
483	h_run init_color
484}
485
486atf_test_case innstr
487innstr_head()
488{
489	atf_set "descr" "Get a limited string starting at the cursor"
490}
491innstr_body()
492{
493	h_run innstr
494}
495
496atf_test_case is_linetouched
497is_linetouched_head()
498{
499	atf_set "descr" "Check if a line has been modified in a window"
500}
501is_linetouched_body()
502{
503	h_run is_linetouched
504}
505
506atf_test_case is_wintouched
507is_wintouched_head()
508{
509	atf_set "descr" "Check if a window has been modified"
510}
511is_wintouched_body()
512{
513	h_run is_wintouched
514}
515
516atf_test_case keyname
517keyname_head()
518{
519	atf_set "descr" "Convert integers into printable key names"
520}
521keyname_body()
522{
523	h_run keyname
524}
525
526atf_test_case keyok
527keyok_head()
528{
529	atf_set "descr" "Check the ability to disable interpretation of a multichar key sequence"
530}
531keyok_body()
532{
533	h_run keyok
534}
535
536atf_test_case killchar
537killchar_head()
538{
539	atf_set "descr" "Get the value of the terminals kill character"
540}
541killchar_body()
542{
543	h_run killchar
544}
545
546atf_test_case meta
547meta_head()
548{
549	atf_set "descr" "Check setting and clearing the meta flag on a window"
550}
551meta_body()
552{
553	h_run meta
554}
555
556atf_test_case mvaddch
557mvaddch_head()
558{
559	atf_set "descr" "Move the cursor and add a character to stdscr"
560}
561mvaddch_body()
562{
563	h_run mvaddch
564}
565
566atf_test_case mvaddchnstr
567mvaddchnstr_head()
568{
569	atf_set "descr" "Move the cursor and add a character string to stdscr"
570}
571mvaddchnstr_body()
572{
573	h_run mvaddchnstr
574}
575
576atf_test_case mvaddchstr
577mvaddchstr_head()
578{
579	atf_set "descr" "Move the cursor and add a ch string to stdscr"
580}
581mvaddchstr_body()
582{
583	h_run mvaddchstr
584}
585
586atf_test_case mvaddnstr
587mvaddnstr_head()
588{
589	atf_set "descr" "Move the cursor and add a limited string to stdscr"
590}
591mvaddnstr_body()
592{
593	h_run mvaddnstr
594}
595
596atf_test_case mvaddstr
597mvaddstr_head()
598{
599	atf_set "descr" "Move the cursor and add a string to stdscr"
600}
601mvaddstr_body()
602{
603	h_run mvaddstr
604}
605
606atf_test_case mvchgat
607mvchgat_head()
608{
609	atf_set "descr" "Change the attributes on the screen"
610}
611mvchgat_body()
612{
613	h_run mvchgat
614}
615
616atf_test_case mvcur
617mvcur_head()
618{
619	atf_set "descr" "Move the cursor on the screen"
620}
621mvcur_body()
622{
623	h_run mvcur
624}
625
626atf_test_case mvderwin
627mvderwin_head()
628{
629	atf_set "descr" "Move the mapping of a region relative to the parent"
630}
631mvderwin_body()
632{
633	h_run mvderwin
634}
635
636atf_test_case mvgetnstr
637mvgetnstr_head()
638{
639	atf_set "descr" "Move the cursor and get a limited number of characters"
640}
641mvgetnstr_body()
642{
643	h_run mvgetnstr
644}
645
646atf_test_case mvgetstr
647mvgetstr_head()
648{
649	atf_set "descr" "Move the cursor and get characters"
650}
651mvgetstr_body()
652{
653	h_run mvgetstr
654}
655
656atf_test_case mvhline
657mvhline_head()
658{
659	atf_set "descr" "Move the cursor and draw a horizontal line"
660}
661mvhline_body()
662{
663	h_run mvhline
664}
665
666atf_test_case mvinchnstr
667mvinchnstr_head()
668{
669	atf_set "descr" "Move the cursor read characters - tests both mvinchstr and mvinchnstr"
670}
671mvinchnstr_body()
672{
673	h_run mvinchnstr
674}
675
676atf_test_case mvprintw
677mvprintw_head()
678{
679	atf_set "descr" "Move the cursor and print a string"
680}
681mvprintw_body()
682{
683	h_run mvprintw
684}
685
686atf_test_case mvscanw
687mvscanw_head()
688{
689	atf_set "descr" "Move the cursor and scan for input patterns"
690}
691mvscanw_body()
692{
693	h_run mvscanw
694}
695
696atf_test_case mvvline
697mvvline_head()
698{
699	atf_set "descr" "Move the cursor and draw a vertical line"
700}
701mvvline_body()
702{
703	h_run mvvline
704}
705
706atf_test_case pad
707pad_head()
708{
709	atf_set "descr" "Test the newpad, subpad, pnoutrefresh and prefresh functions"
710}
711pad_body()
712{
713	h_run pad
714}
715
716atf_test_case nocbreak
717nocbreak_head()
718{
719	atf_set "descr" "Test that the nocbreak call returns the terminal to canonical character processing"
720}
721nocbreak_body()
722{
723	h_run nocbreak
724}
725
726atf_test_case nodelay
727nodelay_head()
728{
729	atf_set "descr" "Test that the nodelay call causes wget to not block"
730}
731nodelay_body()
732{
733	h_run nodelay
734}
735
736atf_init_test_cases()
737{
738	atf_add_test_case startup
739	atf_add_test_case addch
740	atf_add_test_case addchstr
741	atf_add_test_case addchnstr
742	atf_add_test_case addstr
743	atf_add_test_case addnstr
744	atf_add_test_case getch
745	atf_add_test_case timeout
746	atf_add_test_case window
747	atf_add_test_case wborder
748	atf_add_test_case box
749	atf_add_test_case wprintw
750	atf_add_test_case wscrl
751	atf_add_test_case mvwin
752	atf_add_test_case getstr
753	atf_add_test_case termattrs
754	atf_add_test_case can_change_color
755	atf_add_test_case assume_default_colors
756	atf_add_test_case attributes
757	atf_add_test_case beep
758	atf_add_test_case background
759	atf_add_test_case cbreak
760	atf_add_test_case chgat
761	atf_add_test_case clear
762	atf_add_test_case copywin
763	atf_add_test_case curs_set
764	atf_add_test_case define_key
765#	atf_add_test_case delay_output # not working
766	atf_add_test_case derwin
767	atf_add_test_case doupdate
768	atf_add_test_case dupwin
769	atf_add_test_case erasechar
770	atf_add_test_case flash
771	atf_add_test_case getattrs
772	atf_add_test_case bkgdset
773	atf_add_test_case getbkgd
774	atf_add_test_case getcurx
775	atf_add_test_case getmaxx
776	atf_add_test_case getmaxy
777	atf_add_test_case getnstr
778	atf_add_test_case getparx
779	atf_add_test_case has_colors
780	atf_add_test_case has_ic
781	atf_add_test_case hline
782	atf_add_test_case inch
783	atf_add_test_case inchnstr
784	atf_add_test_case init_color
785	atf_add_test_case innstr
786	atf_add_test_case is_linetouched
787	atf_add_test_case is_wintouched
788	atf_add_test_case keyname
789	atf_add_test_case keyok
790	atf_add_test_case killchar
791	atf_add_test_case meta
792	atf_add_test_case mvaddch
793	atf_add_test_case mvaddchnstr
794	atf_add_test_case mvaddchstr
795	atf_add_test_case mvaddnstr
796	atf_add_test_case mvaddstr
797	atf_add_test_case mvchgat
798	atf_add_test_case mvcur
799	atf_add_test_case mvderwin
800	atf_add_test_case mvgetnstr
801	atf_add_test_case mvgetstr
802	atf_add_test_case mvhline
803	atf_add_test_case mvinchnstr
804	atf_add_test_case mvprintw
805	atf_add_test_case mvscanw
806	atf_add_test_case mvvline
807	atf_add_test_case pad
808	atf_add_test_case nocbreak
809	atf_add_test_case nodelay
810}
811
812