diff --git a/features/layout/manage.feature b/features/layout/manage.feature new file mode 100644 index 0000000..cca14f8 --- /dev/null +++ b/features/layout/manage.feature @@ -0,0 +1,18 @@ +Feature: layout client management + + Scenario: sends the #<< message when telling the layout to manage a client + Given a file named layout.rb with: + """ + class Layout + def register *_; end + + def << client + # FIXME: need the Manager to manage state with clients, not windows + #puts client.wname + puts client.name + end + end + """ + And uhwm is running with options -v -r./layout -l Layout + When a window requests to be mapped + Then the output must contain the window name diff --git a/features/steps/output_steps.rb b/features/steps/output_steps.rb index e55109e..73cd67f 100644 --- a/features/steps/output_steps.rb +++ b/features/steps/output_steps.rb @@ -27,3 +27,7 @@ end Then /^the output must contain current display$/ do uhwm_wait_output ENV['DISPLAY'] end + +Then /^the output must contain the window name$/ do + uhwm_wait_output x_window_name +end diff --git a/features/steps/run_steps.rb b/features/steps/run_steps.rb index d72b716..790e57d 100644 --- a/features/steps/run_steps.rb +++ b/features/steps/run_steps.rb @@ -6,6 +6,10 @@ Given /^uhwm is running$/ do uhwm_run_wait_ready end +Given /^uhwm is running with options? (-.+)$/ do |options| + uhwm_run_wait_ready options +end + Given /^uhwm is running with this run control file:$/ do |rc| write_file '.uhwmrc.rb', rc uhwm_run_wait_ready diff --git a/features/steps/x_steps.rb b/features/steps/x_steps.rb index c2950e7..e7a1544 100644 --- a/features/steps/x_steps.rb +++ b/features/steps/x_steps.rb @@ -2,6 +2,10 @@ When /^I press the ([^ ]+) keys?$/ do |keys| x_key keys end +When /^a window requests to be mapped$/ do + x_window_map +end + Then /^it must connect to X display$/ do uhwm_wait_output 'Connected to' expect(x_socket_check uhwm_pid).to be true diff --git a/lib/uh/wm/testing/acceptance_helpers.rb b/lib/uh/wm/testing/acceptance_helpers.rb index d28f6fc..27a0bfb 100644 --- a/lib/uh/wm/testing/acceptance_helpers.rb +++ b/lib/uh/wm/testing/acceptance_helpers.rb @@ -66,6 +66,14 @@ module Uh `sockstat -u`.lines.grep /\s+ruby.+\s+#{pid}/ end.any? end + + def x_window_name + 'Event Tester' + end + + def x_window_map + spawn 'xev -event owner_grab_button' + end end end end