From 916c5a4480d2f83911fa5a18acbb49d367c7ac06 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 10 Feb 2026 23:02:22 +0000 Subject: [PATCH] chore: add test for same frame callback # Summary I think we don't expect callbacks to happen in this case, since sweeping "for all" events definitely don't want to be re-queued --- Cargo.toml | 1 + .../static_script/same_frame_callback/callback.lua | 3 +++ .../static_script/same_frame_callback/scenario.txt | 13 +++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 assets/tests/lifecycle/default/static_script/same_frame_callback/callback.lua create mode 100644 assets/tests/lifecycle/default/static_script/same_frame_callback/scenario.txt diff --git a/Cargo.toml b/Cargo.toml index 580d625079..384ed1ffb6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -341,6 +341,7 @@ path = "examples/run_script.rs" [[example]] name = "script_loading" path = "examples/script_loading.rs" +required-features = ["lua54"] [workspace.lints.clippy] panic = "deny" diff --git a/assets/tests/lifecycle/default/static_script/same_frame_callback/callback.lua b/assets/tests/lifecycle/default/static_script/same_frame_callback/callback.lua new file mode 100644 index 0000000000..c0dff08f63 --- /dev/null +++ b/assets/tests/lifecycle/default/static_script/same_frame_callback/callback.lua @@ -0,0 +1,3 @@ +function on_test(arg1) + return "got: " .. arg1 +end diff --git a/assets/tests/lifecycle/default/static_script/same_frame_callback/scenario.txt b/assets/tests/lifecycle/default/static_script/same_frame_callback/scenario.txt new file mode 100644 index 0000000000..03dc1f9f20 --- /dev/null +++ b/assets/tests/lifecycle/default/static_script/same_frame_callback/scenario.txt @@ -0,0 +1,13 @@ +SetCurrentLanguage language="@this_script_language" +InstallPlugin miliseconds_budget=999999 +SetupHandler OnTest=null, Update=null +SetupHandler OnTestPostUpdate=null, PostUpdate=null +SetupHandler Last=null, OnTestLast=null +FinalizeApp + +LoadScriptAs as_name="@this_script", path="@this_script" +WaitForScriptLoaded name="@this_script" +AttachStaticScript script="@this_script" +EmitScriptCallbackEvent emit_response=true, label="OnTest", language=null, recipients="StaticScript", script="@this_script", string_value="arg1" +RunUpdateOnce +AssertNoCallbackResponsesEmitted \ No newline at end of file