DEFINITIONS
This source file includes following functions.
1 # You need RubyUnit and MS Excel and MSI to run this test script
2
3 require 'rubyunit'
4
5 require 'win32ole'
6 require 'oleserver'
7
8 class TestOLEVARIABLE < RUNIT::TestCase
9 include OLESERVER
10 def test_name
11 classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
12 chart = classes.find {|c| c.name == 'XlChartType'}
13 var_names = chart.variables.collect {|m| m.name}
14 assert(var_names.size > 0)
15 assert(var_names.include?('xl3DColumn'))
16 end
17 def test_ole_type
18 classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
19 chart = classes.find {|c| c.name == 'XlChartType'}
20 var = chart.variables.find {|m| m.name == 'xl3DColumn'}
21 assert_equal('INT', var.ole_type)
22 end
23 def test_ole_type_detail
24 classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
25 chart = classes.find {|c| c.name == 'XlChartType'}
26 var = chart.variables.find {|m| m.name == 'xl3DColumn'}
27 assert_equal(['INT'], var.ole_type_detail)
28 end
29
30 def test_value
31 classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
32 chart = classes.find {|c| c.name == 'XlChartType'}
33 var = chart.variables.find {|m| m.name == 'xl3DColumn'}
34 assert_equal(-4100, var.value)
35 end
36 def test_visible
37 classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
38 chart = classes.find {|c| c.name == 'XlChartType'}
39 var = chart.variables.find {|m| m.name == 'xl3DColumn'}
40 assert(var.visible?)
41 end
42 end