Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
io.flutter.embedding.android.KeyboardManagerTest.KeyboardTester Class Reference

Public Member Functions

 KeyboardTester ()
 
void respondToChannelCallsWith (boolean handled)
 
void recordChannelCallsTo (@NonNull ArrayList< CallRecord > storage)
 
void respondToEmbedderCallsWith (boolean handled)
 
void recordEmbedderCallsTo (@NonNull ArrayList< CallRecord > storage)
 
void respondToTextInputWith (boolean response)
 

Public Attributes

KeyboardManager.ViewDelegate mockView
 
KeyboardManager keyboardManager
 

Detailed Description

Definition at line 180 of file KeyboardManagerTest.java.

Constructor & Destructor Documentation

◆ KeyboardTester()

io.flutter.embedding.android.KeyboardManagerTest.KeyboardTester.KeyboardTester ( )
inline

Definition at line 181 of file KeyboardManagerTest.java.

181 {
185
186 BinaryMessenger mockMessenger = mock(BinaryMessenger.class);
187 doAnswer(invocation -> onMessengerMessage(invocation))
188 .when(mockMessenger)
189 .send(any(String.class), any(ByteBuffer.class), eq(null));
190 doAnswer(invocation -> onMessengerMessage(invocation))
191 .when(mockMessenger)
192 .send(any(String.class), any(ByteBuffer.class), any(BinaryMessenger.BinaryReply.class));
193
194 mockView = mock(KeyboardManager.ViewDelegate.class);
195 doAnswer(invocation -> mockMessenger).when(mockView).getBinaryMessenger();
196 doAnswer(invocation -> textInputResult)
197 .when(mockView)
198 .onTextInputKeyEvent(any(KeyEvent.class));
199 doAnswer(
200 invocation -> {
201 KeyEvent event = invocation.getArgument(0);
202 boolean handled = keyboardManager.handleEvent(event);
203 assertEquals(handled, false);
204 return null;
205 })
206 .when(mockView)
207 .redispatch(any(KeyEvent.class));
208
209 keyboardManager = new KeyboardManager(mockView);
210 }
static bool eq(const SkM44 &a, const SkM44 &b, float tol)
Definition: M44Test.cpp:18
boolean handleEvent(@NonNull KeyEvent keyEvent)
FlKeyEvent * event
SIT bool any(const Vec< 1, T > &x)
Definition: SkVx.h:530

Member Function Documentation

◆ recordChannelCallsTo()

void io.flutter.embedding.android.KeyboardManagerTest.KeyboardTester.recordChannelCallsTo ( @NonNull ArrayList< CallRecord storage)
inline

Record channel calls to the given storage.

They are not responded to until the stored callbacks are manually called.

Definition at line 230 of file KeyboardManagerTest.java.

230 {
231 channelHandler =
232 (JSONObject data, Consumer<Boolean> reply) -> {
233 storage.add(CallRecord.channelCall(data, reply));
234 };
235 }
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ recordEmbedderCallsTo()

void io.flutter.embedding.android.KeyboardManagerTest.KeyboardTester.recordEmbedderCallsTo ( @NonNull ArrayList< CallRecord storage)
inline

Record embedder calls to the given storage.

They are not responded to until the stored callbacks are manually called.

Definition at line 252 of file KeyboardManagerTest.java.

252 {
253 embedderHandler =
254 (KeyData keyData, Consumer<Boolean> reply) ->
255 storage.add(CallRecord.embedderCall(keyData, reply));
256 }

◆ respondToChannelCallsWith()

void io.flutter.embedding.android.KeyboardManagerTest.KeyboardTester.respondToChannelCallsWith ( boolean  handled)
inline

Set channel calls to respond immediately with the given response.

Definition at line 216 of file KeyboardManagerTest.java.

216 {
217 channelHandler =
218 (JSONObject data, Consumer<Boolean> reply) -> {
219 if (reply != null) {
220 reply.accept(handled);
221 }
222 };
223 }

◆ respondToEmbedderCallsWith()

void io.flutter.embedding.android.KeyboardManagerTest.KeyboardTester.respondToEmbedderCallsWith ( boolean  handled)
inline

Set embedder calls to respond immediately with the given response.

Definition at line 238 of file KeyboardManagerTest.java.

238 {
239 embedderHandler =
240 (KeyData keyData, Consumer<Boolean> reply) -> {
241 if (reply != null) {
242 reply.accept(handled);
243 }
244 };
245 }

◆ respondToTextInputWith()

void io.flutter.embedding.android.KeyboardManagerTest.KeyboardTester.respondToTextInputWith ( boolean  response)
inline

Set text calls to respond with the given response.

Definition at line 259 of file KeyboardManagerTest.java.

259 {
260 textInputResult = response;
261 }

Member Data Documentation

◆ keyboardManager

KeyboardManager io.flutter.embedding.android.KeyboardManagerTest.KeyboardTester.keyboardManager

Definition at line 213 of file KeyboardManagerTest.java.

◆ mockView

KeyboardManager.ViewDelegate io.flutter.embedding.android.KeyboardManagerTest.KeyboardTester.mockView

Definition at line 212 of file KeyboardManagerTest.java.


The documentation for this class was generated from the following file: