win_gui 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +59 -1
- data/VERSION +1 -1
- data/lib/win_gui/constants.rb +63 -52
- data/lib/win_gui/def_api.rb +76 -25
- data/lib/win_gui/win_gui.rb +249 -105
- data/spec/spec_helper.rb +32 -25
- data/spec/win_gui/def_api_spec.rb +172 -121
- data/spec/win_gui/win_gui_spec.rb +9 -1
- data/win_gui.gemspec +2 -2
- metadata +2 -2
@@ -2,177 +2,213 @@ require File.join(File.dirname(__FILE__), "..", "spec_helper" )
|
|
2
2
|
|
3
3
|
module GuiTest
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
def should_be symbol, api
|
6
|
+
case symbol
|
7
|
+
when :find_window
|
8
|
+
api.dll_name.should == 'user32' # The name of the DLL that exports the API function
|
9
|
+
api.effective_function_name.should == 'FindWindowA' # Actual function returned by the constructor: 'GetUserName' ->'GetUserNameA' or 'GetUserNameW'
|
10
|
+
api.function_name.should == 'FindWindow' # The name of the function passed to the constructor
|
11
|
+
api.prototype.should == ['P', 'P'] # The prototype, returned as an array of characters
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def redefined_methods
|
16
|
+
[:find_window, :is_window, :window?, :enum_windows, :get_computer_name, :computer_name]
|
17
|
+
end
|
18
|
+
|
19
|
+
def should_count_args(*methods, rights, wrongs)
|
20
|
+
rights = [rights].flatten
|
21
|
+
wrongs = [wrongs].flatten
|
22
|
+
methods.each do |method|
|
23
|
+
(1..8).each do |n|
|
24
|
+
if n == rights.size
|
25
|
+
expect {send method, *rights}.to_not raise_error
|
26
|
+
else
|
27
|
+
args = (1..n).map {wrongs[rand(wrongs.size)]}
|
28
|
+
expect {send method, *args}.
|
29
|
+
to raise_error "wrong number of parameters: expected #{rights.size}, got #{args.size}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
8
34
|
|
9
35
|
describe WinGui::DefApi, 'defines wrappers for Win32::API functions' do
|
10
|
-
before(:each) { hide_method
|
11
|
-
after(:each) { restore_method
|
36
|
+
before(:each) { hide_method *redefined_methods } # hide original methods if defined
|
37
|
+
after(:each) { restore_method *redefined_methods } # restore original methods if hidden
|
12
38
|
|
13
|
-
context 'defining
|
14
|
-
spec{ use{ WinGui.def_api('
|
39
|
+
context 'defining enhanced API function method' do
|
40
|
+
spec{ use{ WinGui.def_api('FindWindow', 'PP', 'L', rename: nil, aliases: nil, boolean: nil, zeronil: nil, &any_block) }}
|
15
41
|
|
16
|
-
it 'defines new instance
|
17
|
-
WinGui.def_api '
|
18
|
-
respond_to?(:
|
42
|
+
it 'defines new instance methods with appropriate names' do
|
43
|
+
WinGui.def_api 'FindWindow', 'PP', 'L'
|
44
|
+
respond_to?(:find_window).should be_true
|
45
|
+
respond_to?(:FindWindow).should be_true
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'constructs argument prototype from uppercase string, enforces the args count' do
|
49
|
+
expect { WinGui.def_api 'FindWindow', 'PP', 'L' }.to_not raise_error
|
50
|
+
should_count_args :find_window, :FindWindow, [nil, nil], [nil, TEST_IMPOSSIBLE, 'cmd']
|
19
51
|
end
|
20
52
|
|
21
|
-
it 'constructs argument prototype from
|
22
|
-
expect { WinGui.def_api '
|
23
|
-
|
24
|
-
expect { find_window_w(nil, nil) }.to_not raise_error 'Invalid args count'
|
53
|
+
it 'constructs argument prototype from lowercase string, enforces the args count' do
|
54
|
+
expect { WinGui.def_api 'FindWindow', 'pp', 'l' }.to_not raise_error
|
55
|
+
should_count_args :find_window, :FindWindow, [nil, nil], [nil, TEST_IMPOSSIBLE, 'cmd']
|
25
56
|
end
|
26
57
|
|
27
|
-
it 'constructs argument prototype from
|
28
|
-
expect { WinGui.def_api '
|
29
|
-
|
30
|
-
expect { find_window_w(nil, nil) }.to_not raise_error 'Invalid args count'
|
58
|
+
it 'constructs argument prototype from (mixedcase) array, enforces the args count' do
|
59
|
+
expect { WinGui.def_api 'FindWindow', ['p', 'P'], 'L' }.to_not raise_error
|
60
|
+
should_count_args :find_window, :FindWindow, [nil, nil], [nil, TEST_IMPOSSIBLE, 'cmd']
|
31
61
|
end
|
32
62
|
|
33
|
-
it '
|
34
|
-
|
35
|
-
expect {
|
36
|
-
expect {
|
63
|
+
it 'with :rename option, overrides snake_case name for defined method but leaves CamelCase intact' do
|
64
|
+
WinGui.def_api 'FindWindow', 'PP', 'L', :rename=> 'my_own_find'
|
65
|
+
expect {find_window(nil, nil)}.to raise_error NoMethodError
|
66
|
+
expect {FindWindow(nil, nil)}.to_not raise_error
|
67
|
+
expect {my_own_find(nil, nil)}.to_not raise_error
|
37
68
|
end
|
38
69
|
|
39
|
-
it '
|
70
|
+
it 'defined snake_case method returns expected value when called' do
|
71
|
+
WinGui.def_api 'FindWindow', 'PP', 'L'
|
72
|
+
find_window(nil, nil).should_not == 0
|
73
|
+
find_window(nil, TEST_IMPOSSIBLE).should == 0
|
74
|
+
find_window(TEST_IMPOSSIBLE, nil).should == 0
|
75
|
+
find_window(TEST_IMPOSSIBLE, TEST_IMPOSSIBLE).should == 0
|
76
|
+
end
|
40
77
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
78
|
+
it 'defined CamelCase method returns expected value when called' do
|
79
|
+
WinGui.def_api 'FindWindow', 'PP', 'L'
|
80
|
+
FindWindow(nil, nil).should_not == 0
|
81
|
+
FindWindow(nil, TEST_IMPOSSIBLE).should == 0
|
82
|
+
FindWindow(TEST_IMPOSSIBLE, nil).should == 0
|
83
|
+
FindWindow(TEST_IMPOSSIBLE, TEST_IMPOSSIBLE).should == 0
|
46
84
|
end
|
47
85
|
|
48
|
-
it '
|
49
|
-
WinGui.def_api '
|
50
|
-
expect {
|
51
|
-
|
86
|
+
it 'returns underlying Win32::API object if defined method is called with (:api) argument ' do
|
87
|
+
WinGui.def_api 'FindWindow', 'PP', 'L'
|
88
|
+
expect {find_window(:api)}.to_not raise_error
|
89
|
+
should_be :find_window, find_window(:api)
|
52
90
|
end
|
91
|
+
end
|
53
92
|
|
93
|
+
context 'defining aliases' do
|
54
94
|
it 'adds alias for defined method with :alias option' do
|
55
|
-
WinGui.def_api '
|
56
|
-
expect {
|
95
|
+
WinGui.def_api 'FindWindow', 'PP', 'L', :alias => 'my_own_find'
|
96
|
+
expect {find_window(nil, nil)}.to_not raise_error
|
57
97
|
expect {my_own_find(nil, nil)}.to_not raise_error
|
58
98
|
end
|
59
99
|
|
60
100
|
it 'adds aliases for defined method with :aliases option' do
|
61
|
-
WinGui.def_api '
|
62
|
-
expect {
|
101
|
+
WinGui.def_api 'FindWindow', 'PP', 'L', :aliases => ['my_own_find', 'my_own_find1']
|
102
|
+
expect {find_window(nil, nil)}.to_not raise_error
|
63
103
|
expect {my_own_find(nil, nil)}.to_not raise_error
|
64
104
|
expect {my_own_find1(nil, nil)}.to_not raise_error
|
65
105
|
end
|
66
106
|
|
67
|
-
it '
|
68
|
-
WinGui.def_api '
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
it 'defined method returns expected value when called' do
|
73
|
-
WinGui.def_api 'FindWindowW', 'PP', 'L'
|
74
|
-
find_window_w(nil, nil).should_not == 0
|
75
|
-
find_window_w(nil, TEST_IMPOSSIBLE).should == 0
|
76
|
-
find_window_w(TEST_IMPOSSIBLE, nil).should == 0
|
77
|
-
find_window_w(TEST_IMPOSSIBLE, TEST_IMPOSSIBLE).should == 0
|
107
|
+
it 'adds Rubyesque alias to IsXxx API test function' do
|
108
|
+
WinGui.def_api 'IsWindow', 'L', 'L'
|
109
|
+
respond_to?(:window?).should be_true
|
110
|
+
respond_to?(:is_window).should be_true
|
78
111
|
end
|
79
112
|
|
80
|
-
it '
|
81
|
-
WinGui.def_api '
|
82
|
-
|
83
|
-
|
84
|
-
expect { find_window_w('Str') }.to raise_error 'Invalid args count'
|
85
|
-
expect { find_window_w([nil, nil]) }.to raise_error 'Invalid args count'
|
86
|
-
expect { find_window_w('Str', 'Str', 'Str') }.to raise_error 'Invalid args count'
|
113
|
+
it 'adds Rubyesque alias to GetXxx API getter function' do
|
114
|
+
WinGui.def_api 'GetComputerName', 'PP', 'I', :dll=> 'kernel32'
|
115
|
+
respond_to?(:get_computer_name).should be_true
|
116
|
+
respond_to?(:computer_name).should be_true
|
87
117
|
end
|
88
118
|
|
89
|
-
it 'returns underlying Win32::API object if defined method is called with (:api) argument ' do
|
90
|
-
WinGui.def_api 'FindWindowW', 'PP', 'L'
|
91
|
-
expect {@api = find_window_w(:api)}.to_not raise_error
|
92
|
-
@api.dll_name.should == 'user32' # The name of the DLL that exports the API function
|
93
|
-
@api.effective_function_name.should == 'FindWindowW' # Actual function returned by the constructor: 'GetUserName' ->'GetUserNameA' or 'GetUserNameW'
|
94
|
-
@api.function_name.should == 'FindWindowW' # The name of the function passed to the constructor
|
95
|
-
@api.prototype.should == ['P', 'P'] # The prototype, returned as an array of characters
|
96
|
-
end
|
97
119
|
end
|
98
120
|
|
99
121
|
context 'auto-defining Ruby-like boolean methods if API function name starts with "Is_"' do
|
100
|
-
before(:each)
|
101
|
-
hide_method :window?
|
102
|
-
WinGui.def_api 'IsWindow', 'L', 'L'
|
103
|
-
end
|
104
|
-
after(:each) { restore_method :window? }
|
122
|
+
before(:each) {WinGui.def_api 'IsWindow', 'L', 'L'}
|
105
123
|
|
106
124
|
it 'defines new instance method name dropping Is_ and adding ?' do
|
107
125
|
respond_to?(:window?).should be_true
|
126
|
+
respond_to?(:is_window).should be_true
|
127
|
+
respond_to?(:IsWindow).should be_true
|
108
128
|
end
|
109
129
|
|
110
|
-
it 'defined method returns
|
130
|
+
it 'defined CamelCase method returns zero/non-zero as expected' do
|
131
|
+
IsWindow(any_handle).should_not == true
|
132
|
+
IsWindow(any_handle).should_not == 0
|
133
|
+
IsWindow(not_a_handle).should == 0
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'defined snake_case method returns false/true instead of zero/non-zero' do
|
111
137
|
window?(any_handle).should == true
|
112
138
|
window?(not_a_handle).should == false
|
139
|
+
is_window(any_handle).should == true
|
140
|
+
is_window(not_a_handle).should == false
|
113
141
|
end
|
114
142
|
|
115
|
-
it 'defined
|
116
|
-
|
117
|
-
expect {window?(not_a_handle, nil)}.to raise_error 'Invalid args count'
|
118
|
-
expect {window?(nil, nil)}.to raise_error 'Invalid args count'
|
143
|
+
it 'defined methods enforce the argument count' do
|
144
|
+
should_count_args :window?, :is_window, :IsWindow, [not_a_handle], [nil, not_a_handle, any_handle]
|
119
145
|
end
|
120
146
|
end
|
121
147
|
|
122
148
|
context 'defining API with :boolean option converts result to boolean' do
|
123
149
|
before(:each) do
|
124
|
-
WinGui.def_api '
|
150
|
+
WinGui.def_api 'FindWindow', 'PP', 'L', :boolean => true
|
125
151
|
end
|
126
152
|
|
127
153
|
it 'defines new instance method' do
|
128
|
-
respond_to?(:
|
154
|
+
respond_to?(:find_window).should be_true
|
155
|
+
respond_to?(:FindWindow).should be_true
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'defined snake_case method returns false/true instead of zero/non-zero' do
|
159
|
+
find_window(nil, nil).should == true
|
160
|
+
find_window(nil, TEST_IMPOSSIBLE).should == false
|
129
161
|
end
|
130
162
|
|
131
|
-
it 'defined method returns
|
132
|
-
|
133
|
-
|
163
|
+
it 'defined CamelCase method still returns zero/non-zero' do
|
164
|
+
FindWindow(nil, nil).should_not == true
|
165
|
+
FindWindow(nil, nil).should_not == 0
|
166
|
+
FindWindow(nil, TEST_IMPOSSIBLE).should == 0
|
134
167
|
end
|
135
168
|
|
136
|
-
it 'defined
|
137
|
-
|
138
|
-
expect {find_window_w(nil, nil, nil)}.to raise_error 'Invalid args count'
|
169
|
+
it 'defined methods enforce the argument count' do
|
170
|
+
should_count_args :find_window, :FindWindow, [nil, nil], [nil, TEST_IMPOSSIBLE, 'cmd']
|
139
171
|
end
|
140
172
|
end
|
141
173
|
|
142
174
|
context 'defining API with :zeronil option converts zero result to nil' do
|
143
175
|
before(:each) do
|
144
|
-
WinGui.def_api '
|
176
|
+
WinGui.def_api 'FindWindow', 'PP', 'L', :zeronil => true
|
145
177
|
end
|
146
178
|
|
147
179
|
it 'defines new instance method' do
|
148
|
-
respond_to?(:
|
180
|
+
respond_to?(:find_window).should be_true
|
181
|
+
respond_to?(:FindWindow).should be_true
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'defined CamelCase method still returns zero/non-zero' do
|
185
|
+
FindWindow(nil, nil).should_not == true
|
186
|
+
FindWindow(nil, nil).should_not == 0
|
187
|
+
FindWindow(nil, TEST_IMPOSSIBLE).should == 0
|
149
188
|
end
|
150
189
|
|
151
190
|
it 'defined method returns nil (but NOT false) instead of zero' do
|
152
|
-
|
153
|
-
|
191
|
+
find_window(nil, TEST_IMPOSSIBLE).should_not == false
|
192
|
+
find_window(nil, TEST_IMPOSSIBLE).should == nil
|
154
193
|
end
|
155
194
|
|
156
195
|
it 'defined method does not return true when result is non-zero' do
|
157
|
-
|
158
|
-
|
196
|
+
find_window(nil, nil).should_not == true
|
197
|
+
find_window(nil, nil).should_not == 0
|
159
198
|
end
|
160
199
|
|
161
|
-
it 'defined
|
162
|
-
|
163
|
-
expect {find_window_w(nil, nil, nil)}.to raise_error 'Invalid args count'
|
200
|
+
it 'defined methods enforce the argument count' do
|
201
|
+
should_count_args :find_window, :FindWindow, [nil, nil], [nil, TEST_IMPOSSIBLE, 'cmd']
|
164
202
|
end
|
165
203
|
end
|
166
204
|
|
167
205
|
context 'using DLL other than default user32 with :dll option' do
|
168
|
-
before(:each)
|
169
|
-
hide_method :get_computer_name # hide original method if it is defined
|
170
|
-
WinGui.def_api 'GetComputerName', ['P', 'P'], 'I', :dll=> 'kernel32'
|
171
|
-
end
|
172
|
-
after(:each) { restore_method :get_computer_name } # restore original method if it was hidden
|
206
|
+
before(:each) {WinGui.def_api 'GetComputerName', 'PP', 'I', :dll=> 'kernel32'}
|
173
207
|
|
174
208
|
it 'defines new instance method with appropriate name' do
|
209
|
+
respond_to?(:GetComputerName).should be_true
|
175
210
|
respond_to?(:get_computer_name).should be_true
|
211
|
+
respond_to?(:computer_name).should be_true
|
176
212
|
end
|
177
213
|
|
178
214
|
it 'returns expected result' do
|
@@ -192,66 +228,81 @@ module GuiTest
|
|
192
228
|
end
|
193
229
|
|
194
230
|
context 'defining API function using definition block' do
|
195
|
-
|
196
231
|
it 'defines new instance method' do
|
197
|
-
WinGui.def_api( '
|
198
|
-
respond_to?(:
|
232
|
+
WinGui.def_api( 'FindWindow', 'PP', 'L' ){|api, *args|}
|
233
|
+
respond_to?(:find_window).should be_true
|
234
|
+
respond_to?(:FindWindow).should be_true
|
199
235
|
end
|
200
236
|
|
201
237
|
it 'does not enforce argument count outside of block' do
|
202
|
-
WinGui.def_api( '
|
203
|
-
expect {
|
204
|
-
expect {
|
205
|
-
expect {
|
238
|
+
WinGui.def_api( 'FindWindow', 'PP', 'L' ){|api, *args|}
|
239
|
+
expect { find_window }.to_not raise_error
|
240
|
+
expect { find_window(nil) }.to_not raise_error
|
241
|
+
expect { find_window(nil, 'Str', 1) }.to_not raise_error
|
206
242
|
end
|
207
243
|
|
208
244
|
it 'returns block return value when defined method is called' do
|
209
|
-
WinGui.def_api( '
|
210
|
-
|
245
|
+
WinGui.def_api( 'FindWindow', 'PP', 'L' ){|api, *args| 'Value'}
|
246
|
+
find_window(nil).should == 'Value'
|
211
247
|
end
|
212
248
|
|
213
249
|
it 'passes arguments and underlying Win32::API object to the block' do
|
214
|
-
WinGui.def_api( '
|
250
|
+
WinGui.def_api( 'FindWindow', 'PP', 'L' ) do |api, *args|
|
215
251
|
@api = api
|
216
252
|
@args = args
|
217
253
|
end
|
218
|
-
|
254
|
+
expect {find_window(1, 2, 3) }.to_not raise_error
|
219
255
|
@args.should == [1, 2, 3]
|
220
|
-
|
256
|
+
should_be :find_window, @api
|
221
257
|
end
|
222
258
|
|
223
259
|
it ':rename option overrides standard name for defined method' do
|
224
|
-
WinGui.def_api( '
|
225
|
-
expect {
|
260
|
+
WinGui.def_api( 'FindWindow', 'PP', 'L', :rename => 'my_own_find' ){|api, *args|}
|
261
|
+
expect {find_window(nil, nil, nil)}.to raise_error
|
226
262
|
expect {my_own_find(nil, nil)}.to_not raise_error
|
227
263
|
end
|
264
|
+
|
228
265
|
it 'adds alias for defined method with :alias option' do
|
229
|
-
WinGui.def_api( '
|
230
|
-
expect {
|
266
|
+
WinGui.def_api( 'FindWindow', 'PP', 'L', :alias => 'my_own_find' ){|api, *args|}
|
267
|
+
expect {find_window(nil, nil)}.to_not raise_error
|
231
268
|
expect {my_own_find(nil, nil)}.to_not raise_error
|
232
269
|
end
|
233
270
|
|
234
271
|
it 'adds aliases for defined method with :aliases option' do
|
235
|
-
WinGui.def_api( '
|
236
|
-
expect {
|
272
|
+
WinGui.def_api( 'FindWindow', 'PP', 'L', :aliases => ['my_own_find', 'my_own_find1'] ) {|api, *args|}
|
273
|
+
expect {find_window(nil, nil)}.to_not raise_error
|
237
274
|
expect {my_own_find(nil, nil)}.to_not raise_error
|
238
275
|
expect {my_own_find1(nil, nil)}.to_not raise_error
|
239
276
|
end
|
240
277
|
|
241
278
|
it 'returns underlying Win32::API object if defined method is called with (:api) argument ' do
|
242
|
-
WinGui.def_api( '
|
243
|
-
expect {
|
244
|
-
|
245
|
-
@api.effective_function_name.should == 'FindWindowW' # Actual function returned by the constructor: 'GetUserName' ->'GetUserNameA' or 'GetUserNameW'
|
246
|
-
@api.function_name.should == 'FindWindowW' # The name of the function passed to the constructor
|
247
|
-
@api.prototype.should == ['P', 'P'] # The prototype, returned as an array of characters
|
279
|
+
WinGui.def_api( 'FindWindow', 'PP', 'L' ){|api, *args|}
|
280
|
+
expect {find_window(:api)}.to_not raise_error
|
281
|
+
should_be :find_window, find_window(:api)
|
248
282
|
end
|
249
283
|
end
|
250
284
|
|
251
|
-
context '
|
252
|
-
|
253
|
-
|
285
|
+
context 'calling defined methods with attached block to preprocess the API function results' do
|
286
|
+
it 'defined method yields raw result to block attached to its invocation' do
|
287
|
+
WinGui.def_api 'FindWindow', 'PP', 'L', zeronil: true
|
288
|
+
find_window(nil, TEST_IMPOSSIBLE) {|result| result.should == 0 }
|
289
|
+
end
|
290
|
+
|
291
|
+
it 'defined method returns result of block attached to its invocation' do
|
292
|
+
WinGui.def_api 'FindWindow', 'PP', 'L', zeronil: true
|
293
|
+
return_value = find_window(nil, TEST_IMPOSSIBLE) {|result| 'Value'}
|
294
|
+
return_value.should == 'Value'
|
295
|
+
end
|
296
|
+
|
297
|
+
it 'defined method transforms result of block before returning it' do
|
298
|
+
WinGui.def_api 'FindWindow', 'PP', 'L', zeronil: true
|
299
|
+
return_value = find_window(nil, TEST_IMPOSSIBLE) {|result| 0 }
|
300
|
+
return_value.should_not == 0
|
301
|
+
return_value.should == nil
|
302
|
+
end
|
303
|
+
end
|
254
304
|
|
305
|
+
context 'working with API function callbacks' do
|
255
306
|
it '#callback method creates a valid callback object' do
|
256
307
|
expect { @callback = WinGui.callback('LP', 'I') {|handle, message| true} }.to_not raise_error
|
257
308
|
@callback.should be_a_kind_of(Win32::API::Callback)
|
@@ -22,7 +22,7 @@ module GuiTest
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe '#window_visible?' do
|
25
|
+
describe '#window_visible?' do
|
26
26
|
spec{ use{ window_visible?(handle = any_handle) }}
|
27
27
|
spec{ use{ visible?(handle = any_handle) }}
|
28
28
|
|
@@ -199,6 +199,10 @@ module GuiTest
|
|
199
199
|
spec{ use{ text = get_window_text(handle = 0)}}
|
200
200
|
# Improved with block to accept window handle as a single arg and return (rstripped) text string
|
201
201
|
|
202
|
+
it 'returns nil if incorrect window handle given' do
|
203
|
+
get_window_text(0).should == nil
|
204
|
+
end
|
205
|
+
|
202
206
|
it 'returns correct window text' do
|
203
207
|
test_app {|app| get_window_text(app.handle).should == TEST_WIN_TITLE }
|
204
208
|
end
|
@@ -208,6 +212,10 @@ module GuiTest
|
|
208
212
|
spec{ use{ class_name = get_window_text_w(handle = 0)}} # result encoded as utf-8
|
209
213
|
# Unicode version of get_window_text (strings returned encoded as utf-8)
|
210
214
|
|
215
|
+
it 'returns nil if incorrect window handle given' do
|
216
|
+
get_window_text(0).should == nil
|
217
|
+
end
|
218
|
+
|
211
219
|
it 'returns correct window text' do
|
212
220
|
test_app {|app| get_window_text_w(app.handle).should == TEST_WIN_TITLE }
|
213
221
|
end
|
data/win_gui.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{win_gui}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["arvicco"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-29}
|
13
13
|
s.description = %q{Rubyesque interfaces and wrappers for Win32 API GUI functions}
|
14
14
|
s.email = %q{arvitallian@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win_gui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- arvicco
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-29 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|