win 0.3.17 → 0.3.24
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +28 -0
- data/README.rdoc +5 -3
- data/VERSION +1 -1
- data/lib/win/dde.rb +138 -138
- data/lib/win/error.rb +26 -26
- data/lib/win/gui.rb +2 -0
- data/lib/win/gui/dialog.rb +9 -9
- data/lib/win/gui/input.rb +8 -8
- data/lib/win/gui/menu.rb +740 -0
- data/lib/win/gui/message.rb +44 -44
- data/lib/win/gui/window.rb +8 -8
- data/lib/win/library.rb +6 -6
- data/spec/spec_helper.rb +25 -3
- data/spec/win/gui/dialog_spec.rb +0 -16
- data/spec/win/gui/input_spec.rb +6 -10
- data/spec/win/gui/menu_spec.rb +291 -0
- data/spec/win/gui/window_spec.rb +8 -8
- data/spec/win/library_spec.rb +7 -14
- metadata +6 -5
- data/spec/test_apps/locknote/LockNote.exe +0 -0
data/spec/win/gui/window_spec.rb
CHANGED
@@ -220,11 +220,11 @@ module WinGuiWindowTest
|
|
220
220
|
it 'returns handle to window that is currently in foreground' do
|
221
221
|
test_app do |app|
|
222
222
|
@app_handle = app.handle
|
223
|
-
|
224
|
-
|
223
|
+
get_foreground_window().should == @app_handle
|
224
|
+
GetForegroundWindow().should == @app_handle
|
225
225
|
end
|
226
|
-
|
227
|
-
|
226
|
+
get_foreground_window().should_not == @app_handle
|
227
|
+
GetForegroundWindow().should_not == @app_handle
|
228
228
|
end
|
229
229
|
|
230
230
|
it 'defines #foreground? test function ' do
|
@@ -246,11 +246,11 @@ module WinGuiWindowTest
|
|
246
246
|
pending 'No idea how to test it'
|
247
247
|
test_app do |app|
|
248
248
|
@app_handle = app.handle
|
249
|
-
|
250
|
-
|
249
|
+
GetActiveWindow().should == @app_handle
|
250
|
+
get_active_window().should == @app_handle
|
251
251
|
end
|
252
|
-
|
253
|
-
|
252
|
+
GetActiveWindow().should_not == @app_handle
|
253
|
+
get_active_window().should_not == @app_handle
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
data/spec/win/library_spec.rb
CHANGED
@@ -167,8 +167,8 @@ module WinLibraryTest
|
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
|
-
context 'defining API with :
|
171
|
-
before(:each) {MyLib.function :FindWindow, 'PP', 'L', :
|
170
|
+
context 'defining API with :fails option converts zero result to nil' do
|
171
|
+
before(:each) {MyLib.function :FindWindow, 'PP', 'L', fails: 0, &@def_block}
|
172
172
|
|
173
173
|
it 'defines new instance method' do
|
174
174
|
respond_to?(:find_window).should be_true
|
@@ -228,7 +228,7 @@ module WinLibraryTest
|
|
228
228
|
end
|
229
229
|
|
230
230
|
describe '::function - attaches external API function and defines enhanced snake_case method on top of it' do
|
231
|
-
spec{ use{ MyLib.function(:FindWindow, 'PP', 'l', aliases: nil, boolean: nil,
|
231
|
+
spec{ use{ MyLib.function(:FindWindow, 'PP', 'l', aliases: nil, boolean: nil, fails: 0, &any_block) }}
|
232
232
|
|
233
233
|
context 'defining enhanced API function without defenition block (using defaults)' do
|
234
234
|
it_should_behave_like 'defining macro with options'
|
@@ -258,13 +258,6 @@ module WinLibraryTest
|
|
258
258
|
FindWindow(IMPOSSIBLE, nil).should == 0
|
259
259
|
FindWindow(IMPOSSIBLE, IMPOSSIBLE).should == 0
|
260
260
|
end
|
261
|
-
|
262
|
-
# it 'returns underlying Win32::API object if defined method is called with (:api) argument ' do
|
263
|
-
# MyLib.function :FindWindow, 'PP', 'L'
|
264
|
-
# expect {find_window(:api)}.to_not raise_error
|
265
|
-
# should_be :find_window, find_window(:api)
|
266
|
-
# end
|
267
|
-
|
268
261
|
end
|
269
262
|
|
270
263
|
context 'defining API function using explicit definition block' do
|
@@ -330,18 +323,18 @@ module WinLibraryTest
|
|
330
323
|
|
331
324
|
context 'calling defined methods with attached block to preprocess the API function results' do
|
332
325
|
it 'defined method yields raw result to block attached to its invocation' do
|
333
|
-
MyLib.function :FindWindow, 'PP', 'L',
|
326
|
+
MyLib.function :FindWindow, 'PP', 'L', fails: 0
|
334
327
|
find_window(nil, IMPOSSIBLE) {|result| result.should == 0 }
|
335
328
|
end
|
336
329
|
|
337
330
|
it 'defined method returns result of block attached to its invocation' do
|
338
|
-
MyLib.function :FindWindow, 'PP', 'L',
|
331
|
+
MyLib.function :FindWindow, 'PP', 'L', fails: 0
|
339
332
|
return_value = find_window(nil, IMPOSSIBLE) {|result| 'Value'}
|
340
333
|
return_value.should == 'Value'
|
341
334
|
end
|
342
335
|
|
343
336
|
it 'defined method transforms result of block before returning it' do
|
344
|
-
MyLib.function :FindWindow, 'PP', 'L',
|
337
|
+
MyLib.function :FindWindow, 'PP', 'L', fails: 0
|
345
338
|
return_value = find_window(nil, IMPOSSIBLE) {|result| 0 }
|
346
339
|
return_value.should_not == 0
|
347
340
|
return_value.should == nil
|
@@ -350,7 +343,7 @@ module WinLibraryTest
|
|
350
343
|
|
351
344
|
context 'defining API function without arguments - f(VOID)' do
|
352
345
|
it 'should enforce argument count to 0, NOT 1' do
|
353
|
-
MyLib.function :GetForegroundWindow, [], 'L',
|
346
|
+
MyLib.function :GetForegroundWindow, [], 'L', fails: 0
|
354
347
|
should_count_args :GetForegroundWindow, :get_foreground_window, :foreground_window, [], [nil, 0, 123]
|
355
348
|
end
|
356
349
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 24
|
9
|
+
version: 0.3.24
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- arvicco
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-21 00:00:00 +04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- lib/win/error.rb
|
75
75
|
- lib/win/gui/dialog.rb
|
76
76
|
- lib/win/gui/input.rb
|
77
|
+
- lib/win/gui/menu.rb
|
77
78
|
- lib/win/gui/message.rb
|
78
79
|
- lib/win/gui/window.rb
|
79
80
|
- lib/win/gui.rb
|
@@ -84,11 +85,11 @@ files:
|
|
84
85
|
- spec/extension_spec.rb
|
85
86
|
- spec/spec.opts
|
86
87
|
- spec/spec_helper.rb
|
87
|
-
- spec/test_apps/locknote/LockNote.exe
|
88
88
|
- spec/win/dde_spec.rb
|
89
89
|
- spec/win/error_spec.rb
|
90
90
|
- spec/win/gui/dialog_spec.rb
|
91
91
|
- spec/win/gui/input_spec.rb
|
92
|
+
- spec/win/gui/menu_spec.rb
|
92
93
|
- spec/win/gui/message_spec.rb
|
93
94
|
- spec/win/gui/window_spec.rb
|
94
95
|
- spec/win/library_spec.rb
|
@@ -148,11 +149,11 @@ test_files:
|
|
148
149
|
- spec/extension_spec.rb
|
149
150
|
- spec/spec.opts
|
150
151
|
- spec/spec_helper.rb
|
151
|
-
- spec/test_apps/locknote/LockNote.exe
|
152
152
|
- spec/win/dde_spec.rb
|
153
153
|
- spec/win/error_spec.rb
|
154
154
|
- spec/win/gui/dialog_spec.rb
|
155
155
|
- spec/win/gui/input_spec.rb
|
156
|
+
- spec/win/gui/menu_spec.rb
|
156
157
|
- spec/win/gui/message_spec.rb
|
157
158
|
- spec/win/gui/window_spec.rb
|
158
159
|
- spec/win/library_spec.rb
|
Binary file
|