Menu
cosmic-mobile
publicLatest change d22956783f74f68f3d7eff1dd31f885aaf0fbe3e - Checkpoint BúiOS prototype and document clean-worktree workflow by AkurAI Build
import importlib.util
import unittest
from pathlib import Path
spec = importlib.util.spec_from_file_location('qmp', Path(__file__).resolve().parents[1] / 'qmp.py')
assert spec is not None and spec.loader is not None
qmp = importlib.util.module_from_spec(spec)
spec.loader.exec_module(qmp)
class InputTests(unittest.TestCase):
def test_tap_bounds_and_scaling(self):
events = qmp.tap_events(449, 989, 450, 990)
self.assertEqual(events[0]['data']['value'], 32767)
self.assertEqual(events[1]['data']['value'], 32767)
with self.assertRaises(ValueError): qmp.tap_events(450, 0, 450, 990)
def test_text_validation_before_input(self):
self.assertEqual(qmp.text_keys('A!\n'), ['shift-a', 'shift-1', 'ret'])
with self.assertRaises(ValueError): qmp.text_keys('hello þ')
if __name__ == '__main__': unittest.main()