@@ -19,7 +19,7 @@ import Data.Monoid
19import Data.String.QQ
19import Data.String.QQ
20import Data.Word
20import Data.Word
22−import Foreign.Marshal.Array
22+import Foreign.Marshal.Array
24import qualified System.Environment as Env
24import qualified System.Environment as Env
@@ -74,12 +74,12 @@ with the test_results.list file pasted into the issue. A suitable summary is:
75 waitForReturn
75 waitForReturn
76 results <- doTestMenu 1
76 results <- doTestMenu 1
77− envAttributes <- mapM ( \envName -> Control.Exception.catch ( Env.getEnv envName >>= return . (,) envName )
77+ envAttributes <- mapM ( \envName -> Control.Exception.catch ( Env.getEnv envName >>= return . (,) envName )
78− ( \ (_ :: SomeException) -> return (envName, "") )
78+ ( \ (_ :: SomeException) -> return (envName, "") )
80 [ "TERM", "COLORTERM", "LANG", "TERM_PROGRAM", "XTERM_VERSION" ]
80 [ "TERM", "COLORTERM", "LANG", "TERM_PROGRAM", "XTERM_VERSION" ]
81 t <- standardIOConfig >>= outputForConfig
81 t <- standardIOConfig >>= outputForConfig
82− let resultsTxt = show envAttributes ++ "\n"
82+ let resultsTxt = show envAttributes ++ "\n"
83 ++ terminalID t ++ "\n"
83 ++ terminalID t ++ "\n"
84 ++ show results ++ "\n"
84 ++ show results ++ "\n"
85 releaseTerminal t
85 releaseTerminal t
@@ -94,7 +94,7 @@ testMenu :: [(String, Test)]
94testMenu = zip (map show [1..]) allTests
94testMenu = zip (map show [1..]) allTests
96doTestMenu :: Int -> IO [(String, Bool)]
96doTestMenu :: Int -> IO [(String, Bool)]
97−doTestMenu nextID
97+doTestMenu nextID
98 | nextID > length allTests = do
98 | nextID > length allTests = do
99 putStrLn $ "Done! Please email the " ++ outputFilePath ++ " file to coreyoconnor@gmail.com"
99 putStrLn $ "Done! Please email the " ++ outputFilePath ++ " file to coreyoconnor@gmail.com"
100 return []
100 return []
@@ -108,26 +108,26 @@ doTestMenu nextID
108 s <- getLine >>= return . filter (/= '\n')
108 s <- getLine >>= return . filter (/= '\n')
109 case s of
109 case s of
110 "q" -> return mempty
110 "q" -> return mempty
111− "" -> do
111+ "" -> do
112− r <- runTest $ show nextID
112+ r <- runTest $ show nextID
113 rs <- doTestMenu ( nextID + 1 )
113 rs <- doTestMenu ( nextID + 1 )
114 return $ r : rs
114 return $ r : rs
115 i | isJust ( lookup i testMenu ) -> do
115 i | isJust ( lookup i testMenu ) -> do
116− r <- runTest i
116+ r <- runTest i
117 rs <- doTestMenu ( read i + 1 )
117 rs <- doTestMenu ( read i + 1 )
118 return $ r : rs
118 return $ r : rs
120− displayTestMenu
120+ displayTestMenu
121 = mapM_ displayTestMenu' testMenu
121 = mapM_ displayTestMenu' testMenu
122− displayTestMenu' ( i, t )
122+ displayTestMenu' ( i, t )
123− = putStrLn $ ( if i == show nextID
123+ = putStrLn $ ( if i == show nextID
124− then "> "
124+ then "> "
126 ) ++ i ++ ". " ++ testName t
126 ) ++ i ++ ". " ++ testName t
128runTest :: String -> IO (String, Bool)
128runTest :: String -> IO (String, Bool)
129runTest i = do
129runTest i = do
130− let t = fromJust $ lookup i testMenu
130+ let t = fromJust $ lookup i testMenu
131 printSummary t
131 printSummary t
132 waitForReturn
132 waitForReturn
133 testAction t
133 testAction t
@@ -153,8 +153,8 @@ data Test = Test
153 , confirmResults :: IO Bool
153 , confirmResults :: IO Bool
156−allTests
156+allTests
157− = [ reserveOutputTest
157+ = [ reserveOutputTest
158 , displayBoundsTest0
158 , displayBoundsTest0
159 , displayBoundsTest1
159 , displayBoundsTest1
160 , displayBoundsTest2
160 , displayBoundsTest2
@@ -185,7 +185,7 @@ allTests
188−reserveOutputTest = Test
188+reserveOutputTest = Test
189 { testName = "Initialize and reserve terminal output then restore previous state."
189 { testName = "Initialize and reserve terminal output then restore previous state."
190 , testID = "reserveOutputTest"
190 , testID = "reserveOutputTest"
191 , testAction = do
191 , testAction = do
@@ -203,7 +203,7 @@ reserveOutputTest = Test
203 , printSummary = do
203 , printSummary = do
204 putStr $ [s|
204 putStr $ [s|
205Once return is pressed:
205Once return is pressed:
206− 0. The screen will be cleared.
206+ 0. The screen will be cleared.
207 1. Four lines of text should be visible.
207 1. Four lines of text should be visible.
208 1. The cursor should be visible and at the start of the fifth line.
208 1. The cursor should be visible and at the start of the fifth line.
@@ -391,7 +391,7 @@ utf8Txt0 = [ [ 0xe2 , 0x86 , 0x91 ]
392iso10646Txt0 :: String
392iso10646Txt0 :: String
393iso10646Txt0 = map toEnum
393iso10646Txt0 = map toEnum
@@ -554,11 +554,11 @@ After return is pressed for the second time:
554allColors = zip [ black, red, green, yellow, blue, magenta, cyan, white ]
554allColors = zip [ black, red, green, yellow, blue, magenta, cyan, white ]
555 [ "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" ]
555 [ "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" ]
557−allBrightColors
557+allBrightColors
558 = zip [ brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite ]
558 = zip [ brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite ]
559 [ "bright black", "bright red", "bright green", "bright yellow", "bright blue", "bright magenta", "bright cyan", "bright white" ]
559 [ "bright black", "bright red", "bright green", "bright yellow", "bright blue", "bright magenta", "bright cyan", "bright white" ]
561−attributesTest0 = Test
561+attributesTest0 = Test
562 { testName = "Character attributes: foreground colors."
562 { testName = "Character attributes: foreground colors."
563 , testID = "attributesTest0"
563 , testID = "attributesTest0"
564 , testAction = do
564 , testAction = do
@@ -604,7 +604,7 @@ Did the test output match the description?
604 defaultSuccessConfirmResults
604 defaultSuccessConfirmResults
607−attributesTest1 = Test
607+attributesTest1 = Test
608 { testName = "Character attributes: background colors."
608 { testName = "Character attributes: background colors."
609 , testID = "attributesTest1"
609 , testID = "attributesTest1"
610 , testAction = do
610 , testAction = do
@@ -659,7 +659,7 @@ Did the test output match the description?
659 defaultSuccessConfirmResults
659 defaultSuccessConfirmResults
662−attributesTest2 = Test
662+attributesTest2 = Test
663 { testName = "Character attributes: Vivid foreground colors."
663 { testName = "Character attributes: Vivid foreground colors."
664 , testID = "attributesTest2"
664 , testID = "attributesTest2"
665 , testAction = do
665 , testAction = do
@@ -686,23 +686,23 @@ Once return is pressed:
686 1. The cursor will be hidden.
686 1. The cursor will be hidden.
687 2. 9 lines of text in three columns will be drawn:
687 2. 9 lines of text in three columns will be drawn:
688 a. The first column will be a name of a standard color (for an 8 color
688 a. The first column will be a name of a standard color (for an 8 color
689− terminal) rendered with that color as the foreground color.
689+ terminal) rendered with that color as the foreground color.
690 b. The next column will be also be the name of a standard color rendered
690 b. The next column will be also be the name of a standard color rendered
691 with that color as the foreground color but the shade used should be
691 with that color as the foreground color but the shade used should be
692− more vivid than the shade used in the first column.
692+ more vivid than the shade used in the first column.
693 c. The final column will be the name of a color rendered with the
693 c. The final column will be the name of a color rendered with the
694 default attributes.
694 default attributes.
696For instance, one line will be the word "magenta" and that word should be
696For instance, one line will be the word "magenta" and that word should be
697−rendered in the magenta color.
697+rendered in the magenta color.
699I'm not actually sure exactly what "vivid" means in this context. For xterm the
699I'm not actually sure exactly what "vivid" means in this context. For xterm the
700−vivid colors are brighter.
700+vivid colors are brighter.
703 * The first column: The foreground color matches the named color.
703 * The first column: The foreground color matches the named color.
704 * The second column: The foreground color matches the named color but is
704 * The second column: The foreground color matches the named color but is
705− more vivid than the color used in the first column.
705+ more vivid than the color used in the first column.
706 * The third column: All text is rendered with the default attributes.
706 * The third column: All text is rendered with the default attributes.
707 * The vertical bars used in each line to mark the border of a column are
707 * The vertical bars used in each line to mark the border of a column are
708 lined up.
708 lined up.
@@ -718,7 +718,7 @@ Did the test output match the description?
718 defaultSuccessConfirmResults
718 defaultSuccessConfirmResults
721−attributesTest3 = Test
721+attributesTest3 = Test
722 { testName = "Character attributes: Vivid background colors."
722 { testName = "Character attributes: Vivid background colors."
723 , testID = "attributesTest3"
723 , testID = "attributesTest3"
724 , testAction = do
724 , testAction = do
@@ -746,23 +746,23 @@ Once return is pressed:
746 2. 9 lines of text in three columns will be drawn:
746 2. 9 lines of text in three columns will be drawn:
747 a. The first column will contain be a name of a standard color for an 8
747 a. The first column will contain be a name of a standard color for an 8
748 color terminal rendered with the default foreground color with a
748 color terminal rendered with the default foreground color with a
749− background the named color.
749+ background the named color.
750 b. The first column will contain be a name of a standard color for an 8
750 b. The first column will contain be a name of a standard color for an 8
751 color terminal rendered with the default foreground color with the
751 color terminal rendered with the default foreground color with the
752− background a vivid version of the named color.
752+ background a vivid version of the named color.
753 c. The third column will be the name of a standard color rendered with
753 c. The third column will be the name of a standard color rendered with
754 the default attributes.
754 the default attributes.
756For instance, one line will contain be the word "magenta" and the word should
756For instance, one line will contain be the word "magenta" and the word should
757−be rendered in the default foreground color over a magenta background.
757+be rendered in the default foreground color over a magenta background.
759I'm not actually sure exactly what "vivid" means in this context. For xterm the
759I'm not actually sure exactly what "vivid" means in this context. For xterm the
760vivid colors are brighter.
760vivid colors are brighter.
763 * The first column: The background color matches the named color.
763 * The first column: The background color matches the named color.
764 * The second column: The background color matches the named color and is
764 * The second column: The background color matches the named color and is
765− more vivid than the color used in the first column.
765+ more vivid than the color used in the first column.
766 * The third column column: All text is rendered with the default attributes.
766 * The third column column: All text is rendered with the default attributes.
767 * The vertical bars used in each line to mark the border of a column are
767 * The vertical bars used in each line to mark the border of a column are
768 lined up.
768 lined up.
@@ -785,7 +785,7 @@ Did the test output match the description?
785 defaultSuccessConfirmResults
785 defaultSuccessConfirmResults
788−attrCombos =
788+attrCombos =
789 [ ( "default", id )
789 [ ( "default", id )
790 , ( "bold", flip withStyle bold )
790 , ( "bold", flip withStyle bold )
791 , ( "blink", flip withStyle blink )
791 , ( "blink", flip withStyle blink )
@@ -796,7 +796,7 @@ attrCombos =
796 , ( "bold + blink + underline", flip withStyle (bold + blink + underline) )
796 , ( "bold + blink + underline", flip withStyle (bold + blink + underline) )
799−attributesTest4 = Test
799+attributesTest4 = Test
800 { testName = "Character attributes: Bold; Blink; Underline."
800 { testName = "Character attributes: Bold; Blink; Underline."
801 , testID = "attributesTest4"
801 , testID = "attributesTest4"
802 , testAction = do
802 , testAction = do
@@ -819,10 +819,10 @@ attributesTest4 = Test
819Once return is pressed:
819Once return is pressed:
820 0. The screen will be cleared.
820 0. The screen will be cleared.
821 1. The cursor will be hidden.
821 1. The cursor will be hidden.
822− 2. 8 rows of text in two columns.
822+ 2. 8 rows of text in two columns.
823 The rows will contain the following text:
823 The rows will contain the following text:
827 underline
827 underline
828 bold + blink
828 bold + blink
@@ -831,8 +831,8 @@ Once return is pressed:
831 bold + blink + underline
831 bold + blink + underline
832 The first column will be rendered with the described attributes. The second
832 The first column will be rendered with the described attributes. The second
833 column will be rendered with the default attributes.
833 column will be rendered with the default attributes.
836 * The vertical bars used in each line to mark the border of a column are
836 * The vertical bars used in each line to mark the border of a column are
837 lined up.
837 lined up.
838 * The text in the first column is rendered as described.
838 * The text in the first column is rendered as described.
@@ -848,7 +848,7 @@ Did the test output match the description?
848 defaultSuccessConfirmResults
848 defaultSuccessConfirmResults
851−attributesTest5 = Test
851+attributesTest5 = Test
852 { testName = "Character attributes: 240 color palette"
852 { testName = "Character attributes: 240 color palette"
853 , testID = "attributesTest5"
853 , testID = "attributesTest5"
854 , testAction = do
854 , testAction = do
@@ -873,7 +873,7 @@ Once return is pressed:
873 2. A 20 character wide and 12 row high block of color squares. This should look like a palette
873 2. A 20 character wide and 12 row high block of color squares. This should look like a palette
874 of some sort. I'm not exactly sure if all color terminals use the same palette. I doubt it...
874 of some sort. I'm not exactly sure if all color terminals use the same palette. I doubt it...
878After return is pressed for the second time:
878After return is pressed for the second time:
879 0. The screen containing the test summary should be restored.
879 0. The screen containing the test summary should be restored.
@@ -971,7 +971,7 @@ outputPicAndWait pic = do
971 releaseDisplay t
971 releaseDisplay t
972 releaseTerminal t
972 releaseTerminal t
973 return ()
973 return ()
975vertCropTest0 :: Test
975vertCropTest0 :: Test
976vertCropTest0 = Test
976vertCropTest0 = Test
977 { testName = "Verify bottom cropping works as expected with single column chars"
977 { testName = "Verify bottom cropping works as expected with single column chars"
@@ -1046,7 +1046,7 @@ horizCropTest0 = Test
1046 , testID = "cropTest0"
1046 , testID = "cropTest0"
1047 , testAction = do
1047 , testAction = do
1048 let baseImage = vertCat $ map (string defAttr) lorumIpsum
1048 let baseImage = vertCat $ map (string defAttr) lorumIpsum
1049− croppedImage = cropRight (imageWidth baseImage `div` 2) baseImage
1049+ croppedImage = cropRight (imageWidth baseImage `div` 2) baseImage
1050 image = baseImage <-> backgroundFill 10 2 <-> croppedImage
1050 image = baseImage <-> backgroundFill 10 2 <-> croppedImage
1051 outputImageAndWait image
1051 outputImageAndWait image
1052 , printSummary = putStr $ [s|
1052 , printSummary = putStr $ [s|
@@ -1063,7 +1063,7 @@ horizCropTest1 = Test
1063 , testID = "cropTest0"
1063 , testID = "cropTest0"
1064 , testAction = do
1064 , testAction = do
1065 let baseImage = vertCat $ map (string defAttr) lorumIpsumChinese
1065 let baseImage = vertCat $ map (string defAttr) lorumIpsumChinese
1066− croppedImage = cropRight (imageWidth baseImage `div` 2) baseImage
1066+ croppedImage = cropRight (imageWidth baseImage `div` 2) baseImage
1067 image = baseImage <-> backgroundFill 10 2 <-> croppedImage
1067 image = baseImage <-> backgroundFill 10 2 <-> croppedImage
1068 outputImageAndWait image
1068 outputImageAndWait image
1069 , printSummary = putStr $ [s|
1069 , printSummary = putStr $ [s|
@@ -1080,7 +1080,7 @@ horizCropTest2 = Test
1080 , testID = "cropTest0"
1080 , testID = "cropTest0"
1081 , testAction = do
1081 , testAction = do
1082 let baseImage = vertCat $ map (string defAttr) lorumIpsum
1082 let baseImage = vertCat $ map (string defAttr) lorumIpsum
1083− croppedImage = cropLeft (imageWidth baseImage `div` 2) baseImage
1083+ croppedImage = cropLeft (imageWidth baseImage `div` 2) baseImage
1084 image = baseImage <-> backgroundFill 10 2 <-> croppedImage
1084 image = baseImage <-> backgroundFill 10 2 <-> croppedImage
1085 outputImageAndWait image
1085 outputImageAndWait image
1086 , printSummary = putStr $ [s|
1086 , printSummary = putStr $ [s|
@@ -1097,7 +1097,7 @@ horizCropTest3 = Test
1097 , testID = "cropTest0"
1097 , testID = "cropTest0"
1098 , testAction = do
1098 , testAction = do
1099 let baseImage = vertCat $ map (string defAttr) lorumIpsumChinese
1099 let baseImage = vertCat $ map (string defAttr) lorumIpsumChinese
1100− croppedImage = cropLeft (imageWidth baseImage `div` 2) baseImage
1100+ croppedImage = cropLeft (imageWidth baseImage `div` 2) baseImage
1101 image = baseImage <-> backgroundFill 10 2 <-> croppedImage
1101 image = baseImage <-> backgroundFill 10 2 <-> croppedImage
1102 outputImageAndWait image
1102 outputImageAndWait image
1103 , printSummary = putStr $ [s|
1103 , printSummary = putStr $ [s|