From 5542af316f2e67448630643314a490926239299f Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 18 Sep 2011 16:05:54 +0100 Subject: [PATCH] t/65-for_window: add tests for window_role --- testcases/t/65-for_window.t | 103 ++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/testcases/t/65-for_window.t b/testcases/t/65-for_window.t index fb4c2812..1746d117 100644 --- a/testcases/t/65-for_window.t +++ b/testcases/t/65-for_window.t @@ -349,5 +349,108 @@ is($content[0]->{border}, 'normal', 'normal border'); exit_gracefully($process->pid); +############################################################## +# 8: check that the role criterion works properly +############################################################## + +# this configuration is broken because "asdf" is not a valid integer +# the for_window should therefore recognize this error and don’t add the +# assignment +$config = <root->create_child( + class => WINDOW_CLASS_INPUT_OUTPUT, + rect => [ 0, 0, 30, 30 ], + background_color => '#00ff00', +); + +$window->_create; + +my $atomname = $x->atom(name => 'WM_WINDOW_ROLE'); +my $atomtype = $x->atom(name => 'STRING'); +$x->change_property( + PROP_MODE_REPLACE, + $window->id, + $atomname->id, + $atomtype->id, + 8, + length("i3test") + 1, + "i3test\x00" +); + +$window->name('usethis'); +$window->map; +sleep 0.25; + +@content = @{get_ws_content($tmp)}; +cmp_ok(@content, '==', 1, 'one node on this workspace now'); +is($content[0]->{border}, 'none', 'no border (window_role)'); + +exit_gracefully($process->pid); + +############################################################## +# 9: another test for the window_role, but this time it changes +# *after* the window has been mapped +############################################################## + +# this configuration is broken because "asdf" is not a valid integer +# the for_window should therefore recognize this error and don’t add the +# assignment +$config = <root->create_child( + class => WINDOW_CLASS_INPUT_OUTPUT, + rect => [ 0, 0, 30, 30 ], + background_color => '#00ff00', +); + +$window->_create; + +$window->name('usethis'); +$window->map; +sleep 0.25; + +@content = @{get_ws_content($tmp)}; +cmp_ok(@content, '==', 1, 'one node on this workspace now'); +is($content[0]->{border}, 'normal', 'normal border (window_role 2)'); + +$atomname = $x->atom(name => 'WM_WINDOW_ROLE'); +$atomtype = $x->atom(name => 'STRING'); +$x->change_property( + PROP_MODE_REPLACE, + $window->id, + $atomname->id, + $atomtype->id, + 8, + length("i3test") + 1, + "i3test\x00" +); + +$x->flush; + +sleep 0.25; + +@content = @{get_ws_content($tmp)}; +cmp_ok(@content, '==', 1, 'one node on this workspace now'); +is($content[0]->{border}, 'none', 'no border (window_role 2)'); + +exit_gracefully($process->pid); + done_testing; -- 2.39.5