summaryrefslogtreecommitdiff
path: root/ext/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-17 13:49:08 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-17 13:49:08 +0000
commit7e190d7568c93e0f0d5397629f426780d608016c (patch)
treed91499325f88d04feb5551bc5263613f8525bfaf /ext/win32ole
parent8d67caddea374eee9f95a127767a55dd1626bd4b (diff)
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
Diffstat (limited to 'ext/win32ole')
-rw-r--r--ext/win32ole/tests/testOLEMETHOD.rb4
-rw-r--r--ext/win32ole/tests/testOLEPARAM.rb7
-rw-r--r--ext/win32ole/tests/testOLETYPE.rb13
-rw-r--r--ext/win32ole/tests/testOLEVARIABLE.rb7
-rw-r--r--ext/win32ole/tests/testall.rb4
-rw-r--r--ext/win32ole/win32ole.c6
6 files changed, 38 insertions, 3 deletions
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"
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 72315d08a2..6e0d3ddc3c 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -79,7 +79,7 @@
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
-#define WIN32OLE_VERSION "0.5.3"
+#define WIN32OLE_VERSION "0.5.4"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -5348,6 +5348,7 @@ Init_win32ole()
rb_define_method(cWIN32OLE_TYPE, "guid", foletype_guid, 0);
rb_define_method(cWIN32OLE_TYPE, "progid", foletype_progid, 0);
rb_define_method(cWIN32OLE_TYPE, "visible?", foletype_visible, 0);
+ rb_define_alias(cWIN32OLE_TYPE, "to_s", "name");
rb_define_method(cWIN32OLE_TYPE, "major_version", foletype_major_version, 0);
rb_define_method(cWIN32OLE_TYPE, "minor_version", foletype_minor_version, 0);
@@ -5367,6 +5368,7 @@ Init_win32ole()
rb_define_method(cWIN32OLE_VARIABLE, "visible?", folevariable_visible, 0);
rb_define_method(cWIN32OLE_VARIABLE, "variable_kind", folevariable_variable_kind, 0);
rb_define_method(cWIN32OLE_VARIABLE, "varkind", folevariable_varkind, 0);
+ rb_define_alias(cWIN32OLE_VARIABLE, "to_s", "name");
cWIN32OLE_METHOD = rb_define_class("WIN32OLE_METHOD", rb_cObject);
rb_define_alloc_func(cWIN32OLE_METHOD, folemethod_s_allocate);
@@ -5390,6 +5392,7 @@ Init_win32ole()
rb_define_method(cWIN32OLE_METHOD, "size_params", folemethod_size_params, 0);
rb_define_method(cWIN32OLE_METHOD, "size_opt_params", folemethod_size_opt_params, 0);
rb_define_method(cWIN32OLE_METHOD, "params", folemethod_params, 0);
+ rb_define_alias(cWIN32OLE_METHOD, "to_s", "name");
cWIN32OLE_PARAM = rb_define_class("WIN32OLE_PARAM", rb_cObject);
rb_define_method(cWIN32OLE_PARAM, "name", foleparam_name, 0);
@@ -5400,6 +5403,7 @@ Init_win32ole()
rb_define_method(cWIN32OLE_PARAM, "optional?", foleparam_optional, 0);
rb_define_method(cWIN32OLE_PARAM, "retval?", foleparam_retval, 0);
rb_define_method(cWIN32OLE_PARAM, "default", foleparam_default, 0);
+ rb_define_alias(cWIN32OLE_PARAM, "to_s", "name");
cWIN32OLE_EVENT = rb_define_class("WIN32OLE_EVENT", rb_cObject);