@@ -32,7 +32,7 @@ print_intro = do
3232 putStr $ [$heredoc|
3333This is an interactive verification program for the terminal input and output
3434support of the VTY library. This will ask a series of questions about what you
35−see onscreen. The goal is to verify that VTY's output and input support
35+see on screen. The goal is to verify that VTY's output and input support
3636performs as expected with your terminal.
3737
3838This program produces a file named
@@ -43,7 +43,7 @@ support for your terminal. No personal information is contained in the report.
4343
4444Each test follows, more or less, the following format:
4545 0. A description of the test is printed which will include a detailed
46− description of what VTY is going to try and what the expected results are.
46+ description of what VTY is going to try and what the expected results are.
4747 Press return to move on.
4848 1. The program will produce some output or ask for you to press a key.
4949 2. You will then be asked to confirm if the behavior matched the provided
@@ -62,15 +62,24 @@ All the tests assume the following about the terminal display:
6262 a good range of the unicode characters. Each test involving unicode display
6363 describes the expected appearance of each glyph.
6464
65−Thanks for the help! :-D
65+Thanks for the help! :-D
66+To exit the test early enter "q" anytime at the following menu screen. Even if
67+you exit the test early please email the test_results.list file to
68+coreyoconnor@gmail.com. The results file will still contain information useful
69+to debug terminal support.
70+
6671|]
6772 wait_for_return
6873 results <- do_test_menu 1
6974 env_attributes <- mapM ( \env_name -> catch ( Env.getEnv env_name >>= return . (,) env_name )
7075 ( const $ return (env_name, "") )
7176 )
72− [ "TERM", "COLORTERM", "LANG" ]
73− let results_txt = show env_attributes ++ "\n" ++ show results ++ "\n"
77+ [ "TERM", "COLORTERM", "LANG", "TERM_PROGRAM", "XTERM_VERSION" ]
78+ t <- terminal_handle
79+ let results_txt = show env_attributes ++ "\n"
80+ ++ terminal_ID t ++ "\n"
81+ ++ show results ++ "\n"
82+ release_terminal t
7483 writeFile output_file_path results_txt
7584
7685wait_for_return = do
@@ -179,11 +188,11 @@ reserve_output_test = Test
179188 , print_summary = do
180189 putStr $ [$heredoc|
181190Once return is pressed:
182−The screen will be cleared.
183−The cursor should be visible and at the top left corner.
184−Four lines of text should be visible.
191+ 0. The screen will be cleared.
192+ 1. Four lines of text should be visible.
193+ 1. The cursor should be visible and at the start of the fifth line.
185194
186−After enter is pressed for the second time this test then:
195+After return is pressed for the second time this test then:
187196 * The screen containing the test summary should be restored;
188197 * The cursor is visible.
189198|]
@@ -377,6 +386,7 @@ unicode_single_width_0 = Test
377386 , test_action = do
378387 t <- terminal_handle
379388 reserve_display t
389+ hide_cursor t
380390 withArrayLen (concat utf8_txt_0) (flip $ hPutBuf stdout)
381391 hPutStr stdout "\n"
382392 hPutStr stdout "0123456789\n"
@@ -458,6 +468,7 @@ unicode_double_width_0 = Test
458468 , test_action = do
459469 t <- terminal_handle
460470 reserve_display t
471+ hide_cursor t
461472 withArrayLen (concat utf8_txt_1) (flip $ hPutBuf stdout)
462473 hPutStr stdout "\n"
463474 hPutStr stdout "012345\n"
@@ -517,8 +528,12 @@ After return is pressed for the second time:
517528 1. The cursor should be visible.
518529|]
519530
520−all_colors = zip [ black, red, green, yellow, blue, magenta, cyan, white, def ]
521− [ "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default" ]
531+all_colors = zip [ black, red, green, yellow, blue, magenta, cyan, white ]
532+ [ "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" ]
533+
534+all_bright_colors
535+ = zip [ bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white ]
536+ [ "bright black", "bright red", "bright green", "bright yellow", "bright blue", "bright magenta", "bright cyan", "bright white" ]
522537
523538attributes_test_0 = Test
524539 { test_name = "Character attributes: foreground colors."
@@ -531,7 +546,7 @@ attributes_test_0 = Test
531546 column_0 = vert_cat $ map line_with_color all_colors
532547 border = vert_cat $ replicate (length all_colors) $ string def_attr " | "
533548 column_1 = vert_cat $ map (string def_attr . snd) all_colors
534− line_with_color (c_value, c_name) = string (setFG c_value def_attr) c_name
549+ line_with_color (c, c_name) = string (def_attr `with_fore_color` c) c_name
535550 d <- display_bounds t >>= display_context t
536551 output_picture d pic
537552 getLine
@@ -577,7 +592,7 @@ attributes_test_1 = Test
577592 column_0 = vert_cat $ map line_with_color all_colors
578593 border = vert_cat $ replicate (length all_colors) $ string def_attr " | "
579594 column_1 = vert_cat $ map (string def_attr . snd) all_colors
580− line_with_color (c_value, c_name) = string (setBG c_value def_attr) c_name
595+ line_with_color (c, c_name) = string (def_attr `with_back_color` c) c_name
581596 d <- display_bounds t >>= display_context t
582597 output_picture d pic
583598 getLine
@@ -592,7 +607,7 @@ Once return is pressed:
592607 2. 9 lines of text in two columns will be drawn. The first column will
593608 contain be a name of a standard color for an 8 color terminal rendered with
594609 the default foreground color with a background the named color. For
595− instance, one line will contain be the word "magenta" and that words should
610+ instance, one line will contain be the word "magenta" and the word should
596611 be rendered in the default foreground color over a magenta background. The
597612 second column will be the name of a standard color rendered with the default
598613 attributes.
@@ -631,10 +646,10 @@ attributes_test_2 = Test
631646 image = horiz_cat [border, column_0, border, column_1, border, column_2, border]
632647 border = vert_cat $ replicate (length all_colors) $ string def_attr " | "
633648 column_0 = vert_cat $ map line_with_color_0 all_colors
634− column_1 = vert_cat $ map line_with_color_1 all_colors
649+ column_1 = vert_cat $ map line_with_color_1 all_bright_colors
635650 column_2 = vert_cat $ map (string def_attr . snd) all_colors
636− line_with_color_0 (c_value, c_name) = string (setFG c_value def_attr) c_name
637− line_with_color_1 (c_value, c_name) = string (setFGVivid c_value def_attr) c_name
651+ line_with_color_0 (c, c_name) = string (def_attr `with_fore_color` c) c_name
652+ line_with_color_1 (c, c_name) = string (def_attr `with_fore_color` c) c_name
638653 d <- display_bounds t >>= display_context t
639654 output_picture d pic
640655 getLine
@@ -681,7 +696,7 @@ Did the test output match the description?
681696 }
682697
683698attributes_test_3 = Test
684− { test_name = "Character attributes: vivid background colors."
699+ { test_name = "Character attributes: Vivid background colors."
685700 , test_ID = "attributes_test_3"
686701 , test_action = do
687702 t <- terminal_handle
@@ -690,10 +705,10 @@ attributes_test_3 = Test
690705 image = horiz_cat [border, column_0, border, column_1, border, column_2, border]
691706 border = vert_cat $ replicate (length all_colors) $ string def_attr " | "
692707 column_0 = vert_cat $ map line_with_color_0 all_colors
693− column_1 = vert_cat $ map line_with_color_1 all_colors
708+ column_1 = vert_cat $ map line_with_color_1 all_bright_colors
694709 column_2 = vert_cat $ map (string def_attr . snd) all_colors
695− line_with_color_0 (c_value, c_name) = string (setBG c_value def_attr) c_name
696− line_with_color_1 (c_value, c_name) = string (setBGVivid c_value def_attr) c_name
710+ line_with_color_0 (c, c_name) = string (def_attr `with_back_color` c) c_name
711+ line_with_color_1 (c, c_name) = string (def_attr `with_back_color` c) c_name
697712 d <- display_bounds t >>= display_context t
698713 output_picture d pic
699714 getLine
@@ -715,7 +730,7 @@ Once return is pressed:
715730 c. The third column will be the name of a standard color rendered with
716731 the default attributes.
717732
718−For instance, one line will contain be the word "magenta" and that words should
733+For instance, one line will contain be the word "magenta" and the word should
719734be rendered in the default foreground color over a magenta background.
720735
721736I'm not actually sure exactly what "vivid" means in this context. For xterm the
@@ -748,14 +763,14 @@ Did the test output match the description?
748763 }
749764
750765attr_combos =
751− [ ("default", id)
752− , ("bold", setBold)
753− , ("blink", setBlink)
754− , ("underline", setUnderline)
755− , ("bold + blink", setBlink . setBold)
756− , ("bold + underline", setUnderline . setBold)
757− , ("underline + blink", setBlink . setUnderline)
758− , ("bold + blink + underline", setUnderline . setBlink . setBold)
766+ [ ( "default", id )
767+ , ( "bold", flip with_style bold )
768+ , ( "blink", flip with_style blink )
769+ , ( "underline", flip with_style underline )
770+ , ( "bold + blink", flip with_style (bold + blink) )
771+ , ( "bold + underline", flip with_style (bold + underline) )
772+ , ( "underline + blink", flip with_style (underline + blink) )
773+ , ( "bold + blink + underline", flip with_style (bold + blink + underline) )
759774 ]
760775
761776attributes_test_4 = Test