2 # vim:ts=4:sw=4:expandtab
4 # Verifies that scratchpad windows don’t move due to floating point caulcation
5 # errors when repeatedly hiding/showing, no matter what display resolution.
7 use i3test i3_autostart => 0;
11 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
13 fake-outputs 683x768+0+0,1024x768+683+0
15 my $pid = launch_with_config($config);
17 my $i3 = i3(get_socket_path());
19 $x->root->warp_pointer(0, 0);
22 sub verify_scratchpad_doesnt_move {
25 is(scalar @{get_ws($ws)->{nodes}}, 0, 'no nodes on this ws');
27 my $window = open_window;
29 is(scalar @{get_ws($ws)->{nodes}}, 1, 'one nodes on this ws');
31 cmd 'move scratchpad';
33 is(scalar @{get_ws($ws)->{nodes}}, 0, 'no nodes on this ws');
37 cmd 'scratchpad show';
38 is(scalar @{get_ws($ws)->{floating_nodes}}, 1, 'one floating node on this ws');
40 # Verify that the coordinates are within bounds.
41 my $content = get_ws($ws);
42 my $srect = $content->{floating_nodes}->[0]->{rect};
44 is($srect->{x}, $last_x, 'scratchpad window did not move');
46 $last_x = $srect->{x};
47 cmd 'scratchpad show';
50 # We need to kill the scratchpad window, otherwise scratchpad show in
51 # subsequent calls of verify_scratchpad_doesnt_move will cycle between all
53 cmd 'scratchpad show';
57 ################################################################################
58 # test it on the left output first (1366x768)
59 ################################################################################
61 my $second = fresh_workspace(output => 0);
62 verify_scratchpad_doesnt_move($second);
64 ################################################################################
65 # now on the right output (1024x768)
66 ################################################################################
68 $x->root->warp_pointer(683 + 10, 0);
71 my $third = fresh_workspace(output => 1);
72 verify_scratchpad_doesnt_move($third);
74 exit_gracefully($pid);