aboutsummaryrefslogtreecommitdiff
path: root/testcases/t/244-new-workspace-floating-enable-center.t
blob: 314187bd55a81fa9a8226b97b38416cf137c90bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!perl
# vim:ts=4:sw=4:expandtab
#
# Please read the following documents before working on tests:
# • https://build.i3wm.org/docs/testsuite.html
#   (or docs/testsuite)
#
# • https://build.i3wm.org/docs/lib-i3test.html
#   (alternatively: perldoc ./testcases/lib/i3test.pm)
#
# • https://build.i3wm.org/docs/ipc.html
#   (or docs/ipc)
#
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
#   (unless you are already familiar with Perl)
#
# Ensures that 'move workspace $new, floating enable' on a marked window
# leaves the window centered on the new workspace.
# Bug still in: 4.10.2-137-ga4f0ed6
use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1

new_window none
new_float none
EOT

#####################################################################
# Open a tiled window, and then simultaneously move it to another
# workspace and float it, ensuring that it ends up centered.
#####################################################################

my $window = open_window;
my $unused = get_unused_workspace();

cmd "mark foo; [con_mark=\"foo\"] move workspace $unused, floating enable";

sync_with_i3;

my $pos = $window->rect;

is(int($pos->{x} + $pos->{width} / 2), int($x->root->rect->width / 2),
    'x coordinates match');
is(int($pos->{y} + $pos->{height} / 2), int($x->root->rect->height / 2),
    'y coordinates match');

done_testing;