mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-15 16:40:46 +00:00
add recorder, recorder.mode tests
This commit is contained in:
parent
145f85b7cd
commit
b02f3af665
@ -11,7 +11,7 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
|
||||
|
||||
- [x]
|
||||
|
||||
## [2.1.0] - 2023-06-30
|
||||
## [2.1.0] - 2023-07-01
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -6,36 +6,50 @@ import voicemeeterlib
|
||||
from voicemeeterlib.kinds import KindId
|
||||
from voicemeeterlib.kinds import request_kind_map as kindmap
|
||||
|
||||
# let's keep things random
|
||||
KIND_ID = random.choice(tuple(kind_id.name.lower() for kind_id in KindId))
|
||||
vm = voicemeeterlib.api(KIND_ID)
|
||||
kind = kindmap(KIND_ID)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Data:
|
||||
"""bounds data to map tests to a kind"""
|
||||
|
||||
name: str = kind.name
|
||||
phys_in: int = kind.ins[0] - 1
|
||||
virt_in: int = kind.ins[0] + kind.ins[-1] - 1
|
||||
phys_out: int = kind.outs[0] - 1
|
||||
virt_out: int = kind.outs[0] + kind.outs[-1] - 1
|
||||
vban_in: int = kind.vban[0] - 1
|
||||
vban_out: int = kind.vban[-1] - 1
|
||||
button_lower: int = 0
|
||||
button_upper: int = 79
|
||||
asio_in: int = kind.asio[0] - 1
|
||||
asio_out: int = kind.asio[-1] - 1
|
||||
insert_lower: int = 0
|
||||
insert_higher: int = kind.insert - 1
|
||||
name: str
|
||||
phys_in: int
|
||||
virt_in: int
|
||||
phys_out: int
|
||||
virt_out: int
|
||||
vban_in: int
|
||||
vban_out: int
|
||||
button_lower: int
|
||||
button_upper: int
|
||||
asio_in: int
|
||||
asio_out: int
|
||||
insert_lower: int
|
||||
insert_higher: int
|
||||
|
||||
@property
|
||||
def channels(self):
|
||||
return (2 * self.phys_in) + (8 * self.virt_in)
|
||||
|
||||
|
||||
data = Data()
|
||||
# let's keep things random
|
||||
KIND_ID = random.choice(tuple(kind_id.name.lower() for kind_id in KindId))
|
||||
vm = voicemeeterlib.api(KIND_ID)
|
||||
kind = kindmap(KIND_ID)
|
||||
|
||||
data = Data(
|
||||
name=kind.name,
|
||||
phys_in=kind.ins[0] - 1,
|
||||
virt_in=kind.ins[0] + kind.ins[-1] - 1,
|
||||
phys_out=kind.outs[0] - 1,
|
||||
virt_out=kind.outs[0] + kind.outs[-1] - 1,
|
||||
vban_in=kind.vban[0] - 1,
|
||||
vban_out=kind.vban[-1] - 1,
|
||||
button_lower=0,
|
||||
button_upper=79,
|
||||
asio_in=kind.asio[0] - 1,
|
||||
asio_out=kind.asio[-1] - 1,
|
||||
insert_lower=0,
|
||||
insert_higher=kind.insert - 1,
|
||||
)
|
||||
|
||||
|
||||
def setup_module():
|
||||
|
@ -156,6 +156,7 @@ class TestSetAndGetBoolHigher:
|
||||
[("A1"), ("B2")],
|
||||
)
|
||||
def test_it_sets_and_gets_recorder_bool_params(self, param, value):
|
||||
assert hasattr(vm.recorder, param)
|
||||
setattr(vm.recorder, param, value)
|
||||
assert getattr(vm.recorder, param) == value
|
||||
|
||||
@ -168,7 +169,56 @@ class TestSetAndGetBoolHigher:
|
||||
[("loop")],
|
||||
)
|
||||
def test_it_sets_recorder_bool_params(self, param, value):
|
||||
assert hasattr(vm.recorder, param)
|
||||
setattr(vm.recorder, param, value)
|
||||
assert getattr(vm.recorder, param) == value
|
||||
|
||||
""" recoder.mode tests """
|
||||
|
||||
@pytest.mark.skipif(
|
||||
data.name == "basic",
|
||||
reason="Skip test if kind is basic",
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"param",
|
||||
[("loop"), ("recbus")],
|
||||
)
|
||||
def test_it_sets_recorder_mode_bool_params(self, param, value):
|
||||
assert hasattr(vm.recorder.mode, param)
|
||||
setattr(vm.recorder.mode, param, value)
|
||||
assert getattr(vm.recorder.mode, param) == value
|
||||
|
||||
""" recorder.armstrip """
|
||||
|
||||
@pytest.mark.skipif(
|
||||
data.name == "basic",
|
||||
reason="Skip test if kind is basic",
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"index",
|
||||
[
|
||||
(data.phys_out),
|
||||
(data.virt_out),
|
||||
],
|
||||
)
|
||||
def test_it_sets_recorder_armstrip_bool_params(self, index, value):
|
||||
vm.recorder.armstrip[index].set(value)
|
||||
|
||||
""" recorder.armbus """
|
||||
|
||||
@pytest.mark.skipif(
|
||||
data.name == "basic",
|
||||
reason="Skip test if kind is basic",
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"index",
|
||||
[
|
||||
(data.phys_out),
|
||||
(data.virt_out),
|
||||
],
|
||||
)
|
||||
def test_it_sets_recorder_armbus_bool_params(self, index, value):
|
||||
vm.recorder.armbus[index].set(True)
|
||||
|
||||
""" fx tests """
|
||||
|
||||
@ -323,6 +373,26 @@ class TestSetAndGetIntHigher:
|
||||
vm.option.delay[index].set(value)
|
||||
assert vm.option.delay[index].get() == value
|
||||
|
||||
""" recorder tests """
|
||||
|
||||
@pytest.mark.skipif(
|
||||
data.name == "basic",
|
||||
reason="Skip test if kind is basic",
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[
|
||||
("samplerate", 32000),
|
||||
("samplerate", 96000),
|
||||
("bitresolution", 16),
|
||||
("bitresolution", 32),
|
||||
],
|
||||
)
|
||||
def test_it_sets_and_gets_recorder_int_params(self, param, value):
|
||||
assert hasattr(vm.recorder, param)
|
||||
setattr(vm.recorder, param, value)
|
||||
assert getattr(vm.recorder, param) == value
|
||||
|
||||
|
||||
class TestSetAndGetFloatHigher:
|
||||
__test__ = True
|
||||
|
Loading…
Reference in New Issue
Block a user