mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[Win32, Keyboard] Unify key changes in keyboard tests (flutter/engine#31299)
This commit is contained in:
parent
2264b26901
commit
6370d313bb
File diff suppressed because it is too large
Load Diff
@ -191,25 +191,25 @@ void MockEmbedderApiForKeyboard(
|
||||
modifier.embedder_api().Shutdown = [](auto engine) { return kSuccess; };
|
||||
}
|
||||
|
||||
void MockMessageQueue::InjectMessageList(int count,
|
||||
const Win32Message* messages) {
|
||||
for (int i = 0; i < count; i += 1) {
|
||||
_pending_messages.push_back(messages[i]);
|
||||
}
|
||||
while (!_pending_messages.empty()) {
|
||||
Win32Message message = _pending_messages.front();
|
||||
_pending_messages.pop_front();
|
||||
_sent_messages.push_back(message);
|
||||
LRESULT result =
|
||||
Win32SendMessage(message.message, message.wParam, message.lParam);
|
||||
if (message.expected_result != kWmResultDontCheck) {
|
||||
EXPECT_EQ(result, message.expected_result)
|
||||
<< " This is the " << _sent_messages.size()
|
||||
<< ordinal(_sent_messages.size()) << " event, with\n " << std::hex
|
||||
<< "Message 0x" << message.message << " LParam 0x" << message.lParam
|
||||
<< " WParam 0x" << message.wParam;
|
||||
}
|
||||
void MockMessageQueue::PushBack(const Win32Message* message) {
|
||||
_pending_messages.push_back(*message);
|
||||
}
|
||||
|
||||
LRESULT MockMessageQueue::DispatchFront() {
|
||||
assert(!_pending_messages.empty());
|
||||
Win32Message message = _pending_messages.front();
|
||||
_pending_messages.pop_front();
|
||||
_sent_messages.push_back(message);
|
||||
LRESULT result =
|
||||
Win32SendMessage(message.message, message.wParam, message.lParam);
|
||||
if (message.expected_result != kWmResultDontCheck) {
|
||||
EXPECT_EQ(result, message.expected_result)
|
||||
<< " This is the " << _sent_messages.size()
|
||||
<< ordinal(_sent_messages.size()) << " event, with\n " << std::hex
|
||||
<< "Message 0x" << message.message << " LParam 0x" << message.lParam
|
||||
<< " WParam 0x" << message.wParam;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL MockMessageQueue::Win32PeekMessage(LPMSG lpMsg,
|
||||
|
||||
@ -110,10 +110,14 @@ void MockEmbedderApiForKeyboard(
|
||||
// Subclasses must implement |Win32SendMessage| for how dispatched messages are
|
||||
// processed.
|
||||
class MockMessageQueue {
|
||||
public:
|
||||
// Push a list of messages to the message queue, then dispatch
|
||||
// them with |Win32SendMessage| one by one.
|
||||
void InjectMessageList(int count, const Win32Message* messages);
|
||||
protected:
|
||||
// Push a message to the message queue without dispatching it.
|
||||
void PushBack(const Win32Message* message);
|
||||
|
||||
// Dispatch the first message of the message queue and return its result.
|
||||
//
|
||||
// This method asserts that the queue is not empty.
|
||||
LRESULT DispatchFront();
|
||||
|
||||
// Peak the next message in the message queue.
|
||||
//
|
||||
@ -123,7 +127,7 @@ class MockMessageQueue {
|
||||
UINT wMsgFilterMax,
|
||||
UINT wRemoveMsg);
|
||||
|
||||
protected:
|
||||
// Simulate dispatching a message to the system.
|
||||
virtual LRESULT Win32SendMessage(UINT const message,
|
||||
WPARAM const wparam,
|
||||
LPARAM const lparam) = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user