Skip to content

Commit

Permalink
Fix Java null pointer exception
Browse files Browse the repository at this point in the history
  • Loading branch information
gspencergoog committed Oct 27, 2023
1 parent fd13af5 commit 17395ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/web_ui/test/engine/keyboard_converter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void testMain() {
character: 'A',
timeStamp: Duration.zero,
synthesized: false,
).toString(), 'KeyData(type: down, physical: 0x700e5, logical: 0x61 (Unicode), character: "A" (0x41))');
).toString(), 'KeyData(Down, physical: 0x700e5, logical: 0x61 (Unicode), character: "A" (0x41))');

expect(const ui.KeyData(
type: ui.KeyEventType.up,
Expand All @@ -71,7 +71,7 @@ void testMain() {
character: '\n',
timeStamp: Duration.zero,
synthesized: true,
).toString(), r'KeyData(type: up, physical: 0x700e6, logical: 0x100000061 (Unprintable), character: "\n" (0x0a), synthesized)');
).toString(), r'KeyData(Up, physical: 0x700e6, logical: 0x100000061 (Unprintable), character: "\n" (0x0a), synthesized)');

expect(const ui.KeyData(
type: ui.KeyEventType.repeat,
Expand All @@ -81,7 +81,7 @@ void testMain() {
character: null,
timeStamp: Duration.zero,
synthesized: false,
).toString(), 'KeyData(type: repeat, physical: 0x700e7, logical: 0x9900000071, character: <none>)');
).toString(), 'KeyData(Repeat, physical: 0x700e7, logical: 0x9900000071, character: <none>)');
});

test('Single key press, repeat, and release', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ private boolean handleEventImpl(
output.physicalKey = physicalKey;
output.character = character;
output.synthesized = false;
output.deviceType = KeyData.DeviceType.kKeyboard;

sendKeyEvent(output, onKeyEventHandledCallback);
for (final Runnable postSyncEvent : postSynchronizeEvents) {
Expand All @@ -384,6 +385,7 @@ private void synthesizeEvent(boolean isDown, Long logicalKey, Long physicalKey,
output.physicalKey = physicalKey;
output.character = null;
output.synthesized = true;
output.deviceType = KeyData.DeviceType.kKeyboard;
if (physicalKey != 0 && logicalKey != 0) {
updatePressingState(physicalKey, isDown ? logicalKey : null);
}
Expand Down

0 comments on commit 17395ad

Please sign in to comment.