File tree Expand file tree Collapse file tree 5 files changed +64
-2
lines changed Expand file tree Collapse file tree 5 files changed +64
-2
lines changed Original file line number Diff line number Diff line change @@ -31,4 +31,5 @@ RUN git clone https://github.com/i3/i3 && \
31
31
32
32
ADD . /app
33
33
34
- CMD ["./run-tests.py" ]
34
+ # CMD ["bash", "-c", "./run-tests.py ./test/aio/test_window.py"]
35
+ CMD ["bash" , "-c" , "./run-tests.py" ]
Original file line number Diff line number Diff line change @@ -57,10 +57,11 @@ async def command_checked(self, cmd):
57
57
result = await i3 .command (cmd )
58
58
59
59
assert type (result ) is list
60
+ assert result
60
61
61
62
for r in result :
62
63
assert type (r ) is CommandReply
63
- assert r .success is True
64
+ assert r .success is True , r . error
64
65
65
66
return result
66
67
Original file line number Diff line number Diff line change @@ -72,3 +72,31 @@ async def test_marks(self, i3):
72
72
await i3 .command ('mark foo' )
73
73
tree = await i3 .get_tree ()
74
74
assert 'foo' in tree .find_focused ().marks
75
+
76
+ @pytest .mark .asyncio
77
+ async def test_resize (self , i3 ):
78
+
79
+ ws1 = await self .fresh_workspace ()
80
+ win = self .open_window ()
81
+ await self .command_checked (f'[id="{ win } "] floating enable' )
82
+
83
+ # XXX: uncomment and it will fail
84
+ # ws2 = await self.fresh_workspace()
85
+
86
+ def height_width (c ):
87
+ return c .rect .height + c .deco_rect .height , c .rect .width
88
+
89
+ async def do_resize (h , w ):
90
+ result = await self .command_checked (f'[id="{ win } "] resize set { w } px { h } px' )
91
+
92
+ size1 = 200 , 250
93
+ size2 = 350 , 300
94
+
95
+ await do_resize (* size1 )
96
+ con = (await i3 .get_tree ()).find_by_window (win )
97
+
98
+ await do_resize (* size2 )
99
+ con2 = (await i3 .get_tree ()).find_by_window (win )
100
+
101
+ assert height_width (con ) == size1
102
+ assert height_width (con2 ) == size2
Original file line number Diff line number Diff line change 1
1
from subprocess import Popen
2
2
import pytest
3
3
import i3ipc
4
+ from i3ipc import CommandReply
4
5
import math
5
6
from random import random
6
7
import time
@@ -58,3 +59,17 @@ def fresh_workspace(self):
58
59
if not any (w for w in workspaces if w .name == new_name ):
59
60
i3 .command ('workspace %s' % new_name )
60
61
return new_name
62
+
63
+ def command_checked (self , cmd ):
64
+ i3 = IpcTest .i3_conn
65
+ assert i3
66
+
67
+ result = i3 .command (cmd )
68
+
69
+ assert type (result ) is list
70
+
71
+ for r in result :
72
+ assert type (r ) is CommandReply
73
+ assert r .success is True
74
+
75
+ return result
Original file line number Diff line number Diff line change @@ -60,3 +60,20 @@ def on_window(i3, e):
60
60
assert len (events )
61
61
for e in events :
62
62
assert e .change == 'focus'
63
+
64
+ def test_resize (self , i3 ):
65
+ self .fresh_workspace ()
66
+ self .open_window ()
67
+ i3 .command ('floating enable' )
68
+
69
+ self .command_checked ('resize set height 200 px; resize set width 250 px' )
70
+ con = i3 .get_tree ().find_focused ()
71
+
72
+ self .command_checked ('resize set width 300 px; resize set height 350 px' )
73
+ con2 = i3 .get_tree ().find_focused ()
74
+
75
+ def height_width (c ):
76
+ return (c .rect .height + c .deco_rect .height , c .rect .width )
77
+
78
+ assert height_width (con ) == (200 , 250 )
79
+ assert height_width (con2 ) == (350 , 300 )
You can’t perform that action at this time.
0 commit comments