1 # frozen_string_literal: false
8 if defined?(WIN32OLE_VARIABLE)
9 class TestWIN32OLE_VARIABLE < Test::Unit::TestCase
12 ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants")
13 @var1 = ole_type.variables.find {|v| v.name == 'ssfDESKTOP'}
15 variables = WIN32OLE_TYPE.new("Microsoft Windows Installer Object Library", "Installer").variables
16 @var2 = variables.find {|v| v.name == 'UILevel'}
20 assert_raise(TypeError) {WIN32OLE_VARIABLE.new}
24 assert_equal('ssfDESKTOP', @var1.name)
28 assert_equal('INT', @var1.ole_type)
29 assert_equal('MsiUILevel', @var2.ole_type)
32 def test_ole_type_detail
33 assert_equal(['INT'], @var1.ole_type_detail)
34 assert_equal(['USERDEFINED', 'MsiUILevel'], @var2.ole_type_detail)
37 def test_ole_type_value
38 assert_equal(0, @var1.value)
39 assert_equal(nil, @var2.value)
42 def test_ole_type_visible?
43 assert(@var1.visible?)
46 def test_ole_type_variable_kind
47 assert_equal("CONSTANT", @var1.variable_kind)
48 assert_equal("DISPATCH", @var2.variable_kind)
51 def test_ole_type_varkind
52 assert_equal(2, @var1.varkind)
53 assert_equal(3, @var2.varkind)
57 assert_equal(@var1.name, @var1.to_s)
61 assert_equal("#<WIN32OLE_VARIABLE:ssfDESKTOP=0>", @var1.inspect)
62 assert_equal("#<WIN32OLE_VARIABLE:UILevel=nil>", @var2.inspect)