π π A Python library for audio.
C audioaudio-processingaudio-productionaudio-researchaudio-unitaugmentationjucemachine-learningpybind11pythonvst3vst3-host
Added preset loading testing
Emil Winebrandcf9eabd07ccb
diff --git a/tests/presets/CHOWTapeModel.vst3.vstpreset b/tests/presets/CHOWTapeModel.vst3.vstpresetnew file mode 100644index 0000000..e95a3d7Binary files /dev/null and b/tests/presets/CHOWTapeModel.vst3.vstpreset differdiff --git a/tests/test_external_plugins.py b/tests/test_external_plugins.pyindex 6b7bd42..40f0b16 100644--- a/tests/test_external_plugins.py+++ b/tests/test_external_plugins.py@@ -37,6 +37,7 @@ from typing import OptionalTEST_PLUGIN_BASE_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "plugins")+TEST_PRESET_BASE_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "presets")AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT = [os.path.basename(filename)@@ -188,6 +189,30 @@ def test_at_least_one_parameter(plugin_filename: str):assert get_parameters(plugin_filename)+ "plugin_filename,plugin_preset", [+ (plugin,os.path.join(TEST_PRESET_BASE_PATH, plugin+".vstpreset"))+ for plugin in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT \+ if os.path.isfile(os.path.join(TEST_PRESET_BASE_PATH, plugin+".vstpreset"))+ ])+def test_preset_parameters(plugin_filename: str, plugin_preset: str):+ # plugin with default params.+ plugin = load_test_plugin(plugin_filename)++ default_params = {+ k: v.raw_value for k, v in plugin.parameters.items() if v.type == float+ }+++ # load preset file+ plugin.load_preset(plugin_preset)+++ for name, default in default_params.items():+ actual = getattr(plugin, name)+ if math.isnan(actual):+ continue+ assert actual != default, f"Expected attribute {name} was {actual} supposed to be different from default {default}"@pytest.mark.parametrize("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)def test_initial_parameters(plugin_filename: str):