X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=blobdiff_plain;f=testcases%2Ft%2F189-floating-constraints.t;h=4ac95e1563d018d3d02f0d59c94d037dbb244a91;hp=6b082bfdcb1bab61bbe2a108fd8bc9e47ccb3272;hb=690e6d1f0e62437c06918ee21484cfafbce336ac;hpb=2b898f4c902ab51fd8a5112043ed224aea4cfa4f diff --git a/testcases/t/189-floating-constraints.t b/testcases/t/189-floating-constraints.t index 6b082bfd..4ac95e15 100644 --- a/testcases/t/189-floating-constraints.t +++ b/testcases/t/189-floating-constraints.t @@ -21,6 +21,7 @@ # use i3test i3_autostart => 0; +use X11::XCB qw/PROP_MODE_REPLACE/; ################################################################################ # 1: check floating_minimum_size (with non-default limits) @@ -218,4 +219,82 @@ is($rect->{height}, 70, 'height did not exceed minimum height'); exit_gracefully($pid); +################################################################################ +# 8: check minimum_size and maximum_size set by WM_NORMAL_HINTS +################################################################################ + +$config = < sub { + my ($window) = @_; + + my $atomname = $x->atom(name => 'WM_NORMAL_HINTS'); + my $atomtype = $x->atom(name => 'WM_SIZE_HINTS'); + $x->change_property( + PROP_MODE_REPLACE, + $window->id, + $atomname->id, + $atomtype->id, + 32, + 13, + pack('C5N8', $flags, $pad, $pad, $pad, $pad, 0, 0, 0, $min_width, $min_height, $max_width, $max_height), + ); + }, + ); + + return $window; +} + +my sub check_minsize { + is($window->rect->{width}, $min_width, 'width = min_width'); + is($window->rect->{height}, $min_height, 'height = min_height'); +} + +my sub check_maxsize { + is($window->rect->{width}, $max_width, 'width = max_width'); + is($window->rect->{height}, $max_height, 'height = max_height'); +} + +$pid = launch_with_config($config); + +$window = open_with_max_size; +cmd 'floating enable'; +cmd 'border none'; +sync_with_i3; + +cmd "resize set $min_width px $min_height px"; +check_minsize; + +# Try to resize below minimum width +cmd 'resize set ' . ($min_width - 10) . ' px ' . ($min_height - 50) . ' px'; +check_minsize; + +cmd "resize set $max_width px $max_height px"; +check_maxsize; + +# Try to resize above maximum width +cmd 'resize set ' . ($max_width + 150) . ' px ' . ($max_height + 500) . ' px'; +check_maxsize; + +exit_gracefully($pid); + done_testing;