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