diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index a3c5fed207..29cc18bf69 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -3230,6 +3230,7 @@ mod tests { #[test] fn each_filter_plugin_is_a_result_of_its_own() { use vectorcraft_plugins::wat as tpl; + let _names = crate::tests::SHARED_PLUGIN_NAMES.lock().unwrap_or_else(|e| e.into_inner()); let (one, two) = ("test.UI.palette_filter-one", "test.UI.palette_filter-two"); let (key_one, key_two) = (format!("plugin:{one}"), format!("plugin:{two}")); let install = |id: &str, params: &str| { @@ -3509,6 +3510,7 @@ mod tests { #[test] fn filter_plugins_with_one_name_show_their_ids() { use vectorcraft_plugins::wat as tpl; + let _names = crate::tests::SHARED_PLUGIN_NAMES.lock().unwrap_or_else(|e| e.into_inner()); let (one, two) = ("test.UI.palette_same-one", "test.UI.palette_same-two"); for id in [one, two] { let manifest = format!(r#"{{"id":"{id}","name":"Same Name","version":"1","kind":"filter","params":{{"wiggle":{{"type":"bool"}}}}}}"#); diff --git a/crates/ui-egui/src/shortcuts/tests.rs b/crates/ui-egui/src/shortcuts/tests.rs index 063d63bb14..45314702b8 100644 --- a/crates/ui-egui/src/shortcuts/tests.rs +++ b/crates/ui-egui/src/shortcuts/tests.rs @@ -3391,6 +3391,7 @@ fn a_live_effect_plugin_installed_later_takes_a_shortcut_of_its_own() { fn each_filter_plugin_takes_a_shortcut_of_its_own() { use serde_json::Value; use vectorcraft_plugins::wat as tpl; + let _names = crate::tests::SHARED_PLUGIN_NAMES.lock().unwrap_or_else(|e| e.into_inner()); let (one, two) = ("test.UI.key_filter-one", "test.UI.key_filter-two"); let (key_one, key_two) = (format!("plugin:{one}"), format!("plugin:{two}")); let install = |id: &str, name: &str, params: &str| { diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index e0619ddaf7..36a9cdc17b 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -62,3 +62,8 @@ mod toolescape; mod trace_runs; mod transparencygrid; mod widthtool; + +/// Installed plug-ins are process-wide. Tests that install filter plug-ins under a name another +/// test also installs, or that check how plug-ins sharing a name are told apart, hold this lock +/// while their plug-ins are installed, so each sees only its own plug-ins under that name. +pub(super) static SHARED_PLUGIN_NAMES: std::sync::Mutex<()> = std::sync::Mutex::new(());