From d464704f111d211c1f1ff9ef23ef1d755054be00 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Wed, 15 Aug 2007 19:08:43 +0000 Subject: add tag v1_8_5_54 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_5_54@12952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby_1_8_5/ext/win32ole/tests/testOLETYPE.rb | 96 ++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 ruby_1_8_5/ext/win32ole/tests/testOLETYPE.rb (limited to 'ruby_1_8_5/ext/win32ole/tests/testOLETYPE.rb') diff --git a/ruby_1_8_5/ext/win32ole/tests/testOLETYPE.rb b/ruby_1_8_5/ext/win32ole/tests/testOLETYPE.rb new file mode 100644 index 0000000000..d4eb1146e1 --- /dev/null +++ b/ruby_1_8_5/ext/win32ole/tests/testOLETYPE.rb @@ -0,0 +1,96 @@ +# You need RubyUnit and MS Excel and MSI to run this test script + +require 'rubyunit' + +require 'win32ole' +require 'oleserver' + +class TestOLETYPE < RUNIT::TestCase + include OLESERVER + def test_s_new + type = WIN32OLE_TYPE.new(MS_EXCEL_TYPELIB, 'Application') + assert_instance_of(WIN32OLE_TYPE, type) + end + def test_s_ole_classes + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + assert(classes.size > 0) + end + def test_s_typelibs + libs = WIN32OLE_TYPE.typelibs + assert(libs.include?(MS_EXCEL_TYPELIB)) + assert(libs.include?(MS_XML_TYPELIB)) + end + def test_s_progids + progids = WIN32OLE_TYPE.progids + assert(progids.include?('Excel.Application')) + end + def test_name + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + class_names = classes.collect{|c| + c.name + } + 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'} + assert_equal('Class', app.ole_type) + app = classes.find {|c| c.name == '_Application'} + assert_equal('Dispatch', app.ole_type) + end + def test_typekind + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + app = classes.find {|c| c.name == 'Application'} + assert_equal(5, app.typekind) + end + def test_visible + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + app = classes.find {|c| c.name == 'Application'} + assert(app.visible?) + app = classes.find {|c| c.name == 'IAppEvents'} + assert(!app.visible?) + end + def test_src_type + classes = WIN32OLE_TYPE.ole_classes(MS_XML_TYPELIB) + domnode = classes.find {|c| c.name == 'DOMNodeType'} + assert_equal('tagDOMNodeType', domnode.src_type) + end + def test_helpstring + classes = WIN32OLE_TYPE.ole_classes(MS_XML_TYPELIB) + domdoc = classes.find {|c| c.name == 'DOMDocument'} + assert_equal('W3C-DOM XML Document', domdoc.helpstring) + end + def test_variables + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + xlchart = classes.find {|c| c.name == 'XlChartType'} + assert(xlchart.variables.size > 0) + end + def test_ole_methods + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + worksheet = classes.find {|c| c.name == 'Worksheet'} + assert(worksheet.ole_methods.size > 0) + end + def test_helpfile + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + worksheet = classes.find {|c| c.name == 'Worksheet'} + assert_match(/VBAXL.*\.(CHM|HLP)$/, worksheet.helpfile) + end + def test_helpcontext + classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB) + 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 -- cgit v1.2.3