]> git.sur5r.net Git - i3/i3/blob - testcases/t/209-ewmh-net-workarea.t
tests: replace http:// with https:// where appropriate
[i3/i3] / testcases / t / 209-ewmh-net-workarea.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://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 the _NET_WORKAREA hint is deleted in case it is already set on the
18 # root window.
19 # Ticket: #1038
20 # Bug still in: 4.5.1-103-g1f8a860
21 use i3test i3_autostart => 0;
22 use X11::XCB qw(PROP_MODE_REPLACE);
23
24 my $atom_cookie = $x->intern_atom(
25     0, # create!
26     length('_NET_WORKAREA'),
27     '_NET_WORKAREA',
28 );
29
30 my $_net_workarea_id = $x->intern_atom_reply($atom_cookie->{sequence})->{atom};
31
32 $x->change_property(
33     PROP_MODE_REPLACE,
34     $x->get_root_window(),
35     $_net_workarea_id,
36     $x->atom(name => 'CARDINAL')->id,
37     32,
38     4,
39     pack('L4', 0, 0, 1024, 768));
40 $x->flush;
41
42 sub is_net_workarea_set {
43     my $cookie = $x->get_property(
44         0,
45         $x->get_root_window(),
46         $x->atom(name => '_NET_WORKAREA')->id,
47         $x->atom(name => 'CARDINAL')->id,
48         0,
49         4096,
50     );
51     my $reply = $x->get_property_reply($cookie->{sequence});
52     return 0 if $reply->{value_len} == 0;
53     return 0 if $reply->{format} == 0;
54     return 1
55 }
56
57 ok(is_net_workarea_set(), '_NET_WORKAREA is set before starting i3');
58
59 my $config = <<EOT;
60 # i3 config file (v4)
61 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
62 fake-outputs 1024x768+0+0
63 EOT
64
65 my $pid = launch_with_config($config);
66
67 ok(!is_net_workarea_set(), '_NET_WORKAREA not set after starting i3');
68
69 exit_gracefully($pid);
70
71 done_testing;