Skip to content

Commit 94cb1c1

Browse files
committed
fix failing test utils test
1 parent d3a3a9e commit 94cb1c1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

crates/test_utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
publish = false
66

77
[dependencies]
8-
bevy = { workspace = true }
8+
bevy = { workspace = true, features = ["bevy_asset"] }
99

1010
[lib]
1111
path = "src/lib.rs"

crates/test_utils/src/test_data.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::alloc::Layout;
22

3+
use bevy::asset::AssetPlugin;
34
use bevy::ecs::{component::*, world::World};
45
use bevy::prelude::*;
56
use bevy::reflect::*;
@@ -225,6 +226,9 @@ impl_test_component_ids!(
225226
);
226227

227228
fn init_world<F: FnOnce(&mut World, &mut TypeRegistry)>(world: &mut World, init: F) {
229+
let type_registry = world.get_resource_or_init::<AppTypeRegistry>().clone();
230+
let mut type_registry_guard = type_registry.0.write();
231+
228232
while world.components().len() < TEST_COMPONENT_ID_START {
229233
unsafe {
230234
world.register_component_with_descriptor(ComponentDescriptor::new_with_layout(
@@ -236,8 +240,6 @@ fn init_world<F: FnOnce(&mut World, &mut TypeRegistry)>(world: &mut World, init:
236240
};
237241
}
238242

239-
let type_registry = world.get_resource_or_init::<AppTypeRegistry>().clone();
240-
let mut type_registry_guard = type_registry.0.write();
241243
init_all_components(world, &mut type_registry_guard);
242244
init(world, &mut type_registry_guard);
243245
}

0 commit comments

Comments
 (0)