ipc: always include marks property in TREE reply

This commit is contained in:
Ian Fan 2020-03-07 00:04:05 +00:00
parent cae3b294ad
commit d02cda4241
3 changed files with 12 additions and 15 deletions

View File

@ -410,17 +410,13 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
ystr("urgent"); ystr("urgent");
y(bool, con->urgent); y(bool, con->urgent);
if (!TAILQ_EMPTY(&(con->marks_head))) { ystr("marks");
ystr("marks"); y(array_open);
y(array_open); mark_t *mark;
TAILQ_FOREACH (mark, &(con->marks_head), marks) {
mark_t *mark; ystr(mark->name);
TAILQ_FOREACH (mark, &(con->marks_head), marks) {
ystr(mark->name);
}
y(array_close);
} }
y(array_close);
ystr("focused"); ystr("focused");
y(bool, (con == focused)); y(bool, (con == focused));

View File

@ -72,6 +72,7 @@ my $expected = {
'floating_nodes' => $ignore, 'floating_nodes' => $ignore,
workspace_layout => 'default', workspace_layout => 'default',
current_border_width => -1, current_border_width => -1,
marks => $ignore,
}; };
# a shallow copy is sufficient, since we only ignore values at the root # a shallow copy is sufficient, since we only ignore values at the root

View File

@ -98,7 +98,7 @@ cmd 'focus left';
cmd 'mark important'; cmd 'mark important';
is_deeply(get_mark_for_window_on_workspace($tmp, $first), [ 'important' ], 'first container now has the mark'); is_deeply(get_mark_for_window_on_workspace($tmp, $first), [ 'important' ], 'first container now has the mark');
ok(!get_mark_for_window_on_workspace($tmp, $second), 'second container lost the mark'); is_deeply(get_mark_for_window_on_workspace($tmp, $second), [], 'second container lost the mark');
############################################################## ##############################################################
# 5: mark a con, toggle the mark, check that the mark is gone # 5: mark a con, toggle the mark, check that the mark is gone
@ -107,7 +107,7 @@ ok(!get_mark_for_window_on_workspace($tmp, $second), 'second container lost the
$con = open_window; $con = open_window;
cmd 'mark important'; cmd 'mark important';
cmd 'mark --toggle important'; cmd 'mark --toggle important';
ok(!get_mark_for_window_on_workspace($tmp, $con), 'container no longer has the mark'); is_deeply(get_mark_for_window_on_workspace($tmp, $con), [], 'container no longer has the mark');
############################################################## ##############################################################
# 6: toggle a mark on an unmarked con, check it is marked # 6: toggle a mark on an unmarked con, check it is marked
@ -140,7 +140,7 @@ cmd 'focus left';
cmd 'mark --toggle important'; cmd 'mark --toggle important';
is_deeply(get_mark_for_window_on_workspace($tmp, $first), [ 'important' ], 'left container has the mark now'); is_deeply(get_mark_for_window_on_workspace($tmp, $first), [ 'important' ], 'left container has the mark now');
ok(!get_mark_for_window_on_workspace($tmp, $second), 'second containr no longer has the mark'); is_deeply(get_mark_for_window_on_workspace($tmp, $second), [], 'second containr no longer has the mark');
############################################################## ##############################################################
# 9: try to mark two cons with the same mark and check that # 9: try to mark two cons with the same mark and check that
@ -154,8 +154,8 @@ my $result = cmd "[instance=iamnotunique] mark important";
is($result->[0]->{success}, 0, 'command was unsuccessful'); is($result->[0]->{success}, 0, 'command was unsuccessful');
is($result->[0]->{error}, 'A mark must not be put onto more than one window', 'correct error is returned'); is($result->[0]->{error}, 'A mark must not be put onto more than one window', 'correct error is returned');
ok(!get_mark_for_window_on_workspace($tmp, $first), 'first container is not marked'); is_deeply(get_mark_for_window_on_workspace($tmp, $first), [], 'first container is not marked');
ok(!get_mark_for_window_on_workspace($tmp, $second), 'second containr is not marked'); is_deeply(get_mark_for_window_on_workspace($tmp, $second), [], 'second containr is not marked');
############################################################## ##############################################################