]> git.sur5r.net Git - i3/i3/blob - testcases/t/203-regress-assign-and-move.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 203-regress-assign-and-move.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • http://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # Verifies that you can assign a window _and_ use for_window with a move
18 # command.
19 # Ticket: #909
20 # Bug still in: 4.4-69-g6856b23
21 use i3test i3_autostart => 0;
22 use X11::XCB qw(:all);
23
24 my $config = <<EOT;
25 # i3 config file (v4)
26 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
27
28 assign [instance=__i3-test-window] 2
29 for_window [instance=__i3-test-window] move workspace 1
30 EOT
31
32 my $pid = launch_with_config($config);
33
34 sub set_wm_class {
35     my ($id, $class, $instance) = @_;
36
37     # Add a _NET_WM_STRUT_PARTIAL hint
38     my $atomname = $x->atom(name => 'WM_CLASS');
39     my $atomtype = $x->atom(name => 'STRING');
40
41     $x->change_property(
42         PROP_MODE_REPLACE,
43         $id,
44         $atomname->id,
45         $atomtype->id,
46         8,
47         length($class) + length($instance) + 2,
48         "$instance\x00$class\x00"
49     );
50 }
51
52 # We use dont_map because i3 will not map the window on the current
53 # workspace. Thus, open_window would time out in wait_for_map (2 seconds).
54 my $window = open_window(
55     before_map => sub { set_wm_class($_->id, '__i3-test-window', '__i3-test-window') },
56     dont_map => 1,
57 );
58 $window->map;
59
60 does_i3_live;
61
62 exit_gracefully($pid);
63
64 done_testing;