Improve UAT on layout
* Move cucumber features regarding the layout protocol in layout/protocol; * Add new cucumber features to test uh-layout integration in uh-wm, at least simple mapping and focus behavior; * Add new acceptance testing helpers
This commit is contained in:
parent
2894783b57
commit
82a4161cc2
@ -1,16 +1,12 @@
|
|||||||
Feature: layout client management
|
Feature: layout client management
|
||||||
|
|
||||||
Scenario: sends the #<< message when telling the layout to manage a client
|
Background:
|
||||||
Given a file named layout.rb with:
|
Given uhwm is running
|
||||||
"""
|
|
||||||
class Layout
|
|
||||||
def register *_; end
|
|
||||||
|
|
||||||
def << client
|
Scenario: maps new client window
|
||||||
puts client
|
|
||||||
end
|
|
||||||
end
|
|
||||||
"""
|
|
||||||
And uhwm is running with options -v -r./layout -l Layout
|
|
||||||
When a window requests to be mapped
|
When a window requests to be mapped
|
||||||
Then the output must contain the window name
|
Then the window must be mapped
|
||||||
|
|
||||||
|
Scenario: focuses new client window
|
||||||
|
When a window requests to be mapped
|
||||||
|
Then the window must be focused
|
||||||
|
24
features/layout/protocol.feature
Normal file
24
features/layout/protocol.feature
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
Feature: layout protocol
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given a file named layout.rb with:
|
||||||
|
"""
|
||||||
|
class Layout
|
||||||
|
def register display
|
||||||
|
puts display
|
||||||
|
end
|
||||||
|
|
||||||
|
def << client
|
||||||
|
puts client
|
||||||
|
end
|
||||||
|
end
|
||||||
|
"""
|
||||||
|
|
||||||
|
Scenario: tells the layout to register with #register message
|
||||||
|
When I run uhwm with option -r./layout -l Layout
|
||||||
|
Then the output must contain current display
|
||||||
|
|
||||||
|
Scenario: tells the layout to manage a client with #<< message
|
||||||
|
Given 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
|
@ -1,13 +0,0 @@
|
|||||||
Feature: layout registration
|
|
||||||
|
|
||||||
Scenario: sends the #register message to the layout with the display
|
|
||||||
Given a file named layout.rb with:
|
|
||||||
"""
|
|
||||||
class Layout
|
|
||||||
def register display
|
|
||||||
puts display
|
|
||||||
end
|
|
||||||
end
|
|
||||||
"""
|
|
||||||
When I run uhwm with option -r./layout -l Layout
|
|
||||||
Then the output must contain current display
|
|
@ -10,3 +10,11 @@ Then /^it must connect to X display$/ do
|
|||||||
uhwm_wait_output 'Connected to'
|
uhwm_wait_output 'Connected to'
|
||||||
expect(x_socket_check uhwm_pid).to be true
|
expect(x_socket_check uhwm_pid).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then /^the window must be mapped$/ do
|
||||||
|
expect(x_window_map_state).to eq 'IsViewable'
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^the window must be focused$/ do
|
||||||
|
expect(x_focused_window_id).to eq x_window_id
|
||||||
|
end
|
||||||
|
@ -60,6 +60,10 @@ module Uh
|
|||||||
@x_client ||= XClient.new
|
@x_client ||= XClient.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def x_focused_window_id
|
||||||
|
Integer(`xdpyinfo`[/^focus:\s+window\s+(0x\h+)/, 1])
|
||||||
|
end
|
||||||
|
|
||||||
def x_key key
|
def x_key key
|
||||||
fail "cannot simulate X key `#{key}'" unless system "xdotool key #{key}"
|
fail "cannot simulate X key `#{key}'" unless system "xdotool key #{key}"
|
||||||
end
|
end
|
||||||
@ -73,6 +77,10 @@ module Uh
|
|||||||
end.any?
|
end.any?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def x_window_id
|
||||||
|
@x_client.window_id
|
||||||
|
end
|
||||||
|
|
||||||
def x_window_name
|
def x_window_name
|
||||||
@x_client.window_name
|
@x_client.window_name
|
||||||
end
|
end
|
||||||
@ -81,6 +89,10 @@ module Uh
|
|||||||
x_client.map.sync
|
x_client.map.sync
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def x_window_map_state
|
||||||
|
`xwininfo -id #{x_window_id}`[/Map State: (\w+)/, 1]
|
||||||
|
end
|
||||||
|
|
||||||
def x_clients_ensure_stop
|
def x_clients_ensure_stop
|
||||||
@x_client and @x_client.terminate
|
@x_client and @x_client.terminate
|
||||||
end
|
end
|
||||||
@ -135,6 +147,10 @@ module Uh
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def window_id
|
||||||
|
@window.id
|
||||||
|
end
|
||||||
|
|
||||||
def window_name
|
def window_name
|
||||||
@name
|
@name
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user