Ensure the SettingsStore global is added in tests
This commit is contained in:
parent
68867fe2e1
commit
cee7edabf9
10 changed files with 61 additions and 32 deletions
|
@ -1174,7 +1174,7 @@ impl AppContext {
|
|||
this.notify_global(type_id);
|
||||
result
|
||||
} else {
|
||||
panic!("No global added for {}", std::any::type_name::<T>());
|
||||
panic!("no global added for {}", std::any::type_name::<T>());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1182,6 +1182,15 @@ impl AppContext {
|
|||
self.globals.clear();
|
||||
}
|
||||
|
||||
pub fn remove_global<T: 'static>(&mut self) -> T {
|
||||
*self
|
||||
.globals
|
||||
.remove(&TypeId::of::<T>())
|
||||
.unwrap_or_else(|| panic!("no global added for {}", std::any::type_name::<T>()))
|
||||
.downcast()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn add_model<T, F>(&mut self, build_model: F) -> ModelHandle<T>
|
||||
where
|
||||
T: Entity,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue