2 # vim:ts=4:sw=4:expandtab
4 # Tests all kinds of matching methods
9 my $i3 = i3("/tmp/nestedcons");
11 my $tmp = get_unused_workspace();
12 $i3->command("workspace $tmp")->recv;
14 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
17 my $x = X11::XCB::Connection->new;
18 my $window = $x->root->create_child(
19 class => WINDOW_CLASS_INPUT_OUTPUT,
20 rect => [ 0, 0, 30, 30 ],
21 background_color => '#C0C0C0',
25 # give it some time to be picked up by the window manager
26 # TODO: better check for $window->mapped or something like that?
27 # maybe we can even wait for getting mapped?
29 while (@{get_ws_content($tmp)} == 0 and $c++ < 5) {
32 my $content = get_ws_content($tmp);
33 ok(@{$content} == 1, 'window mapped');
34 my $win = $content->[0];
36 ######################################################################
37 # first test that matches which should not match this window really do
39 ######################################################################
40 # TODO: use PCRE expressions
41 # TODO: specify more match types
42 $i3->command(q|[class="*"] kill|)->recv;
43 $i3->command(q|[con_id="99999"] kill|)->recv;
45 $content = get_ws_content($tmp);
46 ok(@{$content} == 1, 'window still there');
49 cmd 'nop now killing the window';
51 $i3->command(qq|[con_id="$id"] kill|)->recv;
53 # give i3 some time to pick up the UnmapNotify event
56 cmd 'nop checking if its gone';
57 $content = get_ws_content($tmp);
58 ok(@{$content} == 0, 'window killed');
60 # TODO: same test, but with pcre expressions
62 diag( "Testing i3, Perl $], $^X" );