finish the testing framework

This commit is contained in:
2026-01-16 20:15:34 +01:00
parent 2e097e4e54
commit 8de36aa975
10 changed files with 1044 additions and 62 deletions

View File

@@ -10,7 +10,7 @@
#include <RmlUi/Debugger.h>
#include <RmlUi/Lua.h>
#include <RmlUi/Lua/Interpreter.h>
#include <RmlUi_Backend.h>
#include "RmlUi_Backend.h" // Local backend with input recording hooks
#include "platform.h"
#include "file_interface.h"
@@ -251,6 +251,30 @@ int main(int argc, const char* argv[])
if (!opts.record_file.empty()) {
g_recorder = std::make_unique<mosis::testing::ActionRecorder>(opts.width, opts.height);
g_record_file_path = opts.record_file;
// Set up input callbacks for recording
Backend::SetMouseButtonCallback([](int x, int y, int button, bool pressed) {
if (g_recorder && g_recorder->IsRecording() && button == 0) { // Left mouse button only
if (pressed) {
g_recorder->RecordMouseDown(x, y);
} else {
g_recorder->RecordMouseUp(x, y);
}
}
});
Backend::SetMouseMoveCallback([](int x, int y) {
if (g_recorder && g_recorder->IsRecording()) {
g_recorder->RecordMouseMove(x, y);
}
});
Backend::SetKeyCallback([](int key, bool pressed) {
if (g_recorder && g_recorder->IsRecording()) {
g_recorder->RecordKey(key, pressed);
}
});
LogMessage("Recording mode enabled. Press F5 to start recording.");
}