@@ -11,7 +11,7 @@ import Verify.Graphics.Vty.Output
1111import Data.List (intersperse)
1212
1313import Graphics.Vty hiding (resize)
14−import Graphics.Vty.Input.Data
14+import Graphics.Vty.Input.Events
1515import Graphics.Vty.Input.Internal
1616import Graphics.Vty.Input.Terminfo
1717
@@ -102,7 +102,7 @@ compare_events input_spec expected_events out_events = compare_events' expected_
102102 printf "received events %s\n" (show out_events) :: IO ()
103103 return False
104104
105−assert_events_from_syn_input :: ClassifyTableV1 -> InputSpec -> ExpectedSpec -> IO Bool
105+assert_events_from_syn_input :: ClassifyTable -> InputSpec -> ExpectedSpec -> IO Bool
106106assert_events_from_syn_input table input_spec expected_events = do
107107 let max_duration = sum [t | Delay t <- input_spec] + min_detectable_delay
108108 event_count = length expected_events
@@ -127,7 +127,7 @@ assert_events_from_syn_input table input_spec expected_events = do
127127 out_events <- reverse <$> readIORef events_ref
128128 compare_events input_spec expected_events out_events
129129
130−assert_events_from_input_block :: ClassifyTableV1 -> InputSpec -> ExpectedSpec -> IO Bool
130+assert_events_from_input_block :: ClassifyTable -> InputSpec -> ExpectedSpec -> IO Bool
131131assert_events_from_input_block table input_spec expected_events = do
132132 let classifier = classify table
133133 max_duration = sum [t | Delay t <- input_spec] + min_detectable_delay
@@ -168,12 +168,12 @@ instance Monad m => Serial m (InputBlocksUsingTable event) where
168168 selections [] = []
169169 selections (x:xs) = let z = selections xs in [x] : (z ++ map ((:) x) z)
170170
171−verify_simple_input_block_to_event :: Property IO
172−verify_simple_input_block_to_event = forAll $ \(InputBlocksUsingTable gen) -> do
173− let input_seq = gen simple_chars
171+verify_visible_input_block_to_event :: Property IO
172+verify_visible_input_block_to_event = forAll $ \(InputBlocksUsingTable gen) -> do
173+ let input_seq = gen visible_chars
174174 input = Bytes $ concat [s | (s,_) <- input_seq]
175− events = [e | (_,(k,ms)) <- input_seq, let e = EvKey k ms]
176− monadic $ assert_events_from_input_block simple_chars [input] events
175+ events = map snd input_seq
176+ monadic $ assert_events_from_input_block visible_chars [input] events
177177
178178verify_keys_from_caps_table_block_to_event :: Property IO
179179verify_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
181181 term <- setupTerm term_name
182182 let table = caps_classify_table term keys_from_caps_table
183183 input_seq = gen table
184− events = [e | (_,e) <- input_seq]
185− keydowns = [Bytes s | (s,_) <- input_seq]
184+ events = map snd input_seq
185+ keydowns = map (Bytes . fst) input_seq
186186 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
188188
189−verify_simple_syn_input_to_event :: Property IO
190−verify_simple_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) -> monadic $ do
191− let table = simple_chars
189+verify_visible_syn_input_to_event :: Property IO
190+verify_visible_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) -> monadic $ do
191+ let table = visible_chars
192192 input_seq = gen table
193− events = [EvKey k ms | (_,(k,ms)) <- input_seq]
194− keydowns = [Bytes s | (s,_) <- input_seq]
193+ events = map snd input_seq
194+ keydowns = map (Bytes . fst) input_seq
195195 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
197197
198198verify_caps_syn_input_to_event :: Property IO
199199verify_caps_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) ->
@@ -201,39 +201,39 @@ verify_caps_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) ->
201201 term <- setupTerm term_name
202202 let table = caps_classify_table term keys_from_caps_table
203203 input_seq = gen table
204− events = [e | (_,e) <- input_seq]
205− keydowns = [Bytes s | (s,_) <- input_seq]
204+ events = map snd input_seq
205+ keydowns = map (Bytes . fst) input_seq
206206 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
208208
209209verify_special_syn_input_to_event :: Property IO
210210verify_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
212212 input_seq = gen table
213− events = [EvKey k ms | (_,(k,ms)) <- input_seq]
214− keydowns = [Bytes s | (s,_) <- input_seq]
213+ events = map snd input_seq
214+ keydowns = map (Bytes . fst) input_seq
215215 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
217217
218218verify_full_syn_input_to_event :: Property IO
219219verify_full_syn_input_to_event = forAll $ \(InputBlocksUsingTable gen) ->
220220 forEachOf terminals_of_interest $ \term_name -> monadic $ do
221221 term <- setupTerm term_name
222− let table = classify_table_for_term term
222+ let table = classify_table_for_term term_name term
223223 input_seq = gen table
224− events = [EvKey k ms | (_,(k,ms)) <- input_seq]
225− keydowns = [Bytes s | (s,_) <- input_seq]
224+ events = map snd input_seq
225+ keydowns = map (Bytes . fst) input_seq
226226 input = intersperse (Delay test_key_delay) keydowns ++ [Delay test_key_delay]
227227 assert_events_from_syn_input table input events
228228
229229main :: IO ()
230230main = defaultMain
231231 [ 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
233233 , testProperty "key sequences read from caps table map to expected events"
234234 verify_keys_from_caps_table_block_to_event
235235 , 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
237237 , testProperty "synthesized typing from keys from capabilities tables translates to expected events"
238238 verify_caps_syn_input_to_event
239239 , testProperty "synthesized typing from hard coded special keys translates to expected events"