2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • https://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Test for _NET_WM_USER_TIME.
20 use X11::XCB 'PROP_MODE_REPLACE';
22 my ($ws, $other, $con);
24 sub open_window_with_user_time {
25 my $wm_user_time = shift;
27 my $window = open_window(
31 my $atomname = $x->atom(name => '_NET_WM_USER_TIME');
32 my $atomtype = $x->atom(name => 'CARDINAL');
40 pack('L1', $wm_user_time),
48 #####################################################################
49 # 1: if _NET_WM_USER_TIME is set to 0, the window is not focused
51 #####################################################################
53 $ws = fresh_workspace;
56 $other = get_focused($ws);
57 open_window_with_user_time(0);
59 is(get_focused($ws), $other, 'new window is not focused');
61 #####################################################################
62 # 2: if _NET_WM_USER_TIME is set to something other than 0, the
63 # window is focused anyway.
64 #####################################################################
66 $ws = fresh_workspace;
69 $other = get_focused($ws);
70 open_window_with_user_time(42);
72 isnt(get_focused($ws), $other, 'new window is focused');