2022-02-25 17:02:27 +00:00
|
|
|
from nose.tools import assert_equal, nottest
|
|
|
|
from parameterized import parameterized, parameterized_class
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
from tests import tests
|
|
|
|
|
2022-04-08 21:16:37 +01:00
|
|
|
# @nottest
|
|
|
|
@parameterized_class([{"val": False}, {"val": True}])
|
2022-02-25 17:02:27 +00:00
|
|
|
class TestSetAndGetBoolHigher(unittest.TestCase):
|
2022-04-08 21:16:37 +01:00
|
|
|
"""strip tests, physical and virtual"""
|
|
|
|
|
|
|
|
@parameterized.expand(
|
|
|
|
[
|
|
|
|
(0, "mute"),
|
|
|
|
(2, "mono"),
|
|
|
|
(3, "A1"),
|
|
|
|
(6, "B3"),
|
|
|
|
(6, "mute"),
|
|
|
|
]
|
|
|
|
)
|
2022-02-25 17:02:27 +00:00
|
|
|
def test_it_sets_and_gets_strip_bool_params(self, index, param):
|
|
|
|
setattr(tests.strip[index], param, self.val)
|
|
|
|
retval = getattr(tests.strip[index], param)
|
|
|
|
self.assertTrue(isinstance(retval, bool))
|
|
|
|
assert_equal(retval, self.val)
|
|
|
|
|
2022-02-28 18:14:31 +00:00
|
|
|
""" bus tests, physical and virtual """
|
2022-04-08 21:16:37 +01:00
|
|
|
|
|
|
|
@parameterized.expand(
|
|
|
|
[(0, "mute"), (2, "mono"), (6, "mute"), (2, "eq"), (7, "eq_ab")]
|
|
|
|
)
|
2022-02-28 18:14:31 +00:00
|
|
|
def test_it_sets_and_gets_bus_bool_params(self, index, param):
|
|
|
|
setattr(tests.bus[index], param, self.val)
|
|
|
|
retval = getattr(tests.bus[index], param)
|
|
|
|
self.assertTrue(isinstance(retval, bool))
|
|
|
|
assert_equal(retval, self.val)
|
|
|
|
|
2022-03-18 07:40:43 +00:00
|
|
|
""" bus mode tests, physical and virtual """
|
2022-04-08 21:16:37 +01:00
|
|
|
|
|
|
|
@parameterized.expand(
|
|
|
|
[
|
|
|
|
(0, "amix"),
|
|
|
|
(0, "tvmix"),
|
|
|
|
(2, "composite"),
|
|
|
|
(2, "upmix41"),
|
|
|
|
(7, "upmix21"),
|
|
|
|
(7, "rearonly"),
|
|
|
|
(6, "lfeonly"),
|
|
|
|
(6, "repeat"),
|
|
|
|
]
|
|
|
|
)
|
2022-03-18 07:40:43 +00:00
|
|
|
def test_it_sets_and_gets_bus_mode_bool_params(self, index, param):
|
|
|
|
setattr(tests.bus[index].mode, param, self.val)
|
|
|
|
retval = getattr(tests.bus[index].mode, param)
|
|
|
|
self.assertTrue(isinstance(retval, bool))
|
|
|
|
assert_equal(retval, self.val)
|
|
|
|
|
2022-02-25 17:02:27 +00:00
|
|
|
|
2022-04-08 21:16:37 +01:00
|
|
|
# @nottest
|
|
|
|
@parameterized_class([{"val": "test0"}, {"val": "test1"}, {"val": ""}])
|
2022-02-25 17:02:27 +00:00
|
|
|
class TestSetAndGetStringHigher(unittest.TestCase):
|
2022-04-08 21:16:37 +01:00
|
|
|
"""strip tests, physical and virtual"""
|
|
|
|
|
|
|
|
@parameterized.expand([(2, "label"), (6, "label")])
|
2022-02-25 17:02:27 +00:00
|
|
|
def test_it_sets_and_gets_strip_string_params(self, index, param):
|
|
|
|
setattr(tests.strip[index], param, self.val)
|
|
|
|
assert_equal(getattr(tests.strip[index], param), self.val)
|
|
|
|
|
|
|
|
""" bus tests, physical and virtual """
|
2022-04-08 21:16:37 +01:00
|
|
|
|
|
|
|
@parameterized.expand([(0, "label"), (7, "label")])
|
2022-02-25 17:02:27 +00:00
|
|
|
def test_it_sets_and_gets_bus_string_params(self, index, param):
|
|
|
|
setattr(tests.bus[index], param, self.val)
|
|
|
|
assert_equal(getattr(tests.bus[index], param), self.val)
|
2022-02-28 18:14:31 +00:00
|
|
|
|
|
|
|
|
2022-04-08 21:16:37 +01:00
|
|
|
# @nottest
|
2022-02-28 18:14:31 +00:00
|
|
|
class TestSetAndGetFloatHigher(unittest.TestCase):
|
2022-04-08 21:16:37 +01:00
|
|
|
"""strip tests, physical and virtual"""
|
|
|
|
|
|
|
|
@parameterized.expand(
|
|
|
|
[(0, 1, "gain", -6.3), (7, 4, "gain", -12.5), (3, 3, "gain", 3.3)]
|
|
|
|
)
|
2022-02-28 18:14:31 +00:00
|
|
|
def test_it_sets_and_gets_strip_float_params(self, index, j, param, val):
|
|
|
|
setattr(tests.strip[index].gainlayer[j], param, val)
|
|
|
|
retval = getattr(tests.strip[index].gainlayer[j], param)
|
|
|
|
assert_equal(retval, val)
|
|
|
|
|
|
|
|
""" bus tests, physical and virtual """
|
2022-04-08 21:16:37 +01:00
|
|
|
|
|
|
|
@parameterized.expand([(0, "gain", -6.3), (7, "gain", -12.5), (3, "gain", 3.3)])
|
2022-02-28 18:14:31 +00:00
|
|
|
def test_it_sets_and_gets_bus_float_params(self, index, param, val):
|
|
|
|
setattr(tests.bus[index], param, val)
|
|
|
|
retval = getattr(tests.bus[index], param)
|
|
|
|
assert_equal(retval, val)
|