@@ -365,35 +365,26 @@ - (bool)textInputPlugin {
365
365
}
366
366
367
367
- (bool )forwardKeyEventsToSystemWhenComposing {
368
- KeyboardTester* tester = [[KeyboardTester alloc ] init ];
369
-
370
- tester.isComposing = YES ;
371
- // Send a down event with composing == YES.
372
- [tester.manager handleEvent: keyDownEvent (0x50 )];
368
+ KeyboardTester* tester = OCMPartialMock ([[KeyboardTester alloc ] init ]);
373
369
374
370
NSMutableArray <FlutterAsyncKeyCallback>* channelCallbacks =
375
371
[NSMutableArray <FlutterAsyncKeyCallback> array];
376
372
NSMutableArray <FlutterAsyncKeyCallback>* embedderCallbacks =
377
373
[NSMutableArray <FlutterAsyncKeyCallback> array];
378
374
[tester recordEmbedderCallsTo: embedderCallbacks];
379
375
[tester recordChannelCallsTo: channelCallbacks];
380
- // TextInputPlugin does not claim the event.
376
+ // The event shouldn't propagate further even if TextInputPlugin does not
377
+ // claim the event.
381
378
[tester respondTextInputWith: NO ];
379
+
380
+ tester.isComposing = YES ;
381
+ // Send a down event with composing == YES.
382
382
[tester.manager handleEvent: keyUpEvent (0x50 )];
383
383
384
384
// Nobody gets the event except for the text input plugin.
385
385
EXPECT_EQ ([channelCallbacks count ], 0u );
386
386
EXPECT_EQ ([embedderCallbacks count ], 0u );
387
-
388
- // Send another down event with composing == NO.
389
- tester.isComposing = NO ;
390
- [tester respondTextInputWith: YES ];
391
- [tester.manager handleEvent: keyDownEvent (0x50 )];
392
- // Now the responders get the event.
393
- EXPECT_EQ ([channelCallbacks count ], 1u );
394
- EXPECT_EQ ([embedderCallbacks count ], 1u );
395
- embedderCallbacks[0 ](TRUE );
396
- channelCallbacks[0 ](TRUE );
387
+ OCMVerify (times (1 ), [tester handleTextInputKeyEvent: checkKeyDownEvent (0x50 )]);
397
388
398
389
return true ;
399
390
}
0 commit comments