From 607fd7d0240c829a8fddb8337ec8ed32c1379f24 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 16 May 2011 22:03:07 +0200 Subject: [PATCH] tests: also test multiple commands in for_window Increases branch coverage to 49.1% --- testcases/i3-test.config | 1 + testcases/t/65-for_window.t | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/testcases/i3-test.config b/testcases/i3-test.config index 4065e5bb..ae9c0a98 100644 --- a/testcases/i3-test.config +++ b/testcases/i3-test.config @@ -1,5 +1,6 @@ for_window [class="borderless"] border none for_window [title="special borderless title"] border none +for_window [title="special mark title"] border none, mark bleh # ISO 10646 = Unicode font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 diff --git a/testcases/t/65-for_window.t b/testcases/t/65-for_window.t index f780ce4b..9c9c98d0 100644 --- a/testcases/t/65-for_window.t +++ b/testcases/t/65-for_window.t @@ -120,4 +120,41 @@ sleep 0.25; @content = @{get_ws_content($tmp)}; is($content[0]->{border}, 'normal', 'still normal border'); +$window->unmap; +sleep 0.25; + +@content = @{get_ws_content($tmp)}; +cmp_ok(@content, '==', 0, 'no more nodes'); + +############################################################## +# 3: match on the title, set border style *and* a mark +############################################################## + +$window = $x->root->create_child( + class => WINDOW_CLASS_INPUT_OUTPUT, + rect => [ 0, 0, 30, 30 ], + background_color => '#00ff00', +); + +$window->name('special mark title'); +$window->map; +sleep 0.25; + +@content = @{get_ws_content($tmp)}; +cmp_ok(@content, '==', 1, 'one node on this workspace now'); +is($content[0]->{border}, 'none', 'no border'); + +my $other = open_standard_window($x); + +@content = @{get_ws_content($tmp)}; +cmp_ok(@content, '==', 2, 'two nodes'); +is($content[0]->{border}, 'none', 'no border'); +is($content[1]->{border}, 'normal', 'normal border'); +ok(!$content[0]->{focused}, 'first one not focused'); + +cmd qq|[con_mark="bleh"] focus|; + +@content = @{get_ws_content($tmp)}; +ok($content[0]->{focused}, 'first node focused'); + done_testing; -- 2.39.5