Menu
cosmic-mobile
publicLatest change 510a3b926dcaa185e6de4717c0705c927f90181d - Add pointer move action so screenshots exclude the cursor 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 þ')
def test_move_is_pointer_only(self):
import io, contextlib, sys
sys.argv = ['qmp.py', 'move', '10', '20', '--socket', '/nonexistent']
with self.assertRaises(SystemExit): qmp.main()
if __name__ == '__main__': unittest.main()