summaryrefslogtreecommitdiff
path: root/tools/libinput-record-verify-yaml.py
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-05-03 13:51:00 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2018-05-03 14:03:30 +1000
commitb476345959e36681592046bb5d4a0239dd375212 (patch)
treeacb77bf8b919886c489eade0b4ec290d70742f10 /tools/libinput-record-verify-yaml.py
parent8bf2c5ae16c068b01573ae03a9ceb0421b2e4471 (diff)
downloadlibinput-b476345959e36681592046bb5d4a0239dd375212.tar.gz
tools: libinput-record: print switch events in --with-libinput
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools/libinput-record-verify-yaml.py')
-rwxr-xr-xtools/libinput-record-verify-yaml.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/libinput-record-verify-yaml.py b/tools/libinput-record-verify-yaml.py
index fb90481c..8bde4ca3 100755
--- a/tools/libinput-record-verify-yaml.py
+++ b/tools/libinput-record-verify-yaml.py
@@ -233,7 +233,7 @@ class TestYaml(unittest.TestCase):
'TABLET_TOOL_AXIS', 'TABLET_TOOL_PROXIMITY',
'TABLET_TOOL_BUTTON', 'TABLET_TOOL_TIP',
'TABLET_PAD_STRIP', 'TABLET_PAD_RING',
- 'TABLET_PAD_BUTTON'
+ 'TABLET_PAD_BUTTON', 'SWITCH_TOGGLE',
]
for e in self.libinput_events():
self.assertIn('type', e)
@@ -615,6 +615,20 @@ class TestYaml(unittest.TestCase):
except KeyError:
pass
+ def test_events_libinput_switch(self):
+ keys = ['type', 'time', 'switch', 'state']
+
+ for e in self.libinput_events('SWITCH_TOGGLE'):
+ self.dict_key_crosscheck(e, keys)
+
+ s = e['switch']
+ self.assertTrue(isinstance(s, int))
+ self.assertIn(s, [0x00, 0x01])
+
+ # yaml converts on/off to true/false
+ state = e['state']
+ self.assertTrue(isinstance(state, bool))
+
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Verify a YAML recording')