From 9cd4b5323180d97ca68e5d7ff7772ccf2789e334 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 24 Jul 2016 20:43:09 -0400 Subject: [PATCH] testcases: remove assumption from state atoms test Remove the assumption that only two atoms can possibly be set in t/253-multiple-net-wm-state-atoms.t so that the tests will pass when more atoms are supported that may be set during this test. --- testcases/t/253-multiple-net-wm-state-atoms.t | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/testcases/t/253-multiple-net-wm-state-atoms.t b/testcases/t/253-multiple-net-wm-state-atoms.t index 392beae1..3a3e7c6e 100644 --- a/testcases/t/253-multiple-net-wm-state-atoms.t +++ b/testcases/t/253-multiple-net-wm-state-atoms.t @@ -36,7 +36,7 @@ sub get_wm_state { return undef if $len == 0; my @atoms = unpack("L$len", $reply->{value}); - return \@atoms; + return @atoms; } my $wm_state_sticky = $x->atom(name => '_NET_WM_STATE_STICKY')->id; @@ -51,18 +51,24 @@ my $wm_state_fullscreen = $x->atom(name => '_NET_WM_STATE_FULLSCREEN')->id; fresh_workspace; my $window = open_window; cmd 'sticky enable'; -is_deeply(get_wm_state($window), [ $wm_state_sticky ], 'sanity check: _NET_WM_STATE_STICKY is set'); +my @state = get_wm_state($window); +ok((scalar grep { $_ == $wm_state_sticky } @state) > 0, 'sanity check: _NET_WM_STATE_STICKY is set'); cmd 'fullscreen enable'; -is_deeply(get_wm_state($window), [ $wm_state_sticky, $wm_state_fullscreen ], - 'both _NET_WM_STATE_FULLSCREEN and _NET_WM_STATE_STICKY are set'); +@state = get_wm_state($window); +ok((scalar grep { $_ == $wm_state_sticky } @state) > 0, '_NET_WM_STATE_STICKY is set'); +ok((scalar grep { $_ == $wm_state_fullscreen } @state) > 0, '_NET_WM_STATE_FULLSCREEN is set'); cmd 'sticky disable'; -is_deeply(get_wm_state($window), [ $wm_state_fullscreen ], 'only _NET_WM_STATE_FULLSCREEN is set'); +@state = get_wm_state($window); +ok((scalar grep { $_ == $wm_state_sticky } @state) == 0, '_NET_WM_STATE_STICKY is not set'); +ok((scalar grep { $_ == $wm_state_fullscreen } @state) > 0, '_NET_WM_STATE_FULLSCREEN is set'); cmd 'sticky enable'; cmd 'fullscreen disable'; -is_deeply(get_wm_state($window), [ $wm_state_sticky ], 'only _NET_WM_STATE_STICKY is set'); +@state = get_wm_state($window); +ok((scalar grep { $_ == $wm_state_sticky } @state) > 0, '_NET_WM_STATE_STICKY is set'); +ok((scalar grep { $_ == $wm_state_fullscreen } @state) == 0, '_NET_WM_STATE_FULLSCREEN is not set'); ############################################################################### # _NET_WM_STATE is removed when the window is withdrawn. @@ -71,7 +77,8 @@ is_deeply(get_wm_state($window), [ $wm_state_sticky ], 'only _NET_WM_STATE_STICK fresh_workspace; $window = open_window; cmd 'sticky enable'; -is_deeply(get_wm_state($window), [ $wm_state_sticky ], 'sanity check: _NET_WM_STATE_STICKY is set'); +@state = get_wm_state($window); +ok((scalar grep { $_ == $wm_state_sticky } @state) > 0, '_NET_WM_STATE_STICKY is set'); $window->unmap; wait_for_unmap($window); -- 2.39.5