-
Notifications
You must be signed in to change notification settings - Fork 6k
Do not expect WM_CHAR if control or windows key is pressed #27064
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,5 +84,27 @@ TEST(MockWin32Window, KeyDownPrintable) { | |
| window.InjectWindowMessage(WM_CHAR, 65, lparam); | ||
| } | ||
|
|
||
| TEST(MockWin32Window, KeyDownWithCtrl) { | ||
| MockWin32Window window; | ||
|
|
||
| // Simulate CONTROL pressed | ||
| BYTE keyboard_state[256]; | ||
| memset(keyboard_state, 0, 256); | ||
| keyboard_state[VK_CONTROL] = -1; | ||
| SetKeyboardState(keyboard_state); | ||
|
|
||
| LPARAM lparam = CreateKeyEventLparam(30); | ||
|
|
||
| // Expect OnKey, but not OnText, because Control + Key is not followed by | ||
| // WM_CHAR | ||
| EXPECT_CALL(window, OnKey(65, 30, WM_KEYDOWN, 0, false, true)).Times(1); | ||
| EXPECT_CALL(window, OnText(_)).Times(0); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you check if this test fails without the change? As far as I remember,
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand. Without what change? This is a compltely new test. It should result in OnKey called once, and no OnText call.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without your fix to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the test fails because
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. Thanks for confirming. |
||
|
|
||
| window.InjectWindowMessage(WM_KEYDOWN, 65, lparam); | ||
|
|
||
| memset(keyboard_state, 0, 256); | ||
| SetKeyboardState(keyboard_state); | ||
| } | ||
|
|
||
| } // namespace testing | ||
| } // namespace flutter | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this line for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was suggested here (for clarity), but somehow ended up in the wrong block :-/. Since it doesn't do anything anyway I'll make another PR to remove it.