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.
This commit is contained in:
38
TestInputHandler.cc
Normal file
38
TestInputHandler.cc
Normal file
@@ -0,0 +1,38 @@
|
||||
#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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user