From b09bb0fc2a97a19938784733233516cd05f336a1 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 24 Jul 2011 14:54:30 +0200 Subject: [PATCH] ipc: make 'urgent' a bool --- src/ipc.c | 2 +- testcases/t/13-urgent.t | 18 +++++++++--------- testcases/t/16-nestedcons.t | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ipc.c b/src/ipc.c index a5e4a66c..ca341dc7 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -198,7 +198,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) { else y(double, con->percent); ystr("urgent"); - y(integer, con->urgent); + y(bool, con->urgent); ystr("focused"); y(integer, (con == focused)); diff --git a/testcases/t/13-urgent.t b/testcases/t/13-urgent.t index 20539dbc..f40b72fb 100644 --- a/testcases/t/13-urgent.t +++ b/testcases/t/13-urgent.t @@ -22,7 +22,7 @@ cmd 'split v'; my $top = open_standard_window($x); my $bottom = open_standard_window($x); -my @urgent = grep { $_->{urgent} == 1 } @{get_ws_content($tmp)}; +my @urgent = grep { $_->{urgent} } @{get_ws_content($tmp)}; is(@urgent, 0, 'no window got the urgent flag'); # cmd 'layout stacking'; @@ -34,30 +34,30 @@ $top->add_hint('urgency'); sleep 0.5; @content = @{get_ws_content($tmp)}; -@urgent = grep { $_->{urgent} == 1 } @content; +@urgent = grep { $_->{urgent} } @content; $top_info = first { $_->{window} == $top->id } @content; $bottom_info = first { $_->{window} == $bottom->id } @content; -is($top_info->{urgent}, 1, 'top window is marked urgent'); -is($bottom_info->{urgent}, 0, 'bottom window is not marked urgent'); +ok($top_info->{urgent}, 'top window is marked urgent'); +ok(!$bottom_info->{urgent}, 'bottom window is not marked urgent'); is(@urgent, 1, 'exactly one window got the urgent flag'); cmd '[id="' . $top->id . '"] focus'; -@urgent = grep { $_->{urgent} == 1 } @{get_ws_content($tmp)}; +@urgent = grep { $_->{urgent} } @{get_ws_content($tmp)}; is(@urgent, 0, 'no window got the urgent flag after focusing'); $top->add_hint('urgency'); sleep 0.5; -@urgent = grep { $_->{urgent} == 1 } @{get_ws_content($tmp)}; +@urgent = grep { $_->{urgent} } @{get_ws_content($tmp)}; is(@urgent, 0, 'no window got the urgent flag after re-setting urgency hint'); ##################################################################### # Check if the workspace urgency hint gets set/cleared correctly ##################################################################### my $ws = get_ws($tmp); -is($ws->{urgent}, 0, 'urgent flag not set on workspace'); +ok(!$ws->{urgent}, 'urgent flag not set on workspace'); my $otmp = fresh_workspace; @@ -65,11 +65,11 @@ $top->add_hint('urgency'); sleep 0.5; $ws = get_ws($tmp); -is($ws->{urgent}, 1, 'urgent flag set on workspace'); +ok($ws->{urgent}, 'urgent flag set on workspace'); cmd "workspace $tmp"; $ws = get_ws($tmp); -is($ws->{urgent}, 0, 'urgent flag not set on workspace after switching'); +ok(!$ws->{urgent}, 'urgent flag not set on workspace after switching'); done_testing; diff --git a/testcases/t/16-nestedcons.t b/testcases/t/16-nestedcons.t index 72526f08..9bcff8c6 100644 --- a/testcases/t/16-nestedcons.t +++ b/testcases/t/16-nestedcons.t @@ -29,7 +29,7 @@ my $expected = { layout => 'default', focus => ignore(), focused => 0, - urgent => 0, + urgent => JSON::XS::false, border => 'normal', 'floating_nodes' => ignore(), };