]> git.sur5r.net Git - i3/i3/blob - testcases/t/250-layout-restore-multiple-criteria.t
88c688237b797f5bc21ed1a3ee6eee9ec455c8eb
[i3/i3] / testcases / t / 250-layout-restore-multiple-criteria.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 # TODO: Description of this file.
18 # Ticket: #1817
19 # Bug still in: 4.10.3-270-g0fb784f
20 use i3test;
21 use File::Temp qw(tempfile);
22 use IO::Handle;
23
24 my $ws = fresh_workspace;
25
26 my @content = @{get_ws_content($ws)};
27 is(@content, 0, 'no nodes on the new workspace yet');
28
29 my ($fh, $filename) = tempfile(UNLINK => 1);
30 print $fh <<'EOT';
31 {
32     // stacked split container with 1 children
33     "border": "normal",
34     "floating": "auto_off",
35     "layout": "stacked",
36     "percent": 0.40,
37     "type": "con",
38     "nodes": [
39         {
40             "border": "normal",
41             "current_border_width": 2,
42             "floating": "auto_off",
43             "geometry": {
44                "height": 460,
45                "width": 804,
46                "x": 0,
47                "y": 0
48             },
49             // "name": "",
50             "percent": 0.5,
51             "swallows": [
52                { "class": "^URxvt$" },
53                { "class": "^Gitk$" },
54                { "class": "^Git-gui$" }
55             ],
56             "type": "con"
57         }
58     ]
59 }
60 EOT
61 $fh->flush;
62 my $reply = cmd "append_layout $filename";
63 close($fh);
64
65 does_i3_live;
66
67 @content = @{get_ws_content($ws)};
68 is(@content, 1, "one node on the workspace now");
69
70 my $should_swallow = open_window(wm_class => 'URxvt');
71
72 @content = @{get_ws_content($ws)};
73 is(@content, 1, "still one node on the workspace now");
74 my @nodes = @{$content[0]->{nodes}};
75 is($nodes[0]->{window}, $should_swallow->id, "swallowed window on top");
76
77 cmd 'focus parent';
78
79 my $should_ignore = open_window(wm_class => 'Gitk');
80
81 @content = @{get_ws_content($ws)};
82 is(@content, 2, "two nodes on the workspace");
83
84 done_testing;