@@ -11,7 +11,7 @@ import Verify.Graphics.Vty.Output
11import Data.List (intersperse)
11import Data.List (intersperse)
13import Graphics.Vty hiding (resize)
13import Graphics.Vty hiding (resize)
14−import Graphics.Vty.Input.Data
14+import Graphics.Vty.Input.Events
15import Graphics.Vty.Input.Internal
15import Graphics.Vty.Input.Internal
16import Graphics.Vty.Input.Terminfo
16import Graphics.Vty.Input.Terminfo
@@ -102,7 +102,7 @@ compare_events input_spec expected_events out_events = compare_events' expected_
102 printf "received events %s\n" (show out_events) :: IO ()
102 printf "received events %s\n" (show out_events) :: IO ()
103 return False
103 return False
105−assert_events_from_syn_input :: ClassifyTableV1 -> InputSpec -> ExpectedSpec -> IO Bool
105+assert_events_from_syn_input :: ClassifyTable -> InputSpec -> ExpectedSpec -> IO Bool
106assert_events_from_syn_input table input_spec expected_events = do
106assert_events_from_syn_input table input_spec expected_events = do
107 let max_duration = sum [t | Delay t <- input_spec] + min_detectable_delay
107 let max_duration = sum [t | Delay t <- input_spec] + min_detectable_delay
108 event_count = length expected_events
108 event_count = length expected_events
@@ -127,7 +127,7 @@ assert_events_from_syn_input table input_spec expected_events = do
127 out_events <- reverse <$> readIORef events_ref
127 out_events <- reverse <$> readIORef events_ref
128 compare_events input_spec expected_events out_events
128 compare_events input_spec expected_events out_events
130−assert_events_from_input_block :: ClassifyTableV1 -> InputSpec -> ExpectedSpec -> IO Bool
130+assert_events_from_input_block :: ClassifyTable -> InputSpec -> ExpectedSpec -> IO Bool
131assert_events_from_input_block table input_spec expected_events = do
131assert_events_from_input_block table input_spec expected_events = do
132 let classifier = classify table
132 let classifier = classify table
133 max_duration = sum [t | Delay t <- input_spec] + min_detectable_delay
133 max_duration = sum [t | Delay t <- input_spec] + min_detectable_delay
@@ -168,12 +168,12 @@ instance Monad m => Serial m (InputBlocksUsingTable event) where
168 selections [] = []
168 selections [] = []
169 selections (x:xs) = let z = selections xs in [x] : (z ++ map ((:) x) z)
169 selections (x:xs) = let z = selections xs in [x] : (z ++ map ((:) x) z)
171−verify_simple_input_block_to_event :: Property IO
171+verify_visible_input_block_to_event :: Property IO
172−verify_simple_input_block_to_event = forAll $ \(InputBlocksUsingTable gen) -> do
172+verify_visible_input_block_to_event = forAll $ \(InputBlocksUsingTable gen) -> do
173− let input_seq = gen simple_chars
173+ let input_seq = gen visible_chars
174 input = Bytes $ concat [s | (s,_) <- input_seq]
174 input = Bytes $ concat [s | (s,_) <- input_seq]
175− events = [e | (_,(k,ms)) <- input_seq, let e = EvKey k ms]
175+ events = map snd input_seq
176− monadic $ assert_events_from_input_block simple_chars [input] events
176+ monadic $ assert_events_from_input_block visible_chars [input] events
178verify_keys_from_caps_table_block_to_event :: Property IO
178verify_keys_from_caps_table_block_to_event :: Property IO
179verify_keys_from_caps_table_block_to_event = forAll $ \(InputBlocksUsingTable gen) ->
179verify_keys_from_caps_table_block_to_event = forAll $ \(InputBlocksUsingTable gen) ->
@@ -181,19 +181,19 @@ verify_keys_from_caps_table_block_to_event = forAll $ \(InputBlocksUsingTable ge
181 term <- setupTerm term_name
181 term <- setupTerm term_name
182 let table = caps_classify_table term keys_from_caps_table
182 let table = caps_classify_table term keys_from_caps_table
183 input_seq = gen table
183 input_seq = gen table
184− events = [e | (_,e) <- input_seq]
184+ events = map snd input_seq
185− keydowns = [Bytes s | (s,_) <- input_seq]
185+ keydowns = map (Bytes . fst) input_seq
186 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
186 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
187− assert_events_from_input_block (map_to_legacy_table table) input events
187+ assert_events_from_input_block table input events
189−verify_simple_syn_input_to_event :: Property IO
189+verify_visible_syn_input_to_event :: Property IO
190−verify_simple_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) -> monadic $ do
190+verify_visible_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) -> monadic $ do
191− let table = simple_chars
191+ let table = visible_chars
192 input_seq = gen table
192 input_seq = gen table
193− events = [EvKey k ms | (_,(k,ms)) <- input_seq]
193+ events = map snd input_seq
194− keydowns = [Bytes s | (s,_) <- input_seq]
194+ keydowns = map (Bytes . fst) input_seq
195 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
195 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
196− assert_events_from_syn_input (concat ansi_classify_table) input events
196+ assert_events_from_syn_input universal_table input events
198verify_caps_syn_input_to_event :: Property IO
198verify_caps_syn_input_to_event :: Property IO
199verify_caps_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) ->
199verify_caps_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) ->
@@ -201,39 +201,39 @@ verify_caps_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) ->
201 term <- setupTerm term_name
201 term <- setupTerm term_name
202 let table = caps_classify_table term keys_from_caps_table
202 let table = caps_classify_table term keys_from_caps_table
203 input_seq = gen table
203 input_seq = gen table
204− events = [e | (_,e) <- input_seq]
204+ events = map snd input_seq
205− keydowns = [Bytes s | (s,_) <- input_seq]
205+ keydowns = map (Bytes . fst) input_seq
206 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
206 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
207− assert_events_from_syn_input (map_to_legacy_table table) input events
207+ assert_events_from_syn_input table input events
209verify_special_syn_input_to_event :: Property IO
209verify_special_syn_input_to_event :: Property IO
210verify_special_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) -> monadic $ do
210verify_special_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) -> monadic $ do
211− let table = function_keys_1 ++ function_keys_2
211+ let table = special_support_keys
212 input_seq = gen table
212 input_seq = gen table
213− events = [EvKey k ms | (_,(k,ms)) <- input_seq]
213+ events = map snd input_seq
214− keydowns = [Bytes s | (s,_) <- input_seq]
214+ keydowns = map (Bytes . fst) input_seq
215 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
215 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
216− assert_events_from_syn_input (concat ansi_classify_table) input events
216+ assert_events_from_syn_input universal_table input events
218verify_full_syn_input_to_event :: Property IO
218verify_full_syn_input_to_event :: Property IO
219verify_full_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) ->
219verify_full_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) ->
220 forEachOf terminals_of_interest $ \term_name -> monadic $ do
220 forEachOf terminals_of_interest $ \term_name -> monadic $ do
221 term <- setupTerm term_name
221 term <- setupTerm term_name
222− let table = classify_table_for_term term
222+ let table = classify_table_for_term term_name term
223 input_seq = gen table
223 input_seq = gen table
224− events = [EvKey k ms | (_,(k,ms)) <- input_seq]
224+ events = map snd input_seq
225− keydowns = [Bytes s | (s,_) <- input_seq]
225+ keydowns = map (Bytes . fst) input_seq
226 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
226 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
227 assert_events_from_syn_input table input events
227 assert_events_from_syn_input table input events
229main :: IO ()
229main :: IO ()
230main = defaultMain
230main = defaultMain
231 [ testProperty "basic block generated from a single visible chars to event translation"
231 [ testProperty "basic block generated from a single visible chars to event translation"
232− verify_simple_input_block_to_event
232+ verify_visible_input_block_to_event
233 , testProperty "key sequences read from caps table map to expected events"
233 , testProperty "key sequences read from caps table map to expected events"
234 verify_keys_from_caps_table_block_to_event
234 verify_keys_from_caps_table_block_to_event
235 , testProperty "synthesized typing from single visible chars translates to expected events"
235 , testProperty "synthesized typing from single visible chars translates to expected events"
236− verify_simple_syn_input_to_event
236+ verify_visible_syn_input_to_event
237 , testProperty "synthesized typing from keys from capabilities tables translates to expected events"
237 , testProperty "synthesized typing from keys from capabilities tables translates to expected events"
238 verify_caps_syn_input_to_event
238 verify_caps_syn_input_to_event
239 , testProperty "synthesized typing from hard coded special keys translates to expected events"
239 , testProperty "synthesized typing from hard coded special keys translates to expected events"