1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

remove Microsoft Internet Control

* test/win32ole/test_win32ole_param: remove Microsoft Internet Control.
* test/win32ole/test_win32ole_param_event: use ADODB instead of
  Microsoft Internet Control for test_input?, test_output?

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2018-10-13 00:21:59 +00:00
parent d6b0fe7db1
commit 06e1079d93
2 changed files with 63 additions and 25 deletions

View file

@ -9,14 +9,6 @@ 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]
@ -27,7 +19,12 @@ if defined?(WIN32OLE_PARAM)
ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject")
m_copyfile = WIN32OLE_METHOD.new(ole_type, "CopyFile")
@param_source = m_copyfile.params[0]
@param_overwritefiles = m_copyfile.params[2]
ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "Dictionary")
m_add = WIN32OLE_METHOD.new(ole_type, "Add")
@param_key = m_add.params[0]
end
def test_s_new
@ -50,54 +47,51 @@ if defined?(WIN32OLE_PARAM)
end
def test_name
assert_equal('URL', @param_url.name)
assert_equal('Flags', @param_flags.name)
assert_equal('Cancel', @param_cancel.name)
assert_equal('Source', @param_source.name)
assert_equal('Key', @param_key.name)
end
def test_ole_type
assert_equal('BSTR', @param_url.ole_type)
assert_equal('VARIANT', @param_flags.ole_type)
assert_equal('BSTR', @param_source.ole_type)
assert_equal('VARIANT', @param_key.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)
assert_equal(['BSTR'], @param_source.ole_type_detail)
assert_equal(['PTR', 'VARIANT'], @param_key.ole_type_detail)
end
def test_input?
assert_equal(true, @param_url.input?)
assert_equal(true, @param_cancel.input?)
assert_equal(true, @param_source.input?)
assert_equal(false, @param_pbs.input?)
end
def test_output?
assert_equal(false, @param_url.output?)
assert_equal(true, @param_cancel.output?)
assert_equal(false, @param_source.output?)
assert_equal(true, @param_pbs.output?)
end
def test_optional?
assert_equal(false, @param_url.optional?)
assert_equal(true, @param_flags.optional?)
assert_equal(false, @param_source.optional?)
assert_equal(true, @param_overwritefiles.optional?)
end
def test_retval?
assert_equal(false, @param_url.retval?)
assert_equal(false, @param_source.retval?)
assert_equal(true, @param_p.retval?)
end
def test_default
assert_equal(nil, @param_url.default)
assert_equal(nil, @param_source.default)
assert_equal(true, @param_overwritefiles.default)
end
def test_to_s
assert_equal(@param_url.name, @param_url.to_s)
assert_equal(@param_source.name, @param_source.to_s)
end
def test_inspect
assert_equal("#<WIN32OLE_PARAM:URL>", @param_url.inspect)
assert_equal("#<WIN32OLE_PARAM:Source>", @param_source.inspect)
assert_equal("#<WIN32OLE_PARAM:OverWriteFiles=true>", @param_overwritefiles.inspect)
end
end

View file

@ -0,0 +1,44 @@
begin
require 'win32ole'
rescue LoadError
end
require 'test/unit'
if defined?(WIN32OLE_PARAM)
def ado_installed?
installed = false
if defined?(WIN32OLE)
begin
WIN32OLE.new('ADODB.Connection')
installed = true
rescue
end
end
installed
end
class TestWIN32OLE_PARAM_EVENT < Test::Unit::TestCase
unless ado_installed?
def test_dummy_for_skip_message
skip 'ActiveX Data Object Library not found'
end
else
def setup
typelib = WIN32OLE.new('ADODB.Connection').ole_typelib
otype = WIN32OLE_TYPE.new(typelib.name, 'Connection')
m_will_connect = WIN32OLE_METHOD.new(otype, 'WillConnect')
@param_user_id = m_will_connect.params[0]
end
def test_input?
assert_equal(true, @param_user_id.input?)
end
def test_output?
assert_equal(true, @param_user_id.output?)
end
end
end
end