summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-04 11:48:53 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-04 11:48:53 +0000
commit9ecd43fa98bb45b77a1c2334c6e9ba500d31962a (patch)
tree9e76cbdc382305854caf89a3cf93ce2c89245aa0 /test/win32ole
parent1acdd51cf9da5ec8987af38007776d1c5cc94495 (diff)
* ext/win32ole/win32ole.c: add WIN32OLE_EVENT#unadvise.
* test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole_event.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/win32ole/test_win32ole_event.rb b/test/win32ole/test_win32ole_event.rb
index 8fd02b5..522e7a6 100644
--- a/test/win32ole/test_win32ole_event.rb
+++ b/test/win32ole/test_win32ole_event.rb
@@ -89,6 +89,26 @@ if defined?(WIN32OLE_EVENT)
assert(@event!="")
end
+ def test_unadvise
+ ev = WIN32OLE_EVENT.new(@ie, 'DWebBrowserEvents')
+ ev.on_event {|*args| default_handler(*args)}
+ @ie.navigate("file:///#{@f}")
+ while @ie.busy
+ sleep 0.1
+ end
+ assert_match(/BeforeNavigate/, @event)
+ ev.unadvise
+ @event = ""
+ @ie.navigate("file:///#{@f}")
+ while @ie.busy
+ sleep 0.1
+ end
+ assert_equal("", @event);
+ assert_raise(WIN32OLERuntimeError) {
+ ev.on_event {|*args| default_handler(*args)}
+ }
+ end
+
def handler1
@event2 = "handler1"
end
@@ -102,9 +122,9 @@ if defined?(WIN32OLE_EVENT)
end
def teardown
- File.unlink(@f)
@ie.quit
@ie = nil
+ File.unlink(@f)
GC.start
end
end