From 29f2b4725df7e66282790d5b0996ff5e996e5d07 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 21 Apr 2015 02:21:40 +0000 Subject: [PATCH] Test how manager should handle destroyed windows --- features/manager/unmanage.feature | 8 +++++++- features/steps/x_steps.rb | 4 ++++ lib/uh/wm/testing/acceptance_helpers.rb | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/features/manager/unmanage.feature b/features/manager/unmanage.feature index 5851243..04aa073 100644 --- a/features/manager/unmanage.feature +++ b/features/manager/unmanage.feature @@ -1,7 +1,13 @@ Feature: manager client unmanagement - Scenario: logs when a new client is unmanaged + Background: Given uhwm is running And a window is mapped + + Scenario: logs when a new client is unmanaged When the window requests to be unmapped Then the output must match /unmanag.+xclient/i + + Scenario: unmanages client on destroy notify X events + When the window is destroyed + Then the output must match /unmanag.+xclient/i diff --git a/features/steps/x_steps.rb b/features/steps/x_steps.rb index 84629f9..ca19392 100644 --- a/features/steps/x_steps.rb +++ b/features/steps/x_steps.rb @@ -26,6 +26,10 @@ When /^a window requests to be mapped (\d+) times$/ do |times| x_window_map times: times.to_i end +When /^the window is destroyed$/ do + x_window_destroy +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 4278e17..d8256f1 100644 --- a/lib/uh/wm/testing/acceptance_helpers.rb +++ b/lib/uh/wm/testing/acceptance_helpers.rb @@ -106,6 +106,11 @@ module Uh x_client(options).sync end + def x_window_destroy **options + x_client(options).destroy + x_client(options).sync + end + def x_clients_ensure_stop @x_clients and @x_clients.any? and @x_clients.values.each &:terminate end @@ -177,6 +182,11 @@ module Uh window.unmap self end + + def destroy + window.destroy + self + end end end end