Files
kte/TestInputHandler.cc
Kyle Isom 8c8e4e59a4 Add TestFrontend documentation and UndoSystem buffer reference update.
- Document `TestFrontend` for programmatic testing, including examples and usage details.
- Add `UpdateBufferReference` to `UndoSystem` to support updating buffer associations.
2025-11-30 02:56:39 -08:00

39 lines
638 B
C++

#include "TestInputHandler.h"
bool
TestInputHandler::Poll(MappedInput &out)
{
if (queue_.empty())
return false;
out = queue_.front();
queue_.pop();
return true;
}
void
TestInputHandler::QueueCommand(CommandId id, const std::string &arg, int count)
{
MappedInput mi;
mi.hasCommand = true;
mi.id = id;
mi.arg = arg;
mi.count = count;
queue_.push(mi);
}
void
TestInputHandler::QueueText(const std::string &text)
{
for (char ch: text) {
MappedInput mi;
mi.hasCommand = true;
mi.id = CommandId::InsertText;
mi.arg = std::string(1, ch);
mi.count = 0;
queue_.push(mi);
}
}