2023-08-07 13:04:31 +01:00
|
|
|
require_relative "minitest_helper"
|
2023-08-07 22:32:35 +01:00
|
|
|
require "voicemeeter"
|
2023-08-07 13:04:31 +01:00
|
|
|
|
|
|
|
class CAPIErrorTest < Minitest::Test
|
2023-08-09 17:47:13 +01:00
|
|
|
def test_it_raises_a_capierror_on_unknown_parameter
|
2023-08-07 13:04:31 +01:00
|
|
|
e = assert_raises(Voicemeeter::Errors::VMCAPIError) { Test.vm.set("Unknown.Parameter", 1) }
|
2023-08-18 21:26:54 +01:00
|
|
|
assert_equal("VBVMR_SetParameterFloat", e.fn_name)
|
|
|
|
assert_equal(-3, e.code)
|
2023-08-07 13:04:31 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class InvalidKindTest < MiniTest::Test
|
2023-08-09 17:47:13 +01:00
|
|
|
def test_it_raises_a_vmerror_on_invalid_kind
|
2023-08-07 13:16:01 +01:00
|
|
|
e = assert_raises(Voicemeeter::Errors::VMError) { Voicemeeter::Remote.new("unknown_kind") }
|
2023-08-18 21:26:54 +01:00
|
|
|
assert_equal("unknown Voicemeeter kind 'unknown_kind'", e.message)
|
2023-08-07 13:04:31 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class UnknownConfigTest < MiniTest::Test
|
2023-08-09 17:47:13 +01:00
|
|
|
def test_it_raises_a_vmerror_on_unknown_config_name
|
2023-08-07 13:16:01 +01:00
|
|
|
e = assert_raises(Voicemeeter::Errors::VMError) { Test.vm.apply_config(:unknown) }
|
2023-08-18 21:26:54 +01:00
|
|
|
assert_equal("unknown config 'unknown'. known configs: #{Test.vm.configs.keys}", e.message)
|
2023-08-09 17:47:13 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class UnknownConfigKey < MiniTest::Test
|
|
|
|
def test_it_raises_a_keyerror_on_unknown_config_key
|
|
|
|
config = {
|
|
|
|
"strip-0" => {mute: true, gain: 3.2, A1: true},
|
|
|
|
"unknown-0" => {stateonly: true},
|
|
|
|
"vban-out-3" => {on: true, bit: 24}
|
|
|
|
}
|
|
|
|
e = assert_raises(KeyError) { Test.vm.apply(config) }
|
2023-08-18 21:26:54 +01:00
|
|
|
assert_equal("invalid config key 'unknown-0'", e.message)
|
2023-08-07 13:04:31 +01:00
|
|
|
end
|
|
|
|
end
|