add patch, option unit tests.

upd test badges
This commit is contained in:
onyx-and-iris 2022-07-21 23:17:42 +01:00
parent c105115458
commit 84f97738bf
7 changed files with 132 additions and 8 deletions

View File

@ -20,13 +20,21 @@ class Data:
name: str = kind.name name: str = kind.name
phys_in: int = kind.ins[0] - 1 phys_in: int = kind.ins[0] - 1
virt_in: int = kind.ins[0] + kind.ins[1] - 1 virt_in: int = kind.ins[0] + kind.ins[-1] - 1
phys_out: int = kind.outs[0] - 1 phys_out: int = kind.outs[0] - 1
virt_out: int = kind.outs[0] + kind.outs[1] - 1 virt_out: int = kind.outs[0] + kind.outs[-1] - 1
vban_in: int = kind.vban[0] - 1 vban_in: int = kind.vban[0] - 1
vban_out: int = kind.vban[1] - 1 vban_out: int = kind.vban[-1] - 1
button_lower: int = 0 button_lower: int = 0
button_upper: int = 79 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
@property
def channels(self):
return (2 * self.phys_in) + (8 * self.virt_in)
data = Data() data = Data()

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 122"><title>tests: 122</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">122</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">122</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 140"><title>tests: 140</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">140</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">140</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 112"><title>tests: 112</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">112</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">112</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 114"><title>tests: 114</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">114</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">114</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 138"><title>tests: 138</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">138</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">138</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 156"><title>tests: 156</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">156</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">156</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -17,6 +17,8 @@ class TestUserConfigs:
def test_it_tests_config_string(self): def test_it_tests_config_string(self):
assert "PhysStrip" in tests.strip[data.phys_in].label assert "PhysStrip" in tests.strip[data.phys_in].label
assert "VirtStrip" in tests.strip[data.virt_in].label assert "VirtStrip" in tests.strip[data.virt_in].label
assert "PhysBus" in tests.bus[data.phys_out].label
assert "VirtBus" in tests.bus[data.virt_out].label
def test_it_tests_config_bool(self): def test_it_tests_config_bool(self):
assert tests.strip[0].A1 == True assert tests.strip[0].A1 == True

View File

@ -17,6 +17,7 @@ class TestRemoteFactories:
assert hasattr(tests, "button") assert hasattr(tests, "button")
assert hasattr(tests, "vban") assert hasattr(tests, "vban")
assert hasattr(tests, "device") assert hasattr(tests, "device")
assert hasattr(tests, "option")
assert len(tests.strip) == 3 assert len(tests.strip) == 3
assert len(tests.bus) == 2 assert len(tests.bus) == 2
@ -34,7 +35,9 @@ class TestRemoteFactories:
assert hasattr(tests, "button") assert hasattr(tests, "button")
assert hasattr(tests, "vban") assert hasattr(tests, "vban")
assert hasattr(tests, "device") assert hasattr(tests, "device")
assert hasattr(tests, "option")
assert hasattr(tests, "recorder") assert hasattr(tests, "recorder")
assert hasattr(tests, "patch")
assert len(tests.strip) == 5 assert len(tests.strip) == 5
assert len(tests.bus) == 5 assert len(tests.bus) == 5
@ -52,7 +55,9 @@ class TestRemoteFactories:
assert hasattr(tests, "button") assert hasattr(tests, "button")
assert hasattr(tests, "vban") assert hasattr(tests, "vban")
assert hasattr(tests, "device") assert hasattr(tests, "device")
assert hasattr(tests, "option")
assert hasattr(tests, "recorder") assert hasattr(tests, "recorder")
assert hasattr(tests, "patch")
assert hasattr(tests, "fx") assert hasattr(tests, "fx")
assert len(tests.strip) == 8 assert len(tests.strip) == 8

View File

@ -143,17 +143,54 @@ class TestSetAndGetBoolHigher:
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != "potato",
reason="Skip test if kind is basic", reason="Skip test if kind is not potato",
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param", "param",
[("reverb"), ("reverb_ab"), ("delay"), ("delay_ab")], [("reverb"), ("reverb_ab"), ("delay"), ("delay_ab")],
) )
def test_it_sets_and_gets_fx_bool_params(self, param, value): def test_it_sets_and_gets_fx_bool_params(self, param, value):
assert hasattr(tests, "fx")
setattr(tests.fx, param, value) setattr(tests.fx, param, value)
assert getattr(tests.fx, param) == value assert getattr(tests.fx, param) == value
""" patch tests """
@pytest.mark.skipif(
data.name == "basic",
reason="Skip test if kind is basic",
)
@pytest.mark.parametrize(
"param",
[("postfadercomposite")],
)
def test_it_sets_and_gets_patch_bool_params(self, param, value):
setattr(tests.patch, param, value)
assert getattr(tests.patch, param) == value
""" patch.insert tests """
@pytest.mark.skipif(
data.name == "basic",
reason="Skip test if kind is basic",
)
@pytest.mark.parametrize(
"index, param",
[(data.insert_lower, "on"), (data.insert_higher, "on")],
)
def test_it_sets_and_gets_patch_insert_bool_params(self, index, param, value):
setattr(tests.patch.insert[index], param, value)
assert getattr(tests.patch.insert[index], param) == value
""" option tests """
@pytest.mark.parametrize(
"param",
[("monitoronsel")],
)
def test_it_sets_and_gets_option_bool_params(self, param, value):
setattr(tests.option, param, value)
assert getattr(tests.option, param) == value
class TestSetAndGetIntHigher: class TestSetAndGetIntHigher:
__test__ = True __test__ = True
@ -183,6 +220,78 @@ class TestSetAndGetIntHigher:
setattr(tests.vban.outstream[index], param, value) setattr(tests.vban.outstream[index], param, value)
assert getattr(tests.vban.outstream[index], param) == value assert getattr(tests.vban.outstream[index], param) == value
""" patch.asio tests """
@pytest.mark.skipif(
data.name == "basic",
reason="Skip test if kind is basic",
)
@pytest.mark.parametrize(
"index,value",
[
(0, 1),
(data.asio_in, 4),
],
)
def test_it_sets_and_gets_patch_asio_in_int_params(self, index, value):
tests.patch.asio[index].set(value)
assert tests.patch.asio[index].get() == value
""" patch.A2[i]-A5[i] tests """
@pytest.mark.skipif(
data.name == "basic",
reason="Skip test if kind is basic",
)
@pytest.mark.parametrize(
"index,value",
[
(0, 1),
(data.asio_out, 4),
],
)
def test_it_sets_and_gets_patch_asio_out_int_params(self, index, value):
tests.patch.A2[index].set(value)
assert tests.patch.A2[index].get() == value
tests.patch.A5[index].set(value)
assert tests.patch.A5[index].get() == value
""" patch.composite tests """
@pytest.mark.skipif(
data.name == "basic",
reason="Skip test if kind is basic",
)
@pytest.mark.parametrize(
"index,value",
[
(0, 3),
(0, data.channels),
(7, 8),
(7, data.channels),
],
)
def test_it_sets_and_gets_patch_composite_int_params(self, index, value):
tests.patch.composite[index].set(value)
assert tests.patch.composite[index].get() == value
""" option tests """
@pytest.mark.skipif(
data.name == "basic",
reason="Skip test if kind is basic",
)
@pytest.mark.parametrize(
"index,value",
[
(data.phys_out, 30),
(data.phys_out, 500),
],
)
def test_it_sets_and_gets_patch_delay_int_params(self, index, value):
tests.option.delay[index].set(value)
assert tests.option.delay[index].get() == value
class TestSetAndGetFloatHigher: class TestSetAndGetFloatHigher:
__test__ = True __test__ = True