summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-03 10:43:44 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-03 10:43:44 +0000
commite231d67ee1e9fefaf51ccebb10164b184f32440f (patch)
tree53ab15e51b1fd9242cd827d7f9f613ba825623ec /test/win32ole
parentda4d9e03622f932f8b303d1e869a3f2c2fa438a2 (diff)
* ext/win32ole/win32ole.c (hash2named_arg): refactoring.
* ext/win32ole/win32ole.c (ole_invoke, fole_respond_to, ev_on_event, fev_off_event): accepts Symbol argument. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole.rb7
-rw-r--r--test/win32ole/test_win32ole_event.rb19
2 files changed, 26 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb
index d7c1158..d9e5953 100644
--- a/test/win32ole/test_win32ole.rb
+++ b/test/win32ole/test_win32ole.rb
@@ -250,12 +250,19 @@ if defined?(WIN32OLE)
fso = WIN32OLE.new('Scripting.FileSystemObject')
assert(fso.ole_respond_to?('getFolder'))
assert(fso.ole_respond_to?('GETFOLDER'))
+ assert(fso.ole_respond_to?(:getFolder))
assert(!fso.ole_respond_to?('XXXXX'))
assert_raise(TypeError) {
assert_raise(fso.ole_respond_to?(1))
}
end
+ def test_invoke
+ fso = WIN32OLE.new('Scripting.FileSystemObject')
+ assert(fso.invoke(:getFolder, "."))
+ assert(fso.invoke('getFolder', "."))
+ end
+
def test_s_const_load
assert(!defined?(CONST1::SsfWINDOWS))
shell=WIN32OLE.new('Shell.Application')
diff --git a/test/win32ole/test_win32ole_event.rb b/test/win32ole/test_win32ole_event.rb
index 276a018..5b2a1af 100644
--- a/test/win32ole/test_win32ole_event.rb
+++ b/test/win32ole/test_win32ole_event.rb
@@ -76,6 +76,16 @@ if defined?(WIN32OLE_EVENT)
assert_match(/NavigateComplete/, @event)
end
+ def test_on_event_symbol
+ ev = WIN32OLE_EVENT.new(@ie)
+ ev.on_event(:BeforeNavigate2) {|*args|
+ handler1
+ }
+ @ie.navigate("file:///#{@f}")
+ wait_ie
+ assert_equal("handler1", @event2)
+ end
+
def test_on_event2
ev = WIN32OLE_EVENT.new(@ie, 'DWebBrowserEvents')
ev.on_event('BeforeNavigate') {|*args| handler1}
@@ -229,6 +239,15 @@ if defined?(WIN32OLE_EVENT)
assert_equal("", @event2)
end
+ def test_off_event_sym_arg
+ ev = WIN32OLE_EVENT.new(@ie)
+ ev.on_event('BeforeNavigate2'){handler1}
+ ev.off_event(:BeforeNavigate2)
+ @ie.navigate("file:///#{@f}")
+ wait_ie
+ assert_equal("", @event2)
+ end
+
def handler1
@event2 = "handler1"
end