#!perl
# vim:ts=4:sw=4:expandtab
-# !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3
#
# Checks that the bar config is parsed correctly.
#
-use i3test;
+use i3test i3_autostart => 0;
#####################################################################
# test a config without any bars
is($bar_config->{status_command}, 'i3status --foo', 'status_command correct');
ok(!$bar_config->{verbose}, 'verbose off by default');
ok($bar_config->{workspace_buttons}, 'workspace buttons enabled per default');
-is($bar_config->{mode}, 'hide', 'hide mode by default');
+is($bar_config->{mode}, 'dock', 'dock mode by default');
is($bar_config->{position}, 'bottom', 'position bottom by default');
+#####################################################################
+# ensure that reloading cleans up the old bar configs
+#####################################################################
+
+cmd 'reload';
+$bars = $i3->get_bar_config()->recv;
+is(@$bars, 1, 'still one bar configured');
+
exit_gracefully($pid);
#####################################################################
is($bar_config->{socket_path}, '/tmp/foobar', 'socket_path ok');
is_deeply($bar_config->{colors},
{
- background => 'ff0000',
- statusline => '00ff00',
- focused_workspace_text => 'ffffff',
- focused_workspace_bg => '285577',
- active_workspace_text => '888888',
- active_workspace_bg => '222222',
- inactive_workspace_text => '888888',
- inactive_workspace_bg => '222222',
- urgent_workspace_text => 'ffffff',
- urgent_workspace_bg => '900000',
+ background => '#ff0000',
+ statusline => '#00ff00',
+ focused_workspace_text => '#ffffff',
+ focused_workspace_bg => '#285577',
+ active_workspace_text => '#888888',
+ active_workspace_bg => '#222222',
+ inactive_workspace_text => '#888888',
+ inactive_workspace_bg => '#222222',
+ urgent_workspace_text => '#ffffff',
+ urgent_workspace_bg => '#900000',
}, 'colors ok');
exit_gracefully($pid);
exit_gracefully($pid);
+#####################################################################
+# make sure comments work properly
+#####################################################################
+
+$config = <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+bar {
+ # Start a default instance of i3bar which provides workspace buttons.
+ # Additionally, i3status will provide a statusline.
+ status_command i3status --bar
+ #status_command i3status --qux
+#status_command i3status --qux
+
+ output HDMI1
+ colors {
+ background #000000
+ #background #ffffff
+ }
+}
+EOT
+
+$pid = launch_with_config($config);
+
+$i3 = i3(get_socket_path(0));
+$bars = $i3->get_bar_config()->recv;
+$bar_id = shift @$bars;
+
+$bar_config = $i3->get_bar_config($bar_id)->recv;
+is($bar_config->{status_command}, 'i3status --bar', 'status_command correct');
+is($bar_config->{colors}->{background}, '#000000', 'background color ok');
+
+exit_gracefully($pid);
+
done_testing;