8
if defined?(WIN32OLE_TYPELIB)
9
class TestWIN32OLE_TYPELIB < Test::Unit::TestCase
11
tlibs = WIN32OLE_TYPELIB.typelibs
12
assert_instance_of(Array, tlibs)
13
assert(tlibs.size > 0)
14
tlib = tlibs.find {|tlib| tlib.name == "Microsoft Shell Controls And Automation"}
19
assert_raise(ArgumentError) {
20
WIN32OLE_TYPELIB.new(1,2,3,4)
22
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
23
assert_instance_of(WIN32OLE_TYPELIB, tlib)
25
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation", 1.0)
26
assert_instance_of(WIN32OLE_TYPELIB, tlib)
28
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation", 1, 0)
29
assert_instance_of(WIN32OLE_TYPELIB, tlib)
32
tlib_by_guid = WIN32OLE_TYPELIB.new(guid, 1, 0)
33
assert_instance_of(WIN32OLE_TYPELIB, tlib_by_guid)
34
assert_equal("Microsoft Shell Controls And Automation" , tlib_by_guid.name)
37
tlib_by_path = WIN32OLE_TYPELIB.new(path)
38
assert_equal("Microsoft Shell Controls And Automation" , tlib_by_path.name)
40
assert_raise(WIN32OLERuntimeError) {
41
WIN32OLE_TYPELIB.new("Non Exist Type Library")
46
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
47
assert_equal("{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}", tlib.guid)
51
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
52
assert_equal("Microsoft Shell Controls And Automation", tlib.name)
53
tlib = WIN32OLE_TYPELIB.new("{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}")
54
assert_equal("Microsoft Shell Controls And Automation", tlib.name)
58
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
59
assert_equal(1.0, tlib.version)
62
def test_major_version
63
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
64
assert_equal(1, tlib.major_version)
67
def test_minor_version
68
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
69
assert_equal(0, tlib.minor_version)
73
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
74
assert_match(/shell32\.dll$/i, tlib.path)
78
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
79
assert_equal("Microsoft Shell Controls And Automation", tlib.to_s)
83
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
84
ole_classes = tlib.ole_classes
85
assert_instance_of(Array, ole_classes)
86
assert(ole_classes.size > 0)
87
assert_instance_of(WIN32OLE_TYPE, ole_classes[0])
91
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
92
assert_equal("#<WIN32OLE_TYPELIB:Microsoft Shell Controls And Automation>", tlib.inspect)