]> git.sur5r.net Git - i3/i3/blob - testcases/t/36-floating-ws-empty.t
tests: clean up/beautify all tests (code style / test style)
[i3/i3] / testcases / t / 36-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("/tmp/nestedcons");
13
14 my $tmp = fresh_workspace;
15
16 #############################################################################
17 # 1: open a floating window, get it mapped
18 #############################################################################
19
20 sub workspace_exists {
21     my ($name) = @_;
22     ($name ~~ @{get_workspace_names()})
23 }
24
25 ok(workspace_exists($tmp), "workspace $tmp exists");
26
27 my $x = X11::XCB::Connection->new;
28
29 # Create a floating window which is smaller than the minimum enforced size of i3
30 my $window = $x->root->create_child(
31     class => WINDOW_CLASS_INPUT_OUTPUT,
32     rect => [ 0, 0, 30, 30],
33     background_color => '#C0C0C0',
34     # replace the type with 'utility' as soon as the coercion works again in X11::XCB
35     window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
36 );
37
38 isa_ok($window, 'X11::XCB::Window');
39
40 $window->map;
41
42 sleep 0.25;
43
44 ok($window->mapped, 'Window is mapped');
45
46 # switch to a different workspace, see if the window is still mapped?
47
48 my $otmp = fresh_workspace;
49
50 ok(workspace_exists($otmp), "new workspace $otmp exists");
51 ok(workspace_exists($tmp), "old workspace $tmp still exists");
52
53 done_testing;