-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
executable file
·43 lines (34 loc) · 1.56 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/env python3
import wftest as wt
def is_gui() -> bool:
return False
class WTest(wt.WayfireTest):
def prepare(self):
return self.require_test_clients(['weston-terminal', 'gedit', 'fcitx5'])
def _run(self):
self.socket.run('weston-terminal')
self.wait_for_clients_to_open(nr_clients=1)
self.socket.run('dbus-launch --exit-with-session ./script.sh')
self.wait_for_clients_to_open(nr_clients=2)
# Press next twice => focus should remain on Gedit
self.socket.set_key_state('KEY_LEFTALT', True)
self.socket.set_key_state('KEY_TAB', True)
self.socket.set_key_state('KEY_N', False)
self.wait_for_clients(2)
self.socket.set_key_state('KEY_TAB', True)
self.socket.set_key_state('KEY_TAB', False)
self.socket.set_key_state('KEY_LEFTALT', False)
self.wait_for_clients(2)
focused = self.socket.ipc_rules_get_focused()['info']
if not focused or focused['app-id'] != 'gedit':
return wt.Status.WRONG, f'Gedit lost focus: {focused}'
# This should switch focus
self.socket.set_key_state('KEY_LEFTALT', True)
self.socket.set_key_state('KEY_TAB', True)
self.socket.set_key_state('KEY_TAB', False)
self.socket.set_key_state('KEY_LEFTALT', False)
self.wait_for_clients(2)
focused = self.socket.ipc_rules_get_focused()['info']
if not focused or focused['app-id'] != 'nil':
return wt.Status.WRONG, f'weston-terminal is not focused {focused}'
return wt.Status.OK, None