]> git.sur5r.net Git - i3/i3/blob - testcases/t/136-floating-ws-empty.t
Merge branch 'fix-take-focus'
[i3/i3] / testcases / t / 136-floating-ws-empty.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 # Regression test: when only having a floating window on a workspace, it should not be deleted.
4
5 use i3test;
6 use X11::XCB qw(:all);
7
8 BEGIN {
9     use_ok('X11::XCB::Window');
10 }
11
12 my $i3 = i3(get_socket_path());
13
14 my $tmp = fresh_workspace;
15
16 #############################################################################
17 # 1: open a floating window, get it mapped
18 #############################################################################
19
20 ok(workspace_exists($tmp), "workspace $tmp exists");
21
22 my $x = X11::XCB::Connection->new;
23
24 # Create a floating window which is smaller than the minimum enforced size of i3
25 my $window = open_floating_window($x);
26 ok($window->mapped, 'Window is mapped');
27
28 # switch to a different workspace, see if the window is still mapped?
29
30 my $otmp = fresh_workspace;
31
32 ok(workspace_exists($otmp), "new workspace $otmp exists");
33 ok(workspace_exists($tmp), "old workspace $tmp still exists");
34
35 ################################################################################
36 # 2: Similar test: Have two floating windows on a workspace, close one of them.
37 # The workspace should not be closed. Regression present until (including) commit
38 # 1f2c9306a27cced83ad960e929bb9e9a163b7843
39 ################################################################################
40
41 $tmp = fresh_workspace;
42
43 ok(workspace_exists($tmp), "workspace $tmp exists");
44
45 # Create a floating window which is smaller than the minimum enforced size of i3
46 my $first = open_floating_window;
47 my $second = open_floating_window;
48 ok($first->mapped, 'Window is mapped');
49 ok($second->mapped, 'Window is mapped');
50
51 $otmp = fresh_workspace;
52
53 ok(workspace_exists($otmp), "new workspace $otmp exists");
54 ok(workspace_exists($tmp), "old workspace $tmp still exists");
55
56 $first->unmap;
57 wait_for_unmap $first;
58
59 ok(workspace_exists($otmp), "new workspace $otmp exists");
60 ok(workspace_exists($tmp), "old workspace $tmp still exists");
61
62 done_testing;