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_num_children($ws, 0, 'no nodes on this ws');
27 my $window = open_window;
28 is_num_children($ws, 1, 'one node on this ws');
30 cmd 'move scratchpad';
31 is_num_children($ws, 0, 'no nodes on this ws');
35 cmd 'scratchpad show';
36 is(scalar @{get_ws($ws)->{floating_nodes}}, 1, 'one floating node on this ws');
38 # Verify that the coordinates are within bounds.
39 my $content = get_ws($ws);
40 my $srect = $content->{floating_nodes}->[0]->{rect};
42 is($srect->{x}, $last_x, 'scratchpad window did not move');
44 $last_x = $srect->{x};
45 cmd 'scratchpad show';
48 # We need to kill the scratchpad window, otherwise scratchpad show in
49 # subsequent calls of verify_scratchpad_doesnt_move will cycle between all
51 cmd 'scratchpad show';
55 ################################################################################
56 # test it on the left output first (1366x768)
57 ################################################################################
59 my $second = fresh_workspace(output => 0);
60 verify_scratchpad_doesnt_move($second);
62 ################################################################################
63 # now on the right output (1024x768)
64 ################################################################################
66 $x->root->warp_pointer(683 + 10, 0);
69 my $third = fresh_workspace(output => 1);
70 verify_scratchpad_doesnt_move($third);
72 exit_gracefully($pid);