aboutsummaryrefslogtreecommitdiff
path: root/testcases
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2022-10-30 22:04:05 +0100
committerMichael Stapelberg <stapelberg@users.noreply.github.com>2022-10-30 22:22:08 +0100
commit0b89d4b2a7ae84a852a707d71cf2697e55581ee7 (patch)
tree5e4bb7059a174cea797348a034aef5ff829350af /testcases
parent327bca26d87332bddb5969fe93a6a2283f50a363 (diff)
downloadi3-0b89d4b2a7ae84a852a707d71cf2697e55581ee7.tar.gz
i3-0b89d4b2a7ae84a852a707d71cf2697e55581ee7.zip
implement bar { padding } config directive
related to https://github.com/i3/i3/issues/3724 related to https://github.com/i3/i3/pull/4288 fixes https://github.com/i3/i3/issues/3721
Diffstat (limited to 'testcases')
-rw-r--r--testcases/t/177-bar-config.t109
-rw-r--r--testcases/t/201-config-parser.t2
2 files changed, 110 insertions, 1 deletions
diff --git a/testcases/t/177-bar-config.t b/testcases/t/177-bar-config.t
index 27a3d23e..278fd596 100644
--- a/testcases/t/177-bar-config.t
+++ b/testcases/t/177-bar-config.t
@@ -124,6 +124,9 @@ bar {
# old syntax for compatibility with i3-gaps
height 50
+ # new syntax: top right bottom left
+ # y width height x
+ padding 4px 2px 4px 2px
}
EOT
@@ -149,6 +152,13 @@ is($bar_config->{tray_padding}, 0, 'tray_padding ok');
is($bar_config->{font}, 'Terminus', 'font ok');
is($bar_config->{socket_path}, '/tmp/foobar', 'socket_path ok');
is($bar_config->{bar_height}, 50, 'bar_height ok');
+is_deeply($bar_config->{padding},
+ {
+ x => 2,
+ y => 4,
+ width => 2,
+ height => 4,
+ }, 'padding ok');
is_deeply($bar_config->{colors},
{
background => '#ff0000',
@@ -176,6 +186,105 @@ is_deeply($bar_config->{colors},
exit_gracefully($pid);
#####################################################################
+# validate one-value padding directive
+#####################################################################
+
+$config = <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+bar {
+ # all padding is 25px
+ padding 25px
+}
+EOT
+
+$pid = launch_with_config($config);
+
+$i3 = i3(get_socket_path(0));
+$bars = $i3->get_bar_config()->recv;
+is(@$bars, 1, 'one bar configured');
+
+$bar_id = shift @$bars;
+
+$bar_config = $i3->get_bar_config($bar_id)->recv;
+is_deeply($bar_config->{padding},
+ {
+ x => 25,
+ y => 25,
+ width => 25,
+ height => 25,
+ }, 'padding ok');
+
+exit_gracefully($pid);
+
+#####################################################################
+# validate two-value padding directive
+#####################################################################
+
+$config = <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+bar {
+ # top and bottom padding is 25px, right and left padding is 50px
+ padding 25px 50px
+}
+EOT
+
+$pid = launch_with_config($config);
+
+$i3 = i3(get_socket_path(0));
+$bars = $i3->get_bar_config()->recv;
+is(@$bars, 1, 'one bar configured');
+
+$bar_id = shift @$bars;
+
+$bar_config = $i3->get_bar_config($bar_id)->recv;
+is_deeply($bar_config->{padding},
+ {
+ x => 50,
+ y => 25,
+ width => 50,
+ height => 25,
+ }, 'padding ok');
+
+exit_gracefully($pid);
+
+#####################################################################
+# validate three-value padding directive
+#####################################################################
+
+$config = <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+bar {
+ # top padding is 25px, right and left padding is 50px, bottom padding is 75px
+ padding 25px 50px 75px
+}
+EOT
+
+$pid = launch_with_config($config);
+
+$i3 = i3(get_socket_path(0));
+$bars = $i3->get_bar_config()->recv;
+is(@$bars, 1, 'one bar configured');
+
+$bar_id = shift @$bars;
+
+$bar_config = $i3->get_bar_config($bar_id)->recv;
+is_deeply($bar_config->{padding},
+ {
+ x => 50,
+ y => 25,
+ width => 50,
+ height => 75,
+ }, 'padding ok');
+
+exit_gracefully($pid);
+
+#####################################################################
# ensure that multiple bars get different IDs
#####################################################################
diff --git a/testcases/t/201-config-parser.t b/testcases/t/201-config-parser.t
index 7d81b17e..3ab18483 100644
--- a/testcases/t/201-config-parser.t
+++ b/testcases/t/201-config-parser.t
@@ -773,7 +773,7 @@ EOT
$expected = <<'EOT';
cfg_bar_start()
cfg_bar_output(LVDS-1)
-ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'i3bar_command', 'status_command', 'socket_path', 'mode', 'hidden_state', 'id', 'modifier', 'wheel_up_cmd', 'wheel_down_cmd', 'bindsym', 'position', 'output', 'tray_output', 'tray_padding', 'font', 'separator_symbol', 'binding_mode_indicator', 'workspace_buttons', 'workspace_min_width', 'strip_workspace_numbers', 'strip_workspace_name', 'verbose', 'height', 'colors', '}'
+ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'i3bar_command', 'status_command', 'socket_path', 'mode', 'hidden_state', 'id', 'modifier', 'wheel_up_cmd', 'wheel_down_cmd', 'bindsym', 'position', 'output', 'tray_output', 'tray_padding', 'font', 'separator_symbol', 'binding_mode_indicator', 'workspace_buttons', 'workspace_min_width', 'strip_workspace_numbers', 'strip_workspace_name', 'verbose', 'height', 'padding', 'colors', '}'
ERROR: CONFIG: (in file <stdin>)
ERROR: CONFIG: Line 1: bar {
ERROR: CONFIG: Line 2: output LVDS-1