win_gui 0.2.12 → 0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +4 -0
- data/VERSION +1 -1
- data/lib/win_gui/application.rb +3 -1
- data/spec/win_gui/application_spec.rb +19 -14
- metadata +4 -4
data/HISTORY
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.13
|
data/lib/win_gui/application.rb
CHANGED
@@ -17,8 +17,10 @@ module WinGui
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
# Exits application (optionally waiting _timeout_ seconds for main window to close)
|
21
|
+
def close(timeout=nil)
|
21
22
|
@main_window.close
|
23
|
+
@main_window.wait_for_close(timeout) if timeout
|
22
24
|
end
|
23
25
|
alias_method :exit, :close
|
24
26
|
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "..", "spec_helper"
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
2
2
|
|
3
3
|
module WinGuiTest
|
4
4
|
|
5
5
|
describe App do
|
6
|
-
after(:each) do
|
6
|
+
after(:each) do # Reliably closes launched app window (without calling close_test_app)
|
7
7
|
app = App.find(title: WIN_TITLE)
|
8
8
|
app.exit if app
|
9
9
|
end
|
@@ -11,7 +11,7 @@ module WinGuiTest
|
|
11
11
|
context 'initializing' do
|
12
12
|
context '::new' do
|
13
13
|
before(:each) { launch_test_app }
|
14
|
-
after(:each){ close_test_app }
|
14
|
+
after(:each) { close_test_app }
|
15
15
|
|
16
16
|
it 'wraps new App around existing Window' do
|
17
17
|
window = Window.top_level(title: WIN_TITLE)
|
@@ -28,19 +28,19 @@ module WinGuiTest
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'raises error trying to create App with wrong init args' do
|
31
|
-
expect{ App.new() }.to raise_error ArgumentError, /wrong number of arguments/
|
31
|
+
expect { App.new() }.to raise_error ArgumentError, /wrong number of arguments/
|
32
32
|
[[nil], 1.2, {title: WIN_TITLE}].each do |args|
|
33
|
-
expect{ App.new(*args) }.to raise_error WinGui::Errors::InitError
|
33
|
+
expect { App.new(*args) }.to raise_error WinGui::Errors::InitError
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
context '::find' do
|
39
39
|
before(:each) { launch_test_app }
|
40
|
-
after(:each){ close_test_app }
|
40
|
+
after(:each) { close_test_app }
|
41
41
|
|
42
42
|
it 'finds already launched App given valid Window info' do
|
43
|
-
use{ @app = App.find(title: WIN_TITLE) }
|
43
|
+
use { @app = App.find(title: WIN_TITLE) }
|
44
44
|
@app.should be_an App
|
45
45
|
end
|
46
46
|
|
@@ -49,28 +49,26 @@ module WinGuiTest
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'raises error only if asked to find App with invalid Window info and :raise option is set' do
|
52
|
-
expect{ App.find(title: IMPOSSIBLE, raise: WinGui::Errors::InitError) }.
|
52
|
+
expect { App.find(title: IMPOSSIBLE, raise: WinGui::Errors::InitError) }.
|
53
53
|
to raise_error WinGui::Errors::InitError
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
context '::launch' do
|
58
|
-
|
59
58
|
it 'launches new App given valid path and Window info' do
|
60
|
-
use{ @app = App.launch(path: APP_PATH, title: WIN_TITLE) }
|
59
|
+
use { @app = App.launch(path: APP_PATH, title: WIN_TITLE) }
|
61
60
|
@app.should be_an App
|
62
61
|
end
|
63
62
|
|
64
63
|
it 'raises error if asked to launch App with invalid path' do
|
65
|
-
expect{ App.launch(path: IMPOSSIBLE, title: WIN_TITLE) }.
|
64
|
+
expect { App.launch(path: IMPOSSIBLE, title: WIN_TITLE) }.
|
66
65
|
to raise_error WinGui::Errors::InitError, /Unable to launch "Impossible"/
|
67
66
|
end
|
68
67
|
|
69
68
|
it 'raises error if asked to launch App with invalid Window info' do
|
70
|
-
expect{ App.launch(path: APP_PATH, title: IMPOSSIBLE) }.
|
69
|
+
expect { App.launch(path: APP_PATH, title: IMPOSSIBLE) }.
|
71
70
|
to raise_error WinGui::Errors::InitError, /Unable to launch App with .*?:title=>"Impossible"/
|
72
71
|
end
|
73
|
-
|
74
72
|
end
|
75
73
|
|
76
74
|
context 'properties:' do
|
@@ -85,7 +83,7 @@ module WinGuiTest
|
|
85
83
|
end
|
86
84
|
|
87
85
|
context 'manipulating' do
|
88
|
-
before(:each) {@app = App.launch(path: APP_PATH, title: WIN_TITLE)}
|
86
|
+
before(:each) { @app = App.launch(path: APP_PATH, title: WIN_TITLE) }
|
89
87
|
|
90
88
|
it 'exits App gracefully' do
|
91
89
|
@app.exit
|
@@ -100,6 +98,13 @@ module WinGuiTest
|
|
100
98
|
@app.main_window.visible?.should == false
|
101
99
|
@app.main_window.window?.should == false
|
102
100
|
end
|
101
|
+
|
102
|
+
it 'exits App with timeout' do
|
103
|
+
@app.exit(1)
|
104
|
+
# No sleep SLEEP_DELAY needed!
|
105
|
+
@app.main_window.visible?.should == false
|
106
|
+
@app.main_window.window?.should == false
|
107
|
+
end
|
103
108
|
end
|
104
109
|
end
|
105
110
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win_gui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 13
|
10
|
+
version: 0.2.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- arvicco
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-04 00:00:00 +04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|