Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
TextInputChannelTest.java
Go to the documentation of this file.
1package io.flutter.embedding.engine.systemchannels;
2
3import static io.flutter.Build.API_LEVELS;
4import static org.mockito.Mockito.mock;
5import static org.mockito.Mockito.verify;
6
7import android.annotation.TargetApi;
8import androidx.test.ext.junit.runners.AndroidJUnit4;
9import io.flutter.embedding.engine.dart.DartExecutor;
10import io.flutter.plugin.common.MethodCall;
11import io.flutter.plugin.common.MethodChannel;
12import org.json.JSONArray;
13import org.json.JSONException;
14import org.json.JSONObject;
15import org.junit.Test;
16import org.junit.runner.RunWith;
17import org.robolectric.annotation.Config;
18
19@Config(
20 manifest = Config.NONE,
21 shadows = {})
22@RunWith(AndroidJUnit4.class)
23@TargetApi(API_LEVELS.API_24)
25 @Test
26 public void setEditableSizeAndTransformCompletes() throws JSONException {
27 TextInputChannel textInputChannel = new TextInputChannel(mock(DartExecutor.class));
29 JSONObject arguments = new JSONObject();
30 arguments.put("width", 100.0);
31 arguments.put("height", 20.0);
32 arguments.put("transform", new JSONArray(new double[16]));
33 MethodCall call = new MethodCall("TextInput.setEditableSizeAndTransform", arguments);
34 MethodChannel.Result result = mock(MethodChannel.Result.class);
35 textInputChannel.parsingMethodHandler.onMethodCall(call, result);
36 verify(result).success(null);
37 }
38}
void setTextInputMethodHandler(@Nullable TextInputMethodHandler textInputMethodHandler)
static ::testing::Matcher< GBytes * > MethodCall(const std::string &name, ::testing::Matcher< FlValue * > args)
GAsyncResult * result