diff options
| author | suke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-13 12:36:26 +0000 |
|---|---|---|
| committer | suke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-13 12:36:26 +0000 |
| commit | 0a0cda8c9adaf686100e96c99290683d192ba2e8 (patch) | |
| tree | fb41472b257d16cc925b7d51bbb6116c853179ab /test/win32ole | |
| parent | ad7bbf83f39abae9084d42604cd0a06ff2879637 (diff) | |
| download | ruby-0a0cda8c9adaf686100e96c99290683d192ba2e8.tar.gz ruby-0a0cda8c9adaf686100e96c99290683d192ba2e8.tar.xz ruby-0a0cda8c9adaf686100e96c99290683d192ba2e8.zip | |
* ext/win32ole/win32ole.c (EVENTSINK_Invoke): using hash
to set value to the reference argument of event.
* test/win32ole/test_win32ole_event.rb: ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
| -rw-r--r-- | test/win32ole/test_win32ole_event.rb | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/test/win32ole/test_win32ole_event.rb b/test/win32ole/test_win32ole_event.rb index 42e80ced9..dafabffc5 100644 --- a/test/win32ole/test_win32ole_event.rb +++ b/test/win32ole/test_win32ole_event.rb @@ -164,6 +164,76 @@ if defined?(WIN32OLE_EVENT) assert_equal(bl, @ie.locationURL) end + def test_on_event_hash_return + ev = WIN32OLE_EVENT.new(@ie) + ev.on_event('BeforeNavigate2'){|*args| + {:return => 1, :Cancel => true} + } + bl = @ie.locationURL + @ie.navigate("file:///#{@f}") + while @ie.busy + sleep 0.1 + WIN32OLE_EVENT.message_loop + end + assert_equal(bl, @ie.locationURL) + end + + def test_on_event_hash_return2 + ev = WIN32OLE_EVENT.new(@ie) + ev.on_event('BeforeNavigate2'){|*args| + {:Cancel => true} + } + bl = @ie.locationURL + @ie.navigate("file:///#{@f}") + while @ie.busy + sleep 0.1 + WIN32OLE_EVENT.message_loop + end + assert_equal(bl, @ie.locationURL) + end + + def test_on_event_hash_return3 + ev = WIN32OLE_EVENT.new(@ie) + ev.on_event('BeforeNavigate2'){|*args| + {'Cancel' => true} + } + bl = @ie.locationURL + @ie.navigate("file:///#{@f}") + while @ie.busy + sleep 0.1 + WIN32OLE_EVENT.message_loop + end + assert_equal(bl, @ie.locationURL) + end + + def test_on_event_hash_return4 + ev = WIN32OLE_EVENT.new(@ie) + ev.on_event('BeforeNavigate2'){|*args| + {'return' => 2, 'Cancel' => true} + } + bl = @ie.locationURL + @ie.navigate("file:///#{@f}") + while @ie.busy + sleep 0.1 + WIN32OLE_EVENT.message_loop + end + assert_equal(bl, @ie.locationURL) + end + + def test_on_event_hash_return5 + ev = WIN32OLE_EVENT.new(@ie) + ev.on_event('BeforeNavigate2'){|*args| + {6 => true} + } + bl = @ie.locationURL + @ie.navigate("file:///#{@f}") + while @ie.busy + sleep 0.1 + WIN32OLE_EVENT.message_loop + end + assert_equal(bl, @ie.locationURL) + end + def handler1 @event2 = "handler1" end @@ -180,8 +250,19 @@ if defined?(WIN32OLE_EVENT) @ie.quit WIN32OLE_EVENT.message_loop @ie = nil - File.unlink(@f) + WIN32OLE_EVENT.message_loop + sleep 0.1 + begin + File.unlink(@f) + rescue Error::EACCESS + WIN32OLE_EVENT.message_loop + sleep 0.2 + File.unlink(@f) + end + GC.start + WIN32OLE_EVENT.message_loop + sleep 0.1 end end end |
