Event-driven dialog queue, story flag command, mod unit tests

Push-based event chains, runtime fixes (single end, goto lifecycle, if,
busy box, held delay, empty options, timed/animated/effect actions), the
'flag name value' DSL command, autoplay --dialogs=N, 19 mod unit tests.
This commit is contained in:
cthangover committed 2026-10-21 12:31:52 +02:00
1 parent 9f86bdbb0c
commit bd55716349
86 files changed
+3173 -2181

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
namespace Cthangover.Mods.Dialog.Tests
{
using System.Threading.Tasks;
using Cthangover.Core.Mods.Testing;
using Cthangover.Core.Scenes;
using Cthangover.Mods.Dialog.Executable;
/// <summary>
/// A standalone <see cref="ExecutableEvent"/> (not inside a chain): a run the dialog
/// box refused is not counted, and the event starts by itself on the next state
/// change, without polling.
/// </summary>
public class ExecutableEventTests
{
[ModTest("event/refused_run_is_not_counted", TimeoutSeconds = 10)]
static async Task RefusedRunIsNotCounted(ModTestContext ctx)
{
var stage = await DialogStage.Create();
try
{
stage.Box.IsActive = false;
var evt = new ScenarioEvent { ScenarioText = "text \"S\"", ScenarioId = "dialog_base_test_standalone", IsOneRun = true };
stage.Host.AddChild(evt);
await DialogStage.Frames(2);
ModAssert.False(stage.Box.IsRunning, "inactive box refused the event");
ModAssert.True(evt.IsFirstRun, "refused automatic run is not counted");
ModAssert.False(evt.RunDialog(), "direct run is refused too");
ModAssert.True(evt.IsFirstRun, "refused direct run is not counted");
stage.Box.IsActive = true;
ConditionStateMonitor.MarkStateChanged();
await DialogStage.Frames(2);
ModAssert.True(stage.Box.Locker == evt, "one-run event starts on the next state change");
ModAssert.False(evt.IsFirstRun, "the real run is counted");
}
finally
{
stage.Free();
}
}
}
}