spec/spec_helper.rb in win_gui-0.2.10 vs spec/spec_helper.rb in win_gui-0.2.12
- old
+ new
@@ -28,18 +28,13 @@
# Test related Constants:
TIMEOUT = 0.001
KEY_DELAY = 0.001
SLEEP_DELAY = 0.01
APP_PATH = File.join(File.dirname(__FILE__), "../misc/locknote/LockNote.exe" )
- APP_START = RUBY_PLATFORM =~ /cygwin/ ? "cmd /c start `cygpath -w #{APP_PATH}`" : "start #{APP_PATH}"
- # 'start "" "' + APP_PATH + '"'
DIALOG_TITLE = "Save As"
WIN_TITLE = 'LockNote - Steganos LockNote'
WIN_CLASS = 'ATL:00434098'
- WIN_RECT = [710, 400, 1210, 800]
- MAX_RECT = [-4, -4, 1924, 1204] # on my 1920x1200 display
- MIN_RECT = [-32000, -32000, -31840, -31976]
TEXTAREA_CLASS = 'ATL:00434310'
STATUSBAR_CLASS = 'msctls_statusbar32'
IMPOSSIBLE = 'Impossible'
ERROR_CONVERSION = /Can.t convert/
@@ -59,22 +54,16 @@
def any_block
lambda {|*args| args}
end
def launch_test_app
- system APP_START
- @test_app = Window.top_level( title: WIN_TITLE, timeout: 10)
-
- def @test_app.textarea #define singleton method retrieving app's text area
- Window.new WinGui::find_window_ex(self.handle, 0, TEXTAREA_CLASS, nil)
- end
-
- @test_app
+ #system APP_START
+ @test_app = App.launch( path: APP_PATH, title: WIN_TITLE, timeout: 1)
end
def close_test_app
- while @test_app && find_window(nil, WIN_TITLE)
+ while @test_app && @test_app.main_window.window?
@test_app.close
# Dealing with closing confirmation modal dialog
if dialog = dialog( title: "Steganos Locknote", timeout: SLEEP_DELAY)
dialog.set_foreground_window
keystroke("N")
@@ -83,11 +72,10 @@
@test_app = nil
end
# Creates test app object and yields it back to the block
def test_app
- test_app = launch_test_app
- yield test_app
+ yield launch_test_app
close_test_app
end
def with_dialog(type=:close)
case type