use concinnity_core::ecs::World;
use concinnity_core::ecs::asset_id::AssetId;
pub(crate) fn lock() -> concinnity_testing::ExclusiveAccess {
prepare();
concinnity_testing::exclusive()
}
fn prepare() {
let _ = tracing_subscriber::fmt().with_test_writer().try_init();
concinnity_testing::forbid_windows();
}
pub(crate) fn isolate_state_dir() {
crate::project::open(
concinnity_host::store::paths::StateTree::at(concinnity_testing::shared_state_dir(
"concinnity-dev-tests",
))
.with_cache(concinnity_testing::shared_cache_dir(
"concinnity-dev-tests-cache",
)),
);
}
pub(crate) fn injected_world(sprites: &[AssetId], labels: &[AssetId], fields: &[AssetId]) -> World {
use concinnity_core::components::{Sprite, TextInput, TextLabel};
let mut world = World::new();
for &id in sprites {
world.push_identified(id, Sprite::default());
}
for &id in labels {
world.push_identified(id, TextLabel::default());
}
for &id in fields {
world.push_identified(id, TextInput::default());
}
world
}