7 if defined?(WIN32OLE_TYPELIB)
8 class TestWIN32OLE_TYPELIB < Test::Unit::TestCase
10 tlibs = WIN32OLE_TYPELIB.typelibs
11 assert_instance_of(Array, tlibs)
12 assert(tlibs.size > 0)
13 tlib = tlibs.find {|tlib| tlib.name == "Microsoft Shell Controls And Automation"}
18 assert_raise(ArgumentError) {
19 WIN32OLE_TYPELIB.new(1,2,3,4)
22 assert_raise(TypeError) {
23 WIN32OLE_TYPELIB.new(100)
26 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
27 assert_instance_of(WIN32OLE_TYPELIB, tlib)
29 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation", 1.0)
30 assert_instance_of(WIN32OLE_TYPELIB, tlib)
32 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation", 1, 0)
33 assert_instance_of(WIN32OLE_TYPELIB, tlib)
36 tlib_by_guid = WIN32OLE_TYPELIB.new(guid, 1, 0)
37 assert_instance_of(WIN32OLE_TYPELIB, tlib_by_guid)
38 assert_equal("Microsoft Shell Controls And Automation" , tlib_by_guid.name)
41 tlib_by_path = WIN32OLE_TYPELIB.new(path)
42 assert_equal("Microsoft Shell Controls And Automation" , tlib_by_path.name)
44 assert_raise(WIN32OLERuntimeError) {
45 WIN32OLE_TYPELIB.new("Non Exist Type Library")
50 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
51 assert_equal("{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}", tlib.guid)
55 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
56 assert_equal("Microsoft Shell Controls And Automation", tlib.name)
57 tlib = WIN32OLE_TYPELIB.new("{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}")
58 assert_equal("Microsoft Shell Controls And Automation", tlib.name)
62 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
63 assert_equal(1.0, tlib.version)
66 def test_major_version
67 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
68 assert_equal(1, tlib.major_version)
71 def test_minor_version
72 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
73 assert_equal(0, tlib.minor_version)
77 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
78 assert_match(/shell32\.dll$/i, tlib.path)
82 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
87 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
88 assert_equal("Shell32", tlib.library_name)
92 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
93 assert_equal("Microsoft Shell Controls And Automation", tlib.to_s)
97 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
98 ole_types = tlib.ole_types
99 assert_instance_of(Array, ole_types)
100 assert(ole_types.size > 0)
101 assert_instance_of(WIN32OLE_TYPE, ole_types[0])
105 tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
106 assert_equal("#<WIN32OLE_TYPELIB:Microsoft Shell Controls And Automation>", tlib.inspect)