summaryrefslogtreecommitdiff
path: root/test/win32ole/test_win32ole_param.rb
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-05-06 23:40:08 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-05-06 23:40:08 +0000
commit08b5a86487d16b32c7dd6704ec350d775be6120e (patch)
tree1f9706e0aa575785de2c12f19c7beea6b1fbeedf /test/win32ole/test_win32ole_param.rb
parent119b7a05340859c76f42114964f5e77fa3a33f37 (diff)
* should not test in the environment that does not have win32ole
library. * CRLF -> LF. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole/test_win32ole_param.rb')
-rw-r--r--test/win32ole/test_win32ole_param.rb84
1 files changed, 84 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole_param.rb b/test/win32ole/test_win32ole_param.rb
new file mode 100644
index 0000000000..4374f9a426
--- /dev/null
+++ b/test/win32ole/test_win32ole_param.rb
@@ -0,0 +1,84 @@
+begin
+ require 'win32ole'
+rescue LoadError
+end
+require "test/unit"
+
+if defined?(WIN32OLE_PARAM)
+ class TestWIN32OLE_PARAM < Test::Unit::TestCase
+
+ def setup
+ ole_type = WIN32OLE_TYPE.new("Microsoft Internet Controls", "WebBrowser")
+ m_navigate = WIN32OLE_METHOD.new(ole_type, "Navigate")
+ m_before_navigate = WIN32OLE_METHOD.new(ole_type, "BeforeNavigate")
+ params = m_navigate.params
+ @param_url = params[0]
+ @param_flags = params[1]
+ @param_cancel = m_before_navigate.params[5]
+
+ ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellLinkObject")
+ m_geticonlocation = WIN32OLE_METHOD.new(ole_type, "GetIconLocation")
+ @param_pbs = m_geticonlocation.params[0]
+
+ ole_type = WIN32OLE_TYPE.new("Microsoft HTML Object Library", "FontNames")
+ m_count = WIN32OLE_METHOD.new(ole_type, "Count")
+ @param_p = m_count.params[0]
+
+ ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject")
+ m_copyfile = WIN32OLE_METHOD.new(ole_type, "CopyFile")
+ @param_overwritefiles = m_copyfile.params[2]
+ end
+
+ def test_name
+ assert_equal('URL', @param_url.name)
+ assert_equal('Flags', @param_flags.name)
+ assert_equal('Cancel', @param_cancel.name)
+ end
+
+ def test_ole_type
+ assert_equal('BSTR', @param_url.ole_type)
+ assert_equal('VARIANT', @param_flags.ole_type)
+ end
+
+ def test_ole_type_detail
+ assert_equal(['BSTR'], @param_url.ole_type_detail)
+ assert_equal(['PTR', 'VARIANT'], @param_flags.ole_type_detail)
+ end
+
+ def test_input?
+ assert(@param_url.input?)
+ assert(@param_cancel.input?)
+ assert(!@param_pbs.input?)
+ end
+
+ def test_output?
+ assert(!@param_url.output?)
+ assert(@param_cancel.output?)
+ assert(@param_pbs.output?)
+ end
+
+ def test_optional?
+ assert(!@param_url.optional?)
+ assert(@param_flags.optional?)
+ end
+
+ def test_retval?
+ assert(!@param_url.retval?)
+ assert(@param_p.retval?)
+ end
+
+ def test_default
+ assert_equal(nil, @param_url.default)
+ assert_equal(true, @param_overwritefiles.default)
+ end
+
+ def test_to_s
+ assert_equal(@param_url.name, @param_url.to_s)
+ end
+
+ def test_inspect
+ assert_equal("#<WIN32OLE_PARAM:URL>", @param_url.inspect)
+ assert_equal("#<WIN32OLE_PARAM:OverWriteFiles=true>", @param_overwritefiles.inspect)
+ end
+ end
+end