Class: TestOLETYPE
- Inherits:
-
RUNIT::TestCase
- Object
- RUNIT::TestCase
- TestOLETYPE
show all
- Includes:
- OLESERVER
- Defined in:
- tests/testOLETYPE.rb
Constant Summary
Constants included
from OLESERVER
OLESERVER::MS_EXCEL_TYPELIB, OLESERVER::MS_XML_TYPELIB
Instance Method Summary
collapse
Instance Method Details
#test_class_to_s ⇒ Object
35
36
37
38
39
40
41
|
# File 'tests/testOLETYPE.rb', line 35
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
|
#test_helpcontext ⇒ Object
87
88
89
90
91
|
# File 'tests/testOLETYPE.rb', line 87
def test_helpcontext
classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
worksheet = classes.find {|c| c.name == 'Worksheet'}
assert_equal(131088, worksheet.helpcontext)
end
|
#test_helpfile ⇒ Object
82
83
84
85
86
|
# File 'tests/testOLETYPE.rb', line 82
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
|
#test_helpstring ⇒ Object
67
68
69
70
71
|
# File 'tests/testOLETYPE.rb', line 67
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
|
#test_name ⇒ Object
27
28
29
30
31
32
33
|
# File 'tests/testOLETYPE.rb', line 27
def test_name
classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
class_names = classes.collect{|c|
c.name
}
assert(class_names.include?('Application'))
end
|
#test_ole_methods ⇒ Object
77
78
79
80
81
|
# File 'tests/testOLETYPE.rb', line 77
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
|
#test_ole_type ⇒ Object
43
44
45
46
47
48
49
|
# File 'tests/testOLETYPE.rb', line 43
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
|
#test_s_ole_classes ⇒ Object
#test_s_progids ⇒ Object
23
24
25
26
|
# File 'tests/testOLETYPE.rb', line 23
def test_s_progids
progids = WIN32OLE_TYPE.progids
assert(progids.include?('Excel.Application'))
end
|
#test_s_typelibs ⇒ Object
#test_src_type ⇒ Object
62
63
64
65
66
|
# File 'tests/testOLETYPE.rb', line 62
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
|
#test_to_s ⇒ Object
92
93
94
95
|
# File 'tests/testOLETYPE.rb', line 92
def test_to_s
type = WIN32OLE_TYPE.new(MS_EXCEL_TYPELIB, 'Application')
assert_equal("Application", "#{type}");
end
|
#test_typekind ⇒ Object
50
51
52
53
54
|
# File 'tests/testOLETYPE.rb', line 50
def test_typekind
classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
app = classes.find {|c| c.name == 'Application'}
assert_equal(5, app.typekind)
end
|
#test_variables ⇒ Object
72
73
74
75
76
|
# File 'tests/testOLETYPE.rb', line 72
def test_variables
classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
xlchart = classes.find {|c| c.name == 'XlChartType'}
assert(xlchart.variables.size > 0)
end
|
#test_visible ⇒ Object
55
56
57
58
59
60
61
|
# File 'tests/testOLETYPE.rb', line 55
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
|