Accept window names in x_window_map_state test helper

This commit is contained in:
Thibault Jouan 2015-04-29 02:36:36 +00:00
parent f26e16fe6e
commit 97abd402b1

View File

@ -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}" fail "cannot simulate X key `#{k}'" unless system "xdotool key #{k}"
end end
def x_window_map_state window_id def x_window_map_state window_selector
`xwininfo -id #{window_id}`[/Map State: (\w+)/, 1] 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 end