From 97abd402b1a39b69d1679e318d59e91691861d6f Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 02:36:36 +0000 Subject: [PATCH] Accept window names in x_window_map_state test helper --- lib/uh/wm/testing/acceptance_helpers.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/uh/wm/testing/acceptance_helpers.rb b/lib/uh/wm/testing/acceptance_helpers.rb index 4ef50f7..bf86f5e 100644 --- a/lib/uh/wm/testing/acceptance_helpers.rb +++ b/lib/uh/wm/testing/acceptance_helpers.rb @@ -89,8 +89,14 @@ expected `#{message}' (#{times}) not seen after #{e.timeout} seconds in: fail "cannot simulate X key `#{k}'" unless system "xdotool key #{k}" end - def x_window_map_state window_id - `xwininfo -id #{window_id}`[/Map State: (\w+)/, 1] + def x_window_map_state window_selector + select_args = case window_selector + when Integer then "-id #{window_selector}" + when String then "-name #{window_selector}" + else fail ArgumentError, + "not an Integer nor a String: `#{window_selector.inspect}'" + end + `xwininfo #{select_args}`[/Map State: (\w+)/, 1] end