Home | History | Annotate | Line # | Download | only in libcurses
t_curses.sh revision 1.12
      1 
      2 h_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 
     16 atf_test_case startup
     17 startup_head()
     18 {
     19 	atf_set "descr" "Checks curses initialisation sequence"
     20 }
     21 startup_body()
     22 {
     23 	h_run start
     24 }
     25 
     26 atf_test_case addch
     27 addch_head()
     28 {
     29 	atf_set "descr" "Tests adding a chtype to stdscr"
     30 }
     31 addch_body()
     32 {
     33 	h_run addch
     34 }
     35 
     36 atf_test_case addchstr
     37 addchstr_head()
     38 {
     39 	atf_set "descr" "Tests adding a chtype string to stdscr"
     40 }
     41 addchstr_body()
     42 {
     43 	h_run addchstr
     44 }
     45 
     46 atf_test_case addchnstr
     47 addchnstr_head()
     48 {
     49 	atf_set "descr" "Tests adding bytes from a chtype string to stdscr"
     50 }
     51 addchnstr_body()
     52 {
     53 	h_run addchnstr
     54 }
     55 
     56 atf_test_case addstr
     57 addstr_head()
     58 {
     59 	atf_set "descr" "Tests adding bytes from a string to stdscr"
     60 }
     61 addstr_body()
     62 {
     63 	h_run addstr
     64 }
     65 
     66 atf_test_case addnstr
     67 addnstr_head()
     68 {
     69 	atf_set "descr" "Tests adding bytes from a string to stdscr"
     70 }
     71 addnstr_body()
     72 {
     73 	h_run addnstr
     74 }
     75 
     76 atf_test_case getch
     77 getch_head()
     78 {
     79 	atf_set "descr" "Checks reading a character input"
     80 }
     81 getch_body()
     82 {
     83 	h_run getch
     84 }
     85 
     86 atf_test_case timeout
     87 timeout_head()
     88 {
     89 	atf_set "descr" "Checks timeout when reading a character"
     90 }
     91 timeout_body()
     92 {
     93 	h_run timeout
     94 }
     95 
     96 atf_test_case window
     97 window_head()
     98 {
     99 	atf_set "descr" "Checks window creation"
    100 }
    101 window_body()
    102 {
    103 	h_run window
    104 }
    105 
    106 atf_test_case wborder
    107 wborder_head()
    108 {
    109 	atf_set "descr" "Checks drawing a border around a window"
    110 }
    111 wborder_body()
    112 {
    113 	h_run wborder
    114 }
    115 
    116 atf_test_case box
    117 box_head()
    118 {
    119 	atf_set "descr" "Checks drawing a box around a window"
    120 }
    121 box_body()
    122 {
    123 	h_run box
    124 }
    125 
    126 atf_test_case wprintw
    127 wprintw_head()
    128 {
    129 	atf_set "descr" "Checks printing to a window"
    130 }
    131 wprintw_body()
    132 {
    133 	h_run wprintw
    134 }
    135 
    136 atf_test_case wscrl
    137 wscrl_head()
    138 {
    139 	atf_set "descr" "Check window scrolling"
    140 }
    141 wscrl_body()
    142 {
    143 	h_run wscrl
    144 }
    145 
    146 atf_test_case mvwin
    147 mvwin_head()
    148 {
    149 	atf_set "descr" "Check moving a window"
    150 }
    151 mvwin_body()
    152 {
    153 	h_run mvwin
    154 }
    155 
    156 atf_test_case getstr
    157 getstr_head()
    158 {
    159 	atf_set "descr" "Check getting a string from input"
    160 }
    161 getstr_body()
    162 {
    163 	h_run getstr
    164 }
    165 
    166 atf_test_case termattrs
    167 termattrs_head()
    168 {
    169 	atf_set "descr" "Check the terminal attributes"
    170 }
    171 termattrs_body()
    172 {
    173 	h_run termattrs
    174 }
    175 
    176 atf_test_case assume_default_colors
    177 assume_default_colors_head()
    178 {
    179 	atf_set "descr" "Check setting the default color pair"
    180 }
    181 assume_default_colors_body()
    182 {
    183 	h_run assume_default_colors
    184 }
    185 
    186 atf_test_case attributes
    187 attributes_head()
    188 {
    189 	atf_set "descr" "Check setting, clearing and getting of attributes"
    190 }
    191 attributes_body()
    192 {
    193 	h_run attributes
    194 }
    195 
    196 atf_test_case beep
    197 beep_head()
    198 {
    199 	atf_set "descr" "Check sending a beep"
    200 }
    201 beep_body()
    202 {
    203 	h_run beep
    204 }
    205 
    206 atf_test_case background
    207 background_head()
    208 {
    209 	atf_set "descr" "Check setting background character and attributes for both stdscr and a window."
    210 }
    211 background_body()
    212 {
    213 	h_run background
    214 }
    215 
    216 atf_test_case can_change_color
    217 can_change_color_head()
    218 {
    219 	atf_set "descr" "Check if the terminal can change colours"
    220 }
    221 can_change_color_body()
    222 {
    223 	h_run can_change_color
    224 }
    225 
    226 atf_test_case cbreak
    227 cbreak_head()
    228 {
    229 	atf_set "descr" "Check cbreak mode works"
    230 }
    231 cbreak_body()
    232 {
    233 	h_run cbreak
    234 }
    235 
    236 atf_test_case chgat
    237 chgat_head()
    238 {
    239 	atf_set "descr" "Check changing attributes works"
    240 }
    241 chgat_body()
    242 {
    243 	h_run chgat
    244 }
    245 
    246 atf_test_case clear
    247 clear_head()
    248 {
    249 	atf_set "descr" "Check clear and erase work"
    250 }
    251 clear_body()
    252 {
    253 	h_run clear
    254 }
    255 
    256 atf_test_case copywin
    257 copywin_head()
    258 {
    259 	atf_set "descr" "Check all the modes of copying a window work"
    260 }
    261 copywin_body()
    262 {
    263 	h_run copywin
    264 }
    265 
    266 atf_test_case curs_set
    267 curs_set_head()
    268 {
    269 	atf_set "descr" "Check setting the cursor visibility works"
    270 }
    271 curs_set_body()
    272 {
    273 	h_run curs_set
    274 }
    275 
    276 atf_test_case define_key
    277 define_key_head()
    278 {
    279 	atf_set "descr" "Check defining a key and removing the definition works"
    280 }
    281 define_key_body()
    282 {
    283 	h_run define_key
    284 }
    285 
    286 atf_test_case delay_output
    287 delay_output_head()
    288 {
    289 	atf_set "descr" "Check that padding is inserted when delaying output"
    290 }
    291 delay_output_body()
    292 {
    293 	h_run delay_output -v
    294 }
    295 
    296 atf_test_case derwin
    297 derwin_head()
    298 {
    299 	atf_set "descr" "Check derived subwindow creation behaves correctly."
    300 }
    301 derwin_body()
    302 {
    303 	h_run derwin
    304 }
    305 
    306 atf_test_case doupdate
    307 doupdate_head()
    308 {
    309 	atf_set "descr" "Check doupdate performs an update"
    310 }
    311 doupdate_body()
    312 {
    313 	h_run doupdate
    314 }
    315 
    316 atf_test_case dupwin
    317 dupwin_head()
    318 {
    319 	atf_set "descr" "Check duplicating a window works"
    320 }
    321 dupwin_body()
    322 {
    323 	h_run dupwin
    324 }
    325 
    326 atf_test_case erasechar
    327 erasechar_head()
    328 {
    329 	atf_set "descr" "Validate erase char can be retrieved"
    330 }
    331 erasechar_body()
    332 {
    333 	h_run erasechar
    334 }
    335 
    336 atf_test_case flash
    337 flash_head()
    338 {
    339 	atf_set "descr" "Validate curses can flash the screen"
    340 }
    341 flash_body()
    342 {
    343 	h_run flash
    344 }
    345 
    346 atf_test_case getattrs
    347 getattrs_head()
    348 {
    349 	atf_set "descr" "Validate curses can get and set attributes on a window"
    350 }
    351 getattrs_body()
    352 {
    353 	h_run getattrs
    354 }
    355 
    356 atf_test_case bkgdset
    357 bkgdset_head()
    358 {
    359 	atf_set "descr" "Validate curses set the background attributes on stdscr"
    360 }
    361 bkgdset_body()
    362 {
    363 	h_run bkgdset
    364 }
    365 
    366 atf_test_case getbkgd
    367 getbkgd_head()
    368 {
    369 	atf_set "descr" "Validate curses getting the background attributes on stdscr"
    370 }
    371 getbkgd_body()
    372 {
    373 	h_run getbkgd
    374 }
    375 
    376 atf_test_case getcurx
    377 getcurx_head()
    378 {
    379 	atf_set "descr" "Validate curses getting cursor locations in a window"
    380 }
    381 getcurx_body()
    382 {
    383 	h_run getcurx
    384 }
    385 
    386 atf_test_case getmaxx
    387 getmaxx_head()
    388 {
    389 	atf_set "descr" "Validate curses getting the maximum x value of a window"
    390 }
    391 getmaxx_body()
    392 {
    393 	h_run getmaxx
    394 }
    395 
    396 atf_test_case getmaxy
    397 getmaxy_head()
    398 {
    399 	atf_set "descr" "Validate curses getting the maximum y value of a window"
    400 }
    401 getmaxy_body()
    402 {
    403 	h_run getmaxy
    404 }
    405 
    406 atf_test_case getnstr
    407 getnstr_head()
    408 {
    409 	atf_set "descr" "Check getting a string with a limit"
    410 }
    411 getnstr_body()
    412 {
    413 	h_run getnstr
    414 }
    415 
    416 atf_test_case getparx
    417 getparx_head()
    418 {
    419 	atf_set "descr" "Check getting the location of a window relative to its parent"
    420 }
    421 getparx_body()
    422 {
    423 	h_run getparx
    424 }
    425 
    426 atf_test_case has_colors
    427 has_colors_head()
    428 {
    429 	atf_set "descr" "Check if the terminal can support colours"
    430 }
    431 has_colors_body()
    432 {
    433 	h_run has_colors
    434 }
    435 
    436 atf_test_case has_ic
    437 has_ic_head()
    438 {
    439 	atf_set "descr" "Check if the terminal can insert characters and lines"
    440 }
    441 has_ic_body()
    442 {
    443 	h_run has_ic
    444 }
    445 
    446 atf_test_case hline
    447 hline_head()
    448 {
    449 	atf_set "descr" "Draw a horizontal line"
    450 }
    451 hline_body()
    452 {
    453 	h_run hline
    454 }
    455 
    456 atf_test_case inch
    457 inch_head()
    458 {
    459 	atf_set "descr" "Get the character under the cursor on stdscr"
    460 }
    461 inch_body()
    462 {
    463 	h_run inch
    464 }
    465 
    466 atf_test_case inchnstr
    467 inchnstr_head()
    468 {
    469 	atf_set "descr" "Get a limited chtype string from the screen"
    470 }
    471 inchnstr_body()
    472 {
    473 	h_run inchnstr
    474 }
    475 
    476 atf_test_case init_color
    477 init_color_head()
    478 {
    479 	atf_set "descr" "Set a custom color entry"
    480 }
    481 init_color_body()
    482 {
    483 	h_run init_color
    484 }
    485 
    486 atf_test_case innstr
    487 innstr_head()
    488 {
    489 	atf_set "descr" "Get a limited string starting at the cursor"
    490 }
    491 innstr_body()
    492 {
    493 	h_run innstr
    494 }
    495 
    496 atf_test_case is_linetouched
    497 is_linetouched_head()
    498 {
    499 	atf_set "descr" "Check if a line has been modified in a window"
    500 }
    501 is_linetouched_body()
    502 {
    503 	h_run is_linetouched
    504 }
    505 
    506 atf_test_case is_wintouched
    507 is_wintouched_head()
    508 {
    509 	atf_set "descr" "Check if a window has been modified"
    510 }
    511 is_wintouched_body()
    512 {
    513 	h_run is_wintouched
    514 }
    515 
    516 atf_test_case keyname
    517 keyname_head()
    518 {
    519 	atf_set "descr" "Convert integers into printable key names"
    520 }
    521 keyname_body()
    522 {
    523 	h_run keyname
    524 }
    525 
    526 atf_test_case keyok
    527 keyok_head()
    528 {
    529 	atf_set "descr" "Check the ability to disable interpretation of a multichar key sequence"
    530 }
    531 keyok_body()
    532 {
    533 	h_run keyok
    534 }
    535 
    536 atf_test_case killchar
    537 killchar_head()
    538 {
    539 	atf_set "descr" "Get the value of the terminals kill character"
    540 }
    541 killchar_body()
    542 {
    543 	h_run killchar
    544 }
    545 
    546 atf_test_case meta
    547 meta_head()
    548 {
    549 	atf_set "descr" "Check setting and clearing the meta flag on a window"
    550 }
    551 meta_body()
    552 {
    553 	h_run meta
    554 }
    555 
    556 atf_test_case mvaddch
    557 mvaddch_head()
    558 {
    559 	atf_set "descr" "Move the cursor and add a character to stdscr"
    560 }
    561 mvaddch_body()
    562 {
    563 	h_run mvaddch
    564 }
    565 
    566 atf_test_case mvaddchnstr
    567 mvaddchnstr_head()
    568 {
    569 	atf_set "descr" "Move the cursor and add a character string to stdscr"
    570 }
    571 mvaddchnstr_body()
    572 {
    573 	h_run mvaddchnstr
    574 }
    575 
    576 atf_test_case mvaddchstr
    577 mvaddchstr_head()
    578 {
    579 	atf_set "descr" "Move the cursor and add a ch string to stdscr"
    580 }
    581 mvaddchstr_body()
    582 {
    583 	h_run mvaddchstr
    584 }
    585 
    586 atf_test_case mvaddnstr
    587 mvaddnstr_head()
    588 {
    589 	atf_set "descr" "Move the cursor and add a limited string to stdscr"
    590 }
    591 mvaddnstr_body()
    592 {
    593 	h_run mvaddnstr
    594 }
    595 
    596 atf_test_case mvaddstr
    597 mvaddstr_head()
    598 {
    599 	atf_set "descr" "Move the cursor and add a string to stdscr"
    600 }
    601 mvaddstr_body()
    602 {
    603 	h_run mvaddstr
    604 }
    605 
    606 atf_test_case mvchgat
    607 mvchgat_head()
    608 {
    609 	atf_set "descr" "Change the attributes on the screen"
    610 }
    611 mvchgat_body()
    612 {
    613 	h_run mvchgat
    614 }
    615 
    616 atf_test_case mvcur
    617 mvcur_head()
    618 {
    619 	atf_set "descr" "Move the cursor on the screen"
    620 }
    621 mvcur_body()
    622 {
    623 	h_run mvcur
    624 }
    625 
    626 atf_test_case mvderwin
    627 mvderwin_head()
    628 {
    629 	atf_set "descr" "Move the mapping of a region relative to the parent"
    630 }
    631 mvderwin_body()
    632 {
    633 	h_run mvderwin
    634 }
    635 
    636 atf_test_case mvgetnstr
    637 mvgetnstr_head()
    638 {
    639 	atf_set "descr" "Move the cursor and get a limited number of characters"
    640 }
    641 mvgetnstr_body()
    642 {
    643 	h_run mvgetnstr
    644 }
    645 
    646 atf_test_case mvgetstr
    647 mvgetstr_head()
    648 {
    649 	atf_set "descr" "Move the cursor and get characters"
    650 }
    651 mvgetstr_body()
    652 {
    653 	h_run mvgetstr
    654 }
    655 
    656 atf_test_case mvhline
    657 mvhline_head()
    658 {
    659 	atf_set "descr" "Move the cursor and draw a horizontal line"
    660 }
    661 mvhline_body()
    662 {
    663 	h_run mvhline
    664 }
    665 
    666 atf_test_case mvinchnstr
    667 mvinchnstr_head()
    668 {
    669 	atf_set "descr" "Move the cursor read characters - tests both mvinchstr and mvinchnstr"
    670 }
    671 mvinchnstr_body()
    672 {
    673 	h_run mvinchnstr
    674 }
    675 
    676 atf_test_case mvprintw
    677 mvprintw_head()
    678 {
    679 	atf_set "descr" "Move the cursor and print a string"
    680 }
    681 mvprintw_body()
    682 {
    683 	h_run mvprintw
    684 }
    685 
    686 atf_test_case mvscanw
    687 mvscanw_head()
    688 {
    689 	atf_set "descr" "Move the cursor and scan for input patterns"
    690 }
    691 mvscanw_body()
    692 {
    693 	h_run mvscanw
    694 }
    695 
    696 atf_test_case mvvline
    697 mvvline_head()
    698 {
    699 	atf_set "descr" "Move the cursor and draw a vertical line"
    700 }
    701 mvvline_body()
    702 {
    703 	h_run mvvline
    704 }
    705 
    706 atf_test_case pad
    707 pad_head()
    708 {
    709 	atf_set "descr" "Test the newpad, subpad, pnoutrefresh and prefresh functions"
    710 }
    711 pad_body()
    712 {
    713 	h_run pad
    714 }
    715 
    716 atf_test_case nocbreak
    717 nocbreak_head()
    718 {
    719 	atf_set "descr" "Test that the nocbreak call returns the terminal to canonical character processing"
    720 }
    721 nocbreak_body()
    722 {
    723 	h_run nocbreak
    724 }
    725 
    726 atf_test_case nodelay
    727 nodelay_head()
    728 {
    729 	atf_set "descr" "Test that the nodelay call causes wget to not block"
    730 }
    731 nodelay_body()
    732 {
    733 	h_run nodelay
    734 }
    735 
    736 atf_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  # comment out for now - return is wrong
    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 # not working
    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 # not working
    806 	atf_add_test_case mvvline
    807 #	atf_add_test_case pad # not working
    808 	atf_add_test_case nocbreak
    809 	atf_add_test_case nodelay
    810 }
    811 
    812