From 7e190d7568c93e0f0d5397629f426780d608016c Mon Sep 17 00:00:00 2001 From: suke Date: Sat, 17 May 2003 13:49:08 +0000 Subject: add WIN32OLE_TYPE#to_s method. add WIN32OLE_VARIABLE#to_s method. add WIN32OLE_METHOD#to_s method. add WIN32OLE_PARAM#to_s method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/win32ole/tests/testOLEMETHOD.rb | 4 ++++ ext/win32ole/tests/testOLEPARAM.rb | 7 +++++++ ext/win32ole/tests/testOLETYPE.rb | 13 +++++++++++++ ext/win32ole/tests/testOLEVARIABLE.rb | 7 +++++++ ext/win32ole/tests/testall.rb | 4 ++-- 5 files changed, 33 insertions(+), 2 deletions(-) (limited to 'ext/win32ole/tests') diff --git a/ext/win32ole/tests/testOLEMETHOD.rb b/ext/win32ole/tests/testOLEMETHOD.rb index 4f65ec96b4..b52052e669 100644 --- a/ext/win32ole/tests/testOLEMETHOD.rb +++ b/ext/win32ole/tests/testOLEMETHOD.rb @@ -22,6 +22,10 @@ class TestOLEMETHOD < RUNIT::TestCase m = WIN32OLE_METHOD.new(@excel_app, 'Quit') assert_equal('Quit', m.name) end + def test_to_s + m = WIN32OLE_METHOD.new(@excel_app, 'Quit') + assert_equal('Quit', "#{m}") + end def test_return_type m = WIN32OLE_METHOD.new(@excel_app, 'ActiveCell') assert_equal('Range', m.return_type) diff --git a/ext/win32ole/tests/testOLEPARAM.rb b/ext/win32ole/tests/testOLEPARAM.rb index 62fd2a1890..685b548aa5 100644 --- a/ext/win32ole/tests/testOLEPARAM.rb +++ b/ext/win32ole/tests/testOLEPARAM.rb @@ -15,6 +15,13 @@ class TestOLEPARAM < RUNIT::TestCase assert(param_names.size > 0) assert(param_names.include?('Filename')) end + def test_to_s + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + sh = classes.find {|c| c.name == 'Worksheet'} + saveas = sh.ole_methods.find {|m| m.name == 'SaveAs'} + param_names = saveas.params.collect{|p| "#{p}"} + assert(param_names.include?('Filename')) + end def test_ole_type classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) methods = classes.find {|c| c.name == 'Worksheet'}.ole_methods diff --git a/ext/win32ole/tests/testOLETYPE.rb b/ext/win32ole/tests/testOLETYPE.rb index 9840aac940..d4eb1146e1 100644 --- a/ext/win32ole/tests/testOLETYPE.rb +++ b/ext/win32ole/tests/testOLETYPE.rb @@ -31,6 +31,15 @@ class TestOLETYPE < RUNIT::TestCase } assert(class_names.include?('Application')) end + + def test_class_to_s + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + class_names = classes.collect{|c| + "#{c}" + } + assert(class_names.include?('Application')) + end + def test_ole_type classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) app = classes.find {|c| c.name == 'Application'} @@ -80,4 +89,8 @@ class TestOLETYPE < RUNIT::TestCase worksheet = classes.find {|c| c.name == 'Worksheet'} assert_equal(131088, worksheet.helpcontext) end + def test_to_s + type = WIN32OLE_TYPE.new(MS_EXCEL_TYPELIB, 'Application') + assert_equal("Application", "#{type}"); + end end diff --git a/ext/win32ole/tests/testOLEVARIABLE.rb b/ext/win32ole/tests/testOLEVARIABLE.rb index b237d9b616..b4bb0b57d9 100644 --- a/ext/win32ole/tests/testOLEVARIABLE.rb +++ b/ext/win32ole/tests/testOLEVARIABLE.rb @@ -14,6 +14,13 @@ class TestOLEVARIABLE < RUNIT::TestCase assert(var_names.size > 0) assert(var_names.include?('xl3DColumn')) end + def test_to_s + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + chart = classes.find {|c| c.name == 'XlChartType'} + var_names = chart.variables.collect {|m| "#{m}"} + assert(var_names.size > 0) + assert(var_names.include?('xl3DColumn')) + end def test_ole_type classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) chart = classes.find {|c| c.name == 'XlChartType'} diff --git a/ext/win32ole/tests/testall.rb b/ext/win32ole/tests/testall.rb index ecc94e33ea..17bae2c810 100644 --- a/ext/win32ole/tests/testall.rb +++ b/ext/win32ole/tests/testall.rb @@ -1,11 +1,11 @@ require 'rubyunit' require 'win32ole' puts "Now Test Win32OLE version #{WIN32OLE::VERSION}" -RUNIT::CUI::TestRunner.quiet_mode = true +# RUNIT::CUI::TestRunner.quiet_mode = true require "testWIN32OLE" require "testOLETYPE" require "testOLEPARAM" require "testOLEMETHOD" require "testOLEVARIABLE" require "testVARIANT" -require "testOLEEVENT" +# require "testOLEEVENT" -- cgit v1.2.3