From 26bac5aea9e95af767eea41df140f00f29573080 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Sat, 18 Apr 2015 20:11:04 +0000 Subject: [PATCH] Test that manager listen to appropriate events --- features/manager/input_events.feature | 8 ++++++++ features/steps/x_steps.rb | 4 ++++ lib/uh/wm/testing/acceptance_helpers.rb | 4 ++++ 3 files changed, 16 insertions(+) create mode 100644 features/manager/input_events.feature diff --git a/features/manager/input_events.feature b/features/manager/input_events.feature new file mode 100644 index 0000000..f2868a1 --- /dev/null +++ b/features/manager/input_events.feature @@ -0,0 +1,8 @@ +Feature: input events selection + + Scenario: selects the appropriate input event mask for a window manager + Given uhwm is running + Then the input event mask must include StructureNotifyMask + And the input event mask must include SubstructureNotifyMask + And the input event mask must include SubstructureRedirectMask + And the input event mask must include PropertyChangeMask diff --git a/features/steps/x_steps.rb b/features/steps/x_steps.rb index 5a40dc1..735e65a 100644 --- a/features/steps/x_steps.rb +++ b/features/steps/x_steps.rb @@ -18,3 +18,7 @@ end Then /^the window must be focused$/ do expect(x_focused_window_id).to eq x_window_id end + +Then /^the input event mask must include (.+)$/ do |mask| + expect(x_input_event_masks).to include mask +end diff --git a/lib/uh/wm/testing/acceptance_helpers.rb b/lib/uh/wm/testing/acceptance_helpers.rb index 829fdd0..7e63216 100644 --- a/lib/uh/wm/testing/acceptance_helpers.rb +++ b/lib/uh/wm/testing/acceptance_helpers.rb @@ -64,6 +64,10 @@ module Uh Integer(`xdpyinfo`[/^focus:\s+window\s+(0x\h+)/, 1]) end + def x_input_event_masks + `xdpyinfo`[/current input event mask:\s+0x\h+([\w\s]+):/, 1].split(/\s+/).grep /Mask\z/ + end + def x_key key fail "cannot simulate X key `#{key}'" unless system "xdotool key #{key}" end