diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index bf08e37abb..6eba474b74 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -1546,6 +1546,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| { @@ -1826,6 +1827,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 0f302c1551..7012201f84 100644 --- a/crates/ui-egui/src/shortcuts/tests.rs +++ b/crates/ui-egui/src/shortcuts/tests.rs @@ -1642,6 +1642,7 @@ fn a_live_effect_plugin_installed_later_takes_a_shortcut_of_its_own() { #[test] fn each_filter_plugin_takes_a_shortcut_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.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 ad10a9bac5..dbb5a87b32 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -56,3 +56,8 @@ mod tab_reorder; pub(crate) mod taskbar; mod toolescape; mod trace_runs; + +/// 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(());