File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import pytest
4
4
import asyncio
5
- from i3ipc import Event
5
+ from i3ipc import Event , TickEvent
6
6
7
7
events = asyncio .Queue ()
8
8
9
- class TestWorkspace (IpcTest ):
10
9
10
+ class TestWorkspace (IpcTest ):
11
11
async def on_workspace (self , i3 , e ):
12
12
await events .put (e )
13
13
14
+ async def on_tick (self , i3 , e ):
15
+ await events .put (e )
16
+
14
17
@pytest .mark .asyncio
15
18
async def test_workspace (self , i3 ):
16
19
await i3 .command ('workspace 0' )
17
- await i3 .subscribe ([Event .WORKSPACE ])
20
+ await i3 .subscribe ([Event .WORKSPACE , Event .TICK ])
21
+
18
22
i3 .on (Event .WORKSPACE_FOCUS , self .on_workspace )
23
+ i3 .on (Event .TICK , self .on_tick )
24
+
25
+ await i3 .send_tick ()
26
+ assert isinstance (await events .get (), TickEvent )
27
+ assert isinstance (await events .get (), TickEvent )
28
+
19
29
await i3 .command ('workspace 12' )
20
30
e = await events .get ()
21
31
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ def on_window(i3, e):
43
43
events .append (e )
44
44
45
45
i3 .on (Event .WINDOW_NEW , on_window )
46
- Timer (0.001 , generate_events ).start ()
46
+ Timer (0.01 , generate_events ).start ()
47
47
i3 .main (timeout = 2 )
48
48
49
49
assert len (events )
@@ -54,7 +54,7 @@ def on_window(i3, e):
54
54
i3 .off (on_window )
55
55
56
56
i3 .on (Event .WINDOW_FOCUS , on_window )
57
- Timer (0.001 , generate_events ).start ()
57
+ Timer (0.01 , generate_events ).start ()
58
58
i3 .main (timeout = 2 )
59
59
60
60
assert len (events )
You can’t perform that action at this time.
0 commit comments