5
require File.join(File.dirname(__FILE__), '../xwindow')
6
require File.join(File.dirname(__FILE__), '../keyboard')
8
class WindowTest < Test::Unit::TestCase
10
attr_accessor :xwindow
12
#The command used to create new windows.
13
#The program MUST NOT start maximized. xdotool has no possibility of
14
#acting on maximized windows.
15
NEW_WINDOW_NAME = "Home"
16
NEW_WINDOW_CMD = "nautilus"
21
@editor_pipe = IO.popen(NEW_WINDOW_CMD, 'r')
22
XDo::XWindow.wait_for_window(Regexp.new(Regexp.escape(NEW_WINDOW_NAME)))
23
@@xwin = XDo::XWindow.from_title(Regexp.new(Regexp.escape(NEW_WINDOW_NAME)))
29
# Process.kill 'TERM', @editor_pipe.pid
33
def test_ewmh_active_window
35
XDo::XWindow.from_active
37
#Standard not available
42
def test_ewmh_wm_desktop
44
XDo::XWindow.desktop_num
46
#Standard not available
51
def test_ewmh_current_desktop
55
#Standard not available
61
assert_equal(true, XDo::XWindow.exists?(@@xwin.title))
66
# assert_not_equal(@@xwin.id, XDo::XWindow.from_focused.id) # not supported by WM
67
# assert_raise(XDo::XError){XDo::XWindow.from_active} #Nothing's active anymore
72
assert_equal(@@xwin.id, XDo::XWindow.from_active.id)
78
assert_equal(@@xwin.id, XDo::XWindow.from_focused.id)
83
assert_in_delta(87, 3, @@xwin.abs_position[0])
84
assert_in_delta(57, 3, @@xwin.abs_position[1])
85
# assert_equal(@@xwin.abs_position, @@xwin.rel_position) - why should this succeed?
89
@@xwin.resize(500, 500)
90
assert_equal([500, 500], @@xwin.size)
95
assert_equal(nil, @@xwin.visible?)
97
assert_block("Window is not visible."){@@xwin.visible?.kind_of?(Integer)}