aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-26 15:03:43 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-26 15:03:43 +0000
commitbb435c7a6c7519547c26ab708894d1357d35bcda (patch)
tree54edb42b62084eabe891d8162e18656728bd7e54 /test
parent8c74a181614dca02ea416e5e338b57450967ee02 (diff)
downloadruby-bb435c7a6c7519547c26ab708894d1357d35bcda.tar.gz
bug fix of WIN32OLE_VARIANT when variant type is VT_BYREF|VT_VARIANT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/win32ole/test_win32ole_variant_with_ie.rb53
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 0000000000..680f17ff54
--- /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