]> git.sur5r.net Git - i3/i3/blob - testcases/t/249-layout-restore-floating.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 249-layout-restore-floating.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • http://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # Verifies floating containers are restored in the correct place in the
18 # hierarchy and get a non-zero size.
19 # Ticket: #1739
20 # Bug still in: 4.10.3-264-g419b73b
21 use i3test;
22 use File::Temp qw(tempfile);
23 use IO::Handle;
24
25 my $ws = fresh_workspace;
26
27 my @content = @{get_ws_content($ws)};
28 is(@content, 0, 'no nodes on the new workspace yet');
29
30 my ($fh, $filename) = tempfile(UNLINK => 1);
31 print $fh <<'EOT';
32 // vim:ts=4:sw=4:et
33 {
34     // floating_con with 1 children
35     "border": "none",
36     "floating": "auto_off",
37     "layout": "splith",
38     "percent": null,
39     "type": "floating_con",
40     // NOTE that "rect" is missing here.
41     "nodes": [
42         {
43             "border": "none",
44             "current_border_width": 0,
45             "floating": "user_on",
46             "geometry": {
47                "height": 384,
48                "width": 128,
49                "x": 448,
50                "y": 441
51             },
52             "name": "Splash",
53             "percent": 1,
54             "swallows": [
55                {
56                 "class": "^Steam$",
57                 "instance": "^Steam$",
58                 "title": "^Steam$"
59                // "transient_for": "^$"
60                }
61             ],
62             "type": "con"
63         }
64     ]
65 }
66 EOT
67 $fh->flush;
68 my $reply = cmd "append_layout $filename";
69
70 does_i3_live;
71
72 ok($reply->[0]->{success}, 'Layout successfully loaded');
73
74 cmd 'kill';
75
76 ok(workspace_exists($ws), 'Workspace still exists');
77
78 does_i3_live;
79
80 close($fh);
81
82 done_testing;