summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-07 11:49:14 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-07 11:49:14 +0000
commit6aff4b8eaa7e2b8bc0bb458dd1882d4b1b197a04 (patch)
treea7eade95ddfc2972d7cec3d2c391d4c4c6bc5e08 /test/win32ole
parent1d6e2caf10b477739012f92e3c08be23d8459363 (diff)
* ext/win32ole/win32ole.c(Init_win32ole): add
WIN32OLE_TYPE#source_ole_types, WIN32OLE_TYPE#default_ole_types, WIN32OLE_TYPE#default_event_sources. * test/win32ole/test_win32ole_type.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole_type.rb53
1 files changed, 52 insertions, 1 deletions
diff --git a/test/win32ole/test_win32ole_type.rb b/test/win32ole/test_win32ole_type.rb
index f317e8ed5b..1aff42a45a 100644
--- a/test/win32ole/test_win32ole_type.rb
+++ b/test/win32ole/test_win32ole_type.rb
@@ -166,8 +166,59 @@ if defined?(WIN32OLE_TYPE)
def test_implemented_ole_types
ole_types = @ole_type.implemented_ole_types
assert_instance_of(Array, ole_types)
- assert(ole_types.size > 0)
+ assert_equal(1, ole_types.size)
assert_match(/^IShellDispatch5{0,1}$/, ole_types[0].name)
+
+ ie_otype = WIN32OLE_TYPE.new("Microsoft Internet Controls", "InternetExplorer")
+ ole_types = ie_otype.implemented_ole_types
+ assert_equal(4, ole_types.size)
+ otype = ole_types.select{|t| t.name == "IWebBrowser2"}
+ assert_equal(1, otype.size)
+ otype = ole_types.select{|t| t.name == "IWebBrowserApp"}
+ assert_equal(1, otype.size)
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"}
+ assert_equal(1, otype.size)
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
+ assert_equal(1, otype.size)
+ end
+
+ def test_default_ole_types
+ ie_otype = WIN32OLE_TYPE.new("Microsoft Internet Controls", "InternetExplorer")
+ ole_types = ie_otype.default_ole_types
+ otype = ole_types.select{|t| t.name == "IWebBrowser2"}
+ assert_equal(1, otype.size)
+ otype = ole_types.select{|t| t.name == "IWebBrowserApp"}
+ assert_equal(0, otype.size)
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"}
+ assert_equal(1, otype.size)
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
+ assert_equal(0, otype.size)
+ end
+
+ def test_source_ole_types
+ ie_otype = WIN32OLE_TYPE.new("Microsoft Internet Controls", "InternetExplorer")
+ ole_types = ie_otype.source_ole_types
+ otype = ole_types.select{|t| t.name == "IWebBrowser2"}
+ assert_equal(0, otype.size)
+ otype = ole_types.select{|t| t.name == "IWebBrowserApp"}
+ assert_equal(0, otype.size)
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"}
+ assert_equal(1, otype.size)
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
+ assert_equal(1, otype.size)
+ end
+
+ def test_default_event_sources
+ ie_otype = WIN32OLE_TYPE.new("Microsoft Internet Controls", "InternetExplorer")
+ ole_types = ie_otype.default_event_sources
+ otype = ole_types.select{|t| t.name == "IWebBrowser2"}
+ assert_equal(0, otype.size)
+ otype = ole_types.select{|t| t.name == "IWebBrowserApp"}
+ assert_equal(0, otype.size)
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"}
+ assert_equal(1, otype.size)
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
+ assert_equal(0, otype.size)
end
def test_inspect