Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 42 additions & 40 deletions assets/tests/add_system/added_systems_run_in_parallel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,51 +25,53 @@ digraph {
node_0 [label="bevy_asset::assets::Assets<bevy_asset::folder::LoadedFolder>::asset_events"];
node_1 [label="bevy_asset::assets::Assets<bevy_asset::assets::LoadedUntypedAsset>::asset_events"];
node_2 [label="bevy_asset::assets::Assets<()>::asset_events"];
node_3 [label="bevy_asset::assets::Assets<bevy_mod_scripting_asset::script_asset::ScriptAsset>::asset_events"];
node_4 [label="bevy_mod_scripting_bindings::allocator::garbage_collector"];
node_5 [label="bevy_mod_scripting_core::handler::script_error_logger"];
node_6 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_7 [label="script_integration_test_harness::dummy_post_update_system"];
node_8 [label="bevy_mod_scripting_core::pipeline::start::filter_script_attachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_9 [label="bevy_mod_scripting_core::pipeline::start::filter_script_detachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_10 [label="bevy_mod_scripting_core::pipeline::start::filter_script_modifications<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_11 [label="bevy_mod_scripting_core::pipeline::start::process_attachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_12 [label="bevy_mod_scripting_core::pipeline::start::process_detachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_13 [label="bevy_mod_scripting_core::pipeline::start::process_asset_modifications<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_14 [label="bevy_mod_scripting_core::pipeline::automatic_pipeline_runner<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_15 [label="on_test_post_update"];
node_16 [label="custom_system_a"];
node_17 [label="custom_system_b"];
node_18 [label="SystemSet AssetEvents"];
node_19 [label="SystemSet GarbageCollection"];
node_20 [label="SystemSet ListeningPhase"];
node_21 [label="SystemSet MachineStartPhase"];
node_22 [label="SystemSet ScriptSystem(custom_system_a)"];
node_23 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_2 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_3 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_3 [label="bevy_asset::assets::Assets<test_utils::test_data::TestAsset>::asset_events"];
node_4 [label="bevy_asset::assets::Assets<bevy_mod_scripting_asset::script_asset::ScriptAsset>::asset_events"];
node_5 [label="bevy_mod_scripting_bindings::allocator::garbage_collector"];
node_6 [label="bevy_mod_scripting_core::handler::script_error_logger"];
node_7 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_8 [label="script_integration_test_harness::dummy_post_update_system"];
node_9 [label="bevy_mod_scripting_core::pipeline::start::filter_script_attachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_10 [label="bevy_mod_scripting_core::pipeline::start::filter_script_detachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_11 [label="bevy_mod_scripting_core::pipeline::start::filter_script_modifications<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_12 [label="bevy_mod_scripting_core::pipeline::start::process_attachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_13 [label="bevy_mod_scripting_core::pipeline::start::process_detachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_14 [label="bevy_mod_scripting_core::pipeline::start::process_asset_modifications<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_15 [label="bevy_mod_scripting_core::pipeline::automatic_pipeline_runner<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_16 [label="on_test_post_update"];
node_17 [label="custom_system_a"];
node_18 [label="custom_system_b"];
node_19 [label="SystemSet AssetEvents"];
node_20 [label="SystemSet GarbageCollection"];
node_21 [label="SystemSet ListeningPhase"];
node_22 [label="SystemSet MachineStartPhase"];
node_23 [label="SystemSet ScriptSystem(custom_system_a)"];
node_24 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_2 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_3 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_4 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_8 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_10 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_5 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_10 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_11 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_12 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_13 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_16 -> node_22 [color=red, label="child of", arrowhead=diamond];
node_12 -> node_22 [color=red, label="child of", arrowhead=diamond];
node_13 -> node_22 [color=red, label="child of", arrowhead=diamond];
node_14 -> node_22 [color=red, label="child of", arrowhead=diamond];
node_17 -> node_23 [color=red, label="child of", arrowhead=diamond];
node_6 -> node_7 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_10 [color=blue, label="runs before", arrowhead=normal];
node_18 -> node_24 [color=red, label="child of", arrowhead=diamond];
node_7 -> node_8 [color=blue, label="runs before", arrowhead=normal];
node_9 -> node_10 [color=blue, label="runs before", arrowhead=normal];
node_11 -> node_12 [color=blue, label="runs before", arrowhead=normal];
node_9 -> node_10 [color=blue, label="runs before", arrowhead=normal];
node_9 -> node_11 [color=blue, label="runs before", arrowhead=normal];
node_10 -> node_11 [color=blue, label="runs before", arrowhead=normal];
node_12 -> node_13 [color=blue, label="runs before", arrowhead=normal];
node_15 -> node_16 [color=blue, label="runs before", arrowhead=normal];
node_15 -> node_17 [color=blue, label="runs before", arrowhead=normal];
node_20 -> node_21 [color=blue, label="runs before", arrowhead=normal];
node_21 -> node_14 [color=blue, label="runs before", arrowhead=normal];
node_13 -> node_14 [color=blue, label="runs before", arrowhead=normal];
node_16 -> node_17 [color=blue, label="runs before", arrowhead=normal];
node_16 -> node_18 [color=blue, label="runs before", arrowhead=normal];
node_21 -> node_22 [color=blue, label="runs before", arrowhead=normal];
node_22 -> node_15 [color=blue, label="runs before", arrowhead=normal];
}
]]
assert_str_eq(dot_graph, expected_dot_graph, "Expected the schedule graph to match the expected graph")
Expand Down
82 changes: 42 additions & 40 deletions assets/tests/add_system/added_systems_run_in_parallel.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -24,51 +24,53 @@ digraph {
node_0 [label="bevy_asset::assets::Assets<bevy_asset::folder::LoadedFolder>::asset_events"];
node_1 [label="bevy_asset::assets::Assets<bevy_asset::assets::LoadedUntypedAsset>::asset_events"];
node_2 [label="bevy_asset::assets::Assets<()>::asset_events"];
node_3 [label="bevy_asset::assets::Assets<bevy_mod_scripting_asset::script_asset::ScriptAsset>::asset_events"];
node_4 [label="bevy_mod_scripting_bindings::allocator::garbage_collector"];
node_5 [label="bevy_mod_scripting_core::handler::script_error_logger"];
node_6 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_7 [label="script_integration_test_harness::dummy_post_update_system"];
node_8 [label="bevy_mod_scripting_core::pipeline::start::filter_script_attachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_9 [label="bevy_mod_scripting_core::pipeline::start::filter_script_detachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_10 [label="bevy_mod_scripting_core::pipeline::start::filter_script_modifications<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_11 [label="bevy_mod_scripting_core::pipeline::start::process_attachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_12 [label="bevy_mod_scripting_core::pipeline::start::process_detachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_13 [label="bevy_mod_scripting_core::pipeline::start::process_asset_modifications<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_14 [label="bevy_mod_scripting_core::pipeline::automatic_pipeline_runner<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_15 [label="on_test_post_update"];
node_16 [label="custom_system_a"];
node_17 [label="custom_system_b"];
node_18 [label="SystemSet AssetEvents"];
node_19 [label="SystemSet GarbageCollection"];
node_20 [label="SystemSet ListeningPhase"];
node_21 [label="SystemSet MachineStartPhase"];
node_22 [label="SystemSet ScriptSystem(custom_system_a)"];
node_23 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_2 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_3 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_3 [label="bevy_asset::assets::Assets<test_utils::test_data::TestAsset>::asset_events"];
node_4 [label="bevy_asset::assets::Assets<bevy_mod_scripting_asset::script_asset::ScriptAsset>::asset_events"];
node_5 [label="bevy_mod_scripting_bindings::allocator::garbage_collector"];
node_6 [label="bevy_mod_scripting_core::handler::script_error_logger"];
node_7 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_8 [label="script_integration_test_harness::dummy_post_update_system"];
node_9 [label="bevy_mod_scripting_core::pipeline::start::filter_script_attachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_10 [label="bevy_mod_scripting_core::pipeline::start::filter_script_detachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_11 [label="bevy_mod_scripting_core::pipeline::start::filter_script_modifications<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_12 [label="bevy_mod_scripting_core::pipeline::start::process_attachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_13 [label="bevy_mod_scripting_core::pipeline::start::process_detachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_14 [label="bevy_mod_scripting_core::pipeline::start::process_asset_modifications<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_15 [label="bevy_mod_scripting_core::pipeline::automatic_pipeline_runner<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_16 [label="on_test_post_update"];
node_17 [label="custom_system_a"];
node_18 [label="custom_system_b"];
node_19 [label="SystemSet AssetEvents"];
node_20 [label="SystemSet GarbageCollection"];
node_21 [label="SystemSet ListeningPhase"];
node_22 [label="SystemSet MachineStartPhase"];
node_23 [label="SystemSet ScriptSystem(custom_system_a)"];
node_24 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_2 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_3 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_4 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_8 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_10 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_5 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_10 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_11 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_12 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_13 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_16 -> node_22 [color=red, label="child of", arrowhead=diamond];
node_12 -> node_22 [color=red, label="child of", arrowhead=diamond];
node_13 -> node_22 [color=red, label="child of", arrowhead=diamond];
node_14 -> node_22 [color=red, label="child of", arrowhead=diamond];
node_17 -> node_23 [color=red, label="child of", arrowhead=diamond];
node_6 -> node_7 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_10 [color=blue, label="runs before", arrowhead=normal];
node_18 -> node_24 [color=red, label="child of", arrowhead=diamond];
node_7 -> node_8 [color=blue, label="runs before", arrowhead=normal];
node_9 -> node_10 [color=blue, label="runs before", arrowhead=normal];
node_11 -> node_12 [color=blue, label="runs before", arrowhead=normal];
node_9 -> node_10 [color=blue, label="runs before", arrowhead=normal];
node_9 -> node_11 [color=blue, label="runs before", arrowhead=normal];
node_10 -> node_11 [color=blue, label="runs before", arrowhead=normal];
node_12 -> node_13 [color=blue, label="runs before", arrowhead=normal];
node_15 -> node_16 [color=blue, label="runs before", arrowhead=normal];
node_15 -> node_17 [color=blue, label="runs before", arrowhead=normal];
node_20 -> node_21 [color=blue, label="runs before", arrowhead=normal];
node_21 -> node_14 [color=blue, label="runs before", arrowhead=normal];
node_13 -> node_14 [color=blue, label="runs before", arrowhead=normal];
node_16 -> node_17 [color=blue, label="runs before", arrowhead=normal];
node_16 -> node_18 [color=blue, label="runs before", arrowhead=normal];
node_21 -> node_22 [color=blue, label="runs before", arrowhead=normal];
node_22 -> node_15 [color=blue, label="runs before", arrowhead=normal];
}`;

assert_str_eq.call(dot_graph, expected_dot_graph, "Expected the schedule graph to match the expected graph");
Expand Down
10 changes: 10 additions & 0 deletions assets/tests/asset_operations/asset_operations.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function on_test()
local test_handle = create_test_asset(42, "TestAssetName")

assert(test_handle ~= nil, "Test asset handle should not be nil")
assert(world.has_asset(test_handle) == true, "has_asset should return true")

local retrieved_asset = world.get_asset(test_handle, types.TestAsset)
assert(retrieved_asset.value == 42, "Asset value should be 42")
assert(retrieved_asset.name == "TestAssetName", "Asset name should be 'TestAssetName'")
end
10 changes: 10 additions & 0 deletions assets/tests/asset_operations/asset_operations.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fn on_test() {
let test_handle = create_test_asset(42, "TestAssetName");

assert(test_handle != (), "Test asset handle should not be nil");
assert(world.has_asset.call(test_handle) == true, "has_asset should return true");

let retrieved_asset = world.get_asset.call(test_handle, types.TestAsset);
assert(retrieved_asset.value == 42, "Asset value should be 42");
assert(retrieved_asset.name == "TestAssetName", "Asset name should be 'TestAssetName'");
}
1 change: 1 addition & 0 deletions crates/bevy_mod_scripting_bindings/src/access_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ impl ReflectAccessId {
ReflectBase::Resource(id) => Self::for_component_id(id),
ReflectBase::Component(_, id) => Self::for_component_id(id),
ReflectBase::Owned(id) => Self::for_allocation(id),
ReflectBase::Asset(_, assets_resource_id) => Self::for_component_id(assets_resource_id),
}
}
}
Expand Down
Loading
Loading