fix: guard button and session transitions for 1.0.4

This commit is contained in:
2026-11-02 22:59:16 +08:00
parent 447a4e385e
commit ded4a437cc
15 changed files with 589 additions and 140 deletions
@@ -0,0 +1,24 @@
#include "session_rules.h"
#include <string>
#include <vector>
int main() {
neslite::OperationCompletion completion;
const std::vector<std::string> operations{"load", "run", "pause", "stop", "reset", "audio_rebuild",
"state_save:0", "state_load:9", "auto_load:2", "package_export", "package_import"};
std::uint64_t sequence = 0;
for (const auto& command : operations) {
const auto expected_id = ++sequence;
completion.record(expected_id, command, "7:finished");
for (const auto& noise : {"volume:0.5", "mute:on", "mute:off", "fast:on", "fast:off"}) {
completion.record(++sequence, noise, "7:ignored");
if (completion.id != expected_id || completion.command != command || completion.result != "7:finished") return 1;
}
}
completion.record(++sequence, "stop", "7:stop_save_failed");
completion.record(++sequence, "volume:1", "7:volume");
if (completion.result != "7:stop_save_failed") return 2;
completion.record(++sequence, "stop", "7:stopped_saved");
if (completion.id != sequence || completion.result != "7:stopped_saved") return 3;
return 0;
}