diff options
author | suke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-01-26 15:03:43 +0000 |
---|---|---|
committer | suke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-01-26 15:03:43 +0000 |
commit | 3369c5167adb7198aaeadc536134d7d2a71d9393 (patch) | |
tree | 54edb42b62084eabe891d8162e18656728bd7e54 /test/win32ole | |
parent | e4472f0b8f13ad338fd3beaafcc6ea301c2e0c52 (diff) | |
download | ruby-3369c5167adb7198aaeadc536134d7d2a71d9393.tar.gz ruby-3369c5167adb7198aaeadc536134d7d2a71d9393.tar.xz ruby-3369c5167adb7198aaeadc536134d7d2a71d9393.zip |
bug fix of WIN32OLE_VARIANT when variant type is VT_BYREF|VT_VARIANT.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r-- | test/win32ole/test_win32ole_variant_with_ie.rb | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole_variant_with_ie.rb b/test/win32ole/test_win32ole_variant_with_ie.rb new file mode 100644 index 000000000..680f17ff5 --- /dev/null +++ b/test/win32ole/test_win32ole_variant_with_ie.rb @@ -0,0 +1,53 @@ +# This is test script to check WIN32OLE_VARIANT using Internet Explorer +begin + require 'win32ole' +rescue LoadError +end +require 'test/unit' + +if defined?(WIN32OLE) + class TestWIN32OLE_VARIANT_WITH_IE < Test::Unit::TestCase + def create_temp_html + fso = WIN32OLE.new('Scripting.FileSystemObject') + dummy_file = fso.GetTempName + ".html" + cfolder = fso.getFolder(".") + f = cfolder.CreateTextFile(dummy_file) + f.writeLine("<html><body>This is test HTML file for Win32OLE.</body></html>") + f.close + dummy_path = cfolder.path + "\\" + dummy_file + dummy_path + end + def setup + @f = create_temp_html + @ie = WIN32OLE.new('InternetExplorer.Application') + @ie.visible = true + @ie.navigate("file:///#{@f}") + while @ie.busy + sleep 0.5 + end + end + def test_variant_ref_and_argv + @ie.execWB(19, 0, nil, -1) + size = WIN32OLE::ARGV[3] + assert(size >= 0) + + obj = WIN32OLE_VARIANT.new(nil, WIN32OLE::VARIANT::VT_VARIANT|WIN32OLE::VARIANT::VT_BYREF) + @ie.execWb(19, 0, nil, obj) + assert_equal(size, obj.value) + assert_equal(size, WIN32OLE::ARGV[3]) + + obj = WIN32OLE_VARIANT.new(-1, WIN32OLE::VARIANT::VT_VARIANT|WIN32OLE::VARIANT::VT_BYREF) + @ie.execWb(19, 0, nil, obj) + assert_equal(size, obj.value) + assert_equal(size, WIN32OLE::ARGV[3]) + end + + def teardown + File.unlink(@f) + if @ie + @ie.quit + @ie = nil + end + end + end +end |