Kill windows between tests

This commit is contained in:
Michael Stapelberg
2017-09-10 11:31:10 +02:00
parent 4fd05e4db2
commit 31834b3ce4
3 changed files with 61 additions and 19 deletions

View File

@ -45,6 +45,7 @@ open_window;
cmd "swap container with con_id 1";
does_i3_live;
kill_all_windows;
###############################################################################
# Swap 2 windows in different workspaces using con_id
@ -60,6 +61,8 @@ open_window;
cmd "swap container with con_id $A";
is(get_focused($ws), $A, 'A is now focused');
kill_all_windows;
###############################################################################
# Swap two containers next to each other.
# Focus should stay on B because both windows are on the focused workspace.
@ -82,6 +85,8 @@ is($nodes->[0]->{window}, $B->{id}, 'B is on the left');
is($nodes->[1]->{window}, $A->{id}, 'A is on the right');
is(get_focused($ws), $expected_focus, 'B is still focused');
kill_all_windows;
###############################################################################
# Swap two containers with different parents.
# In this test, the focus head of the left v-split container is A.
@ -112,6 +117,8 @@ is($nodes->[0]->{nodes}->[0]->{window}, $B->{id}, 'B is on the top left');
is($nodes->[1]->{nodes}->[1]->{window}, $A->{id}, 'A is on the bottom right');
is(get_focused($ws), $expected_focus, 'B is still focused');
kill_all_windows;
###############################################################################
# Swap two containers with different parents.
# In this test, the focus head of the left v-split container is _not_ A.
@ -142,6 +149,8 @@ is($nodes->[0]->{nodes}->[0]->{window}, $B->{id}, 'B is on the top left');
is($nodes->[1]->{nodes}->[1]->{window}, $A->{id}, 'A is on the bottom right');
is(get_focused($ws), $expected_focus, 'B is still focused');
kill_all_windows;
###############################################################################
# Swap two containers with one being on a different workspace.
# The focused container is B.
@ -177,6 +186,8 @@ $nodes = get_ws_content($ws2);
is($nodes->[1]->{window}, $A->{id}, 'A is on ws1:right');
is(get_focused($ws2), $expected_focus, 'A is focused');
kill_all_windows;
###############################################################################
# Swap two non-focused containers within the same workspace.
#
@ -205,6 +216,8 @@ is($nodes->[0]->{nodes}->[0]->{window}, $B->{id}, 'B is on the top left');
is($nodes->[1]->{nodes}->[1]->{window}, $A->{id}, 'A is on the bottom right');
is(get_focused($ws), $expected_focus, 'F is still focused');
kill_all_windows;
###############################################################################
# Swap two non-focused containers which are both on different workspaces.
#
@ -244,6 +257,8 @@ is($nodes->[0]->{window}, $A->{id}, 'A is on the second workspace');
is(get_focused($ws3), $expected_focus, 'F is still focused');
kill_all_windows;
###############################################################################
# Swap two non-focused containers with one being on a different workspace.
#
@ -277,6 +292,8 @@ $nodes = get_ws_content($ws2);
is($nodes->[0]->{window}, $A->{id}, 'A is on the left of the second workspace');
is(get_focused($ws2), $expected_focus, 'F is still focused');
kill_all_windows;
###############################################################################
# 1. A container cannot be swapped with its parent.
# 2. A container cannot be swapped with one of its children.
@ -301,6 +318,8 @@ is($result->[0]->{success}, 0, 'B cannot be swappd with its parent');
$result = cmd '[con_mark=A] swap container with mark B';
is($result->[0]->{success}, 0, 'A cannot be swappd with one of its children');
kill_all_windows;
###############################################################################
# Swapping two containers preserves the geometry of the container they are
# being swapped with.
@ -331,6 +350,8 @@ $nodes = get_ws_content($ws);
cmp_float($nodes->[0]->{percent}, 0.25, 'B has 25% width');
cmp_float($nodes->[1]->{percent}, 0.75, 'A has 75% width');
kill_all_windows;
###############################################################################
# Swapping containers not sharing the same parent preserves the geometry of
# the container they are swapped with.
@ -375,6 +396,8 @@ $nodes = get_ws_content($ws);
cmp_float($nodes->[0]->{nodes}->[0]->{percent}, 0.25, 'B has 25% height');
cmp_float($nodes->[1]->{nodes}->[0]->{percent}, 0.75, 'A has 75% height');
kill_all_windows;
###############################################################################
# Swapping containers moves the urgency hint correctly.
###############################################################################
@ -398,6 +421,8 @@ is(get_ws($ws1)->{urgent}, 1, 'the first workspace is marked urgent');
is(@urgent, 0, 'A is not marked urgent');
is(get_ws($ws2)->{urgent}, 0, 'the second workspace is not marked urgent');
kill_all_windows;
###############################################################################
exit_gracefully($pid);