]> git.sur5r.net Git - i3/i3/blob - testcases/t/536-net-wm-desktop_mm.t
Reorder tests to not use the same number (#2947)
[i3/i3] / testcases / t / 536-net-wm-desktop_mm.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 # Tests for _NET_WM_DESKTOP.
18 # Ticket: #2153
19 use i3test i3_autostart => 0;
20 use X11::XCB qw(:all);
21
22 sub get_net_wm_desktop {
23     sync_with_i3;
24
25     my ($con) = @_;
26     my $cookie = $x->get_property(
27         0,
28         $con->{id},
29         $x->atom(name => '_NET_WM_DESKTOP')->id,
30         $x->atom(name => 'CARDINAL')->id,
31         0,
32         1
33     );
34
35     my $reply = $x->get_property_reply($cookie->{sequence});
36     return undef if $reply->{length} != 1;
37
38     return unpack("L", $reply->{value});
39 }
40
41 my $config = <<EOT;
42 # i3 config file (v4)
43 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
44
45 workspace "0" output "fake-0"
46 workspace "1" output "fake-0"
47 workspace "2" output "fake-0"
48 workspace "10" output "fake-1"
49 workspace "11" output "fake-1"
50 workspace "12" output "fake-1"
51
52 fake-outputs 1024x768+0+0,1024x768+1024+0
53 EOT
54
55 ###############################################################################
56 # _NET_WM_DESKTOP is updated when the window is moved to another workspace
57 # on another output.
58 ###############################################################################
59
60 my $pid = launch_with_config($config);
61
62 cmd 'workspace 0';
63 open_window;
64 cmd 'workspace 10';
65 open_window;
66 cmd 'workspace 0';
67 my $con = open_window;
68
69 cmd 'move window to workspace 10';
70
71 is(get_net_wm_desktop($con), 1, '_NET_WM_DESKTOP is updated when moving the window');
72
73 exit_gracefully($pid);
74
75 done_testing;