on master help sign in
fix QuickCheck dependency. add interactive-terminal-test to executables section. add test for issue 7
commit8211ead8d5d405cab9c379d30b6b5a899c458671 authorCorey O'Connor <corey@ooyala.com> dateWed 26 Dec 2012, 16:40 (14 years ago) parentb07daca
2 files changed+69−15
test/interactive_terminal_test.hs+26−1 vty.cabal+43−14
test/interactive_terminal_test.hs+26−1
@@ -2,12 +2,14 @@
22{-# LANGUAGE ScopedTypeVariables #-}
33module Main where
44
5+import Graphics.Vty
56import Graphics.Vty.Attributes
67import Graphics.Vty.Inline
78import Graphics.Vty.Picture
89import Graphics.Vty.Terminal
910import Graphics.Vty.DisplayRegion
1011
12+import Control.Exception
1113import Control.Monad
1214
1315import Data.List ( lookup )
@@ -71,7 +73,7 @@ to debug terminal support.
7173 wait_for_return
7274 results <- do_test_menu 1
7375 env_attributes <- mapM ( \env_name -> catch ( Env.getEnv env_name >>= return . (,) env_name )
74− ( const $ return (env_name, "") )
76+ ( \ (_ :: SomeException) -> return (env_name, "") )
7577 )
7678 [ "TERM", "COLORTERM", "LANG", "TERM_PROGRAM", "XTERM_VERSION" ]
7779 t <- terminal_handle
@@ -168,6 +170,7 @@ all_tests
168170 , inline_test_0
169171 , inline_test_1
170172 , inline_test_2
173+ , cursor_hide_test_0
171174 ]
172175
173176reserve_output_test = Test
@@ -920,7 +923,29 @@ inline_test_2 = Test
920923 return ()
921924 , print_summary = putStr $ [s|
922925|]
926+ , confirm_results = generic_output_match_confirm
927+ }
923928
929+cursor_hide_test_0 :: Test
930+cursor_hide_test_0 = Test
931+ { test_name = "Verify the cursor is hid and re-shown. issue #7"
932+ , test_ID = "cursor_hide_test_0"
933+ , test_action = do
934+ vty <- mkVty
935+ show_cursor $ terminal vty
936+ set_cursor_pos (terminal vty) 5 5
937+ next_event vty
938+ hide_cursor $ terminal vty
939+ next_event vty
940+ shutdown vty
941+ return ()
942+ , print_summary = putStr $ [s|
943+ 1. verify the cursor is displayed.
944+ 2. press enter
945+ 3. verify the cursor is hid.
946+ 4. press enter.
947+ 5. the display should return to the state before the test.
948+|]
924949 , confirm_results = generic_output_match_confirm
925950 }
926951
vty.cabal+43−14
@@ -92,7 +92,7 @@ test-suite verify-attribute-ops
9292 hs-source-dirs: src test
9393 test-module: VerifyAttributeOps
9494 build-depends: Cabal == 1.17.*,
95− QuickCheck == 2.4.*,
95+ QuickCheck >= 2.4,
9696 random == 1.0.*,
9797 base >= 4 && < 5,
9898 bytestring,
@@ -143,7 +143,7 @@ test-suite verify-using-mock-terminal
143143 include-dirs: cbits
144144
145145 build-depends: Cabal == 1.17.*,
146− QuickCheck == 2.4.*,
146+ QuickCheck >= 2.4,
147147 random == 1.0.*,
148148 base >= 4 && < 5,
149149 bytestring,
@@ -194,7 +194,7 @@ test-suite verify-display-attributes
194194 include-dirs: cbits
195195
196196 build-depends: Cabal == 1.17.*,
197− QuickCheck == 2.4.*,
197+ QuickCheck >= 2.4,
198198 random == 1.0.*,
199199 base >= 4 && < 5,
200200 bytestring,
@@ -222,7 +222,7 @@ test-suite verify-empty-image-props
222222 Verify
223223
224224 build-depends: Cabal == 1.17.*,
225− QuickCheck == 2.4.*,
225+ QuickCheck >= 2.4,
226226 random == 1.0.*,
227227 base >= 4 && < 5,
228228 bytestring,
@@ -253,7 +253,7 @@ test-suite verify-eval-terminfo-caps
253253 Verify
254254
255255 build-depends: Cabal == 1.17.*,
256− QuickCheck == 2.4.*,
256+ QuickCheck >= 2.4,
257257 random == 1.0.*,
258258 base >= 4 && < 5,
259259 bytestring,
@@ -296,7 +296,7 @@ test-suite verify-image-ops
296296 include-dirs: cbits
297297
298298 build-depends: Cabal == 1.17.*,
299− QuickCheck == 2.4.*,
299+ QuickCheck >= 2.4,
300300 random == 1.0.*,
301301 base >= 4 && < 5,
302302 bytestring,
@@ -333,7 +333,7 @@ test-suite verify-image-trans
333333 include-dirs: cbits
334334
335335 build-depends: Cabal == 1.17.*,
336− QuickCheck == 2.4.*,
336+ QuickCheck >= 2.4,
337337 random == 1.0.*,
338338 base >= 4 && < 5,
339339 bytestring,
@@ -380,7 +380,7 @@ test-suite verify-inline
380380 include-dirs: cbits
381381
382382 build-depends: Cabal == 1.17.*,
383− QuickCheck == 2.4.*,
383+ QuickCheck >= 2.4,
384384 random == 1.0.*,
385385 base >= 4 && < 5,
386386 bytestring,
@@ -411,7 +411,7 @@ test-suite verify-parse-terminfo-caps
411411 include-dirs: cbits
412412
413413 build-depends: Cabal == 1.17.*,
414− QuickCheck == 2.4.*,
414+ QuickCheck >= 2.4,
415415 random == 1.0.*,
416416 base >= 4 && < 5,
417417 bytestring,
@@ -441,7 +441,7 @@ test-suite verify-picture-ops
441441 include-dirs: cbits
442442
443443 build-depends: Cabal == 1.17.*,
444− QuickCheck == 2.4.*,
444+ QuickCheck >= 2.4,
445445 random == 1.0.*,
446446 base >= 4 && < 5,
447447 bytestring,
@@ -492,7 +492,7 @@ test-suite verify-picture-to-span
492492 include-dirs: cbits
493493
494494 build-depends: Cabal == 1.17.*,
495− QuickCheck == 2.4.*,
495+ QuickCheck >= 2.4,
496496 random == 1.0.*,
497497 base >= 4 && < 5,
498498 bytestring,
@@ -543,7 +543,7 @@ test-suite verify-span-ops
543543 include-dirs: cbits
544544
545545 build-depends: Cabal == 1.17.*,
546− QuickCheck == 2.4.*,
546+ QuickCheck >= 2.4,
547547 random == 1.0.*,
548548 base >= 4 && < 5,
549549 bytestring,
@@ -577,7 +577,7 @@ test-suite verify-utf8-width
577577 include-dirs: cbits
578578
579579 build-depends: Cabal == 1.17.*,
580− QuickCheck == 2.4.*,
580+ QuickCheck >= 2.4,
581581 random == 1.0.*,
582582 base >= 4 && < 5,
583583 bytestring,
@@ -592,6 +592,36 @@ test-suite verify-utf8-width
592592 utf8-string >= 0.3 && < 0.4,
593593 vector >= 0.7
594594
595+executable vty-interactive-terminal-test
596+ main-is: interactive_terminal_test.hs
597+
598+ default-language: Haskell2010
599+
600+ hs-source-dirs: src test
601+
602+ c-sources: cbits/gwinsz.c
603+ cbits/set_term_timing.c
604+ cbits/mk_wcwidth.c
605+
606+ include-dirs: cbits
607+
608+ build-depends: Cabal == 1.17.*,
609+ QuickCheck >= 2.4,
610+ random == 1.0.*,
611+ base >= 4 && < 5,
612+ bytestring,
613+ containers,
614+ deepseq >= 1.1 && < 1.4,
615+ ghc-prim,
616+ mtl >= 1.1.1.0 && < 2.2,
617+ parallel >= 2.2 && < 3.3,
618+ parsec >= 2 && < 4,
619+ string-qq,
620+ terminfo >= 0.3 && < 0.4,
621+ unix,
622+ utf8-string >= 0.3 && < 0.4,
623+ vector >= 0.7
624+
595625-- Bench.hs
596626-- Bench2.hs
597627-- BenchRenderChar.hs
@@ -606,7 +636,6 @@ test-suite verify-utf8-width
606636-- Verify/Graphics/Vty/Image.hs
607637-- Verify/Graphics/Vty/Picture.hs
608638-- Verify/Graphics/Vty/Span.hs
609−-- interactive_terminal_test.hs
610639-- vty_inline_example.hs
611640-- vty_issue_18.hs
612641-- yi_issue_264.hs