]> git.sur5r.net Git - i3/i3/blob - testcases/t/63-wm-state.t
tests: implement sync_with_i3 and use it instead of sleep()
[i3/i3] / testcases / t / 63-wm-state.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Tests if WM_STATE is WM_STATE_NORMAL when mapped and WM_STATE_WITHDRAWN when
5 # unmapped.
6 #
7 use X11::XCB qw(:all);
8 use i3test;
9
10 BEGIN {
11     use_ok('X11::XCB::Window');
12     use_ok('X11::XCB::Event::Generic');
13     use_ok('X11::XCB::Event::MapNotify');
14     use_ok('X11::XCB::Event::ClientMessage');
15 }
16
17 my $x = X11::XCB::Connection->new;
18
19 my $window = open_standard_window($x);
20
21 sync_with_i3($x);
22
23 diag('window mapped');
24
25 is($window->state, ICCCM_WM_STATE_NORMAL, 'WM_STATE normal');
26
27 $window->unmap;
28
29 # TODO: wait for unmapnotify
30 sync_with_i3($x);
31
32 is($window->state, ICCCM_WM_STATE_WITHDRAWN, 'WM_STATE withdrawn');
33
34 done_testing;