diff --git a/testcases/t/74-border-config.t b/testcases/t/74-border-config.t new file mode 100644 index 00000000..c8a4d73d --- /dev/null +++ b/testcases/t/74-border-config.t @@ -0,0 +1,140 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3 +# +# Tests the new_window and new_float config option. +# + +use i3test; +use X11::XCB qw(:all); +use X11::XCB::Connection; + +my $x = X11::XCB::Connection->new; + +##################################################################### +# 1: check that new windows start with 'normal' border unless configured +# otherwise +##################################################################### + +my $config = <{border}, 'normal', 'border normal by default'); + +exit_gracefully($process->pid); + +##################################################################### +# 2: check that new tiling windows start with '1pixel' border when +# configured +##################################################################### + +$config = <{border}, '1pixel', 'border normal by default'); + +exit_gracefully($process->pid); + +##################################################################### +# 3: check that new floating windows start with 'normal' border unless +# configured otherwise +##################################################################### + +$config = <root->create_child( + class => WINDOW_CLASS_INPUT_OUTPUT, + rect => [ 0, 0, 30, 30], + background_color => '#C0C0C0', + # replace the type with 'utility' as soon as the coercion works again in X11::XCB + window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'), +); + +$first->map; + +sleep 0.25; + +my $wscontent = get_ws($tmp); +my @floating = @{$wscontent->{floating_nodes}}; +ok(@floating == 1, 'one floating container opened'); +my $floatingcon = $floating[0]; +is($floatingcon->{nodes}->[0]->{border}, 'normal', 'border normal by default'); + +exit_gracefully($process->pid); + +##################################################################### +# 4: check that new floating windows start with '1pixel' border when +# configured +##################################################################### + +$config = <root->create_child( + class => WINDOW_CLASS_INPUT_OUTPUT, + rect => [ 0, 0, 30, 30], + background_color => '#C0C0C0', + # replace the type with 'utility' as soon as the coercion works again in X11::XCB + window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'), +); + +$first->map; + +sleep 0.25; + +$wscontent = get_ws($tmp); +@floating = @{$wscontent->{floating_nodes}}; +ok(@floating == 1, 'one floating container opened'); +$floatingcon = $floating[0]; +is($floatingcon->{nodes}->[0]->{border}, '1pixel', 'border normal by default'); + +exit_gracefully($process->pid); + +done_testing;