Integration test for embeded Android Views touch support.
The test places an embedded Android view at the top left, and verifies that motion events that get to FlutterView are equivalent to the synthesized motion events that gets to the embedded view. See the README.md for more high level details.
This commit is contained in:
8
dev/integration_tests/android_views/.metadata
Normal file
8
dev/integration_tests/android_views/.metadata
Normal file
@@ -0,0 +1,8 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: 19aa6f8de8c34af7e62f4791393a98d7decf1b65
|
||||
channel: unknown
|
||||
32
dev/integration_tests/android_views/README.md
Normal file
32
dev/integration_tests/android_views/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Integration test for touch events on embedded Android views
|
||||
|
||||
This test verifies that the synthesized motion events that get to embedded
|
||||
Android view are equal to the motion events that originally hit the FlutterView.
|
||||
|
||||
The test app's Android code listens to MotionEvents that get to FlutterView and
|
||||
to an embedded Android view and sends them over a platform channel to the Dart
|
||||
code, where the events are matched.
|
||||
|
||||
This is what the app looks like:
|
||||
|
||||

|
||||
|
||||
The blue part is the embedded Android view, because it is positioned at the top
|
||||
left corner, the coordinate systems for FlutterView and for the embedded view's
|
||||
virtual display has the same origin (this makes the MotionEvent comparison
|
||||
easier as we don't need to translate the coordinates).
|
||||
|
||||
The app includes the following control buttons:
|
||||
* RECORD - Start listening for MotionEvents for 3 seconds, matched/unmatched events are
|
||||
displayed in the listview as they arrive.
|
||||
* CLEAR - Clears the events that were recorded so far.
|
||||
* SAVE - Saves the events that hit FlutterView to a file.
|
||||
* PLAY FILE - Send a list of events from a bundled asset file to FlutterView.
|
||||
|
||||
A recorded touch events sequence is bundled as an asset in the
|
||||
assets_for_android_view package which lives in the goldens repository.
|
||||
|
||||
When running this test with `flutter drive` the record touch sequences is
|
||||
replayed and the test asserts that the events that got to FlutterView are
|
||||
equivalent to the ones that got to the embedded view.
|
||||
|
||||
61
dev/integration_tests/android_views/android/app/build.gradle
Normal file
61
dev/integration_tests/android_views/android/app/build.gradle
Normal file
@@ -0,0 +1,61 @@
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||
localProperties.load(reader)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
throw new GradleException("versionCode not found. Define flutter.versionCode in the local.properties file.")
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||
if (flutterVersionName == null) {
|
||||
throw new GradleException("versionName not found. Define flutter.versionName in the local.properties file.")
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
|
||||
lintOptions {
|
||||
disable 'InvalidPackage'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "io.flutter.integration.androidviews"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 27
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="io.flutter.integration.androidviews">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:label="android_views">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<meta-data
|
||||
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
|
||||
android:value="true" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,104 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package io.flutter.integration.androidviews;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import io.flutter.app.FlutterActivity;
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||
|
||||
public class MainActivity extends FlutterActivity implements MethodChannel.MethodCallHandler {
|
||||
final static int STORAGE_PERMISSION_CODE = 1;
|
||||
|
||||
MethodChannel mMethodChannel;
|
||||
TouchPipe mFlutterViewTouchPipe;
|
||||
|
||||
// The method result to complete with the Android permission request result.
|
||||
// This is null when not waiting for the Android permission request;
|
||||
private MethodChannel.Result permissionResult;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
GeneratedPluginRegistrant.registerWith(this);
|
||||
getFlutterView().getPluginRegistry()
|
||||
.registrarFor("io.flutter.integration.android_views").platformViewRegistry()
|
||||
.registerViewFactory("simple_view", new SimpleViewFactory(getFlutterView()));
|
||||
mMethodChannel = new MethodChannel(this.getFlutterView(), "android_views_integration");
|
||||
mMethodChannel.setMethodCallHandler(this);
|
||||
mFlutterViewTouchPipe = new TouchPipe(mMethodChannel, getFlutterView());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
|
||||
switch(methodCall.method) {
|
||||
case "pipeFlutterViewEvents":
|
||||
mFlutterViewTouchPipe.enable();
|
||||
result.success(null);
|
||||
return;
|
||||
case "stopFlutterViewEvents":
|
||||
mFlutterViewTouchPipe.disable();
|
||||
result.success(null);
|
||||
return;
|
||||
case "getStoragePermission":
|
||||
if (permissionResult != null) {
|
||||
result.error("error", "already waiting for permissions", null);
|
||||
return;
|
||||
}
|
||||
permissionResult = result;
|
||||
getExternalStoragePermissions();
|
||||
return;
|
||||
case "synthesizeEvent":
|
||||
synthesizeEvent(methodCall, result);
|
||||
return;
|
||||
}
|
||||
result.notImplemented();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void synthesizeEvent(MethodCall methodCall, MethodChannel.Result result) {
|
||||
MotionEvent event = MotionEventCodec.decode((HashMap<String, Object>) methodCall.arguments());
|
||||
getFlutterView().dispatchTouchEvent(event);
|
||||
result.success(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
if (requestCode != STORAGE_PERMISSION_CODE || permissionResult == null)
|
||||
return;
|
||||
boolean permisisonGranted = grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
|
||||
sendPermissionResult(permisisonGranted);
|
||||
}
|
||||
|
||||
|
||||
private void getExternalStoragePermissions() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
|
||||
return;
|
||||
|
||||
if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
== PackageManager.PERMISSION_GRANTED) {
|
||||
sendPermissionResult(true);
|
||||
return;
|
||||
}
|
||||
|
||||
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, STORAGE_PERMISSION_CODE);
|
||||
}
|
||||
|
||||
private void sendPermissionResult(boolean result) {
|
||||
if (permissionResult == null)
|
||||
return;
|
||||
permissionResult.success(result);
|
||||
permissionResult = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package io.flutter.integration.androidviews;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static android.view.MotionEvent.PointerCoords;
|
||||
import static android.view.MotionEvent.PointerProperties;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
public class MotionEventCodec {
|
||||
public static HashMap<String, Object> encode(MotionEvent event) {
|
||||
ArrayList<HashMap<String,Object>> pointerProperties = new ArrayList<>();
|
||||
ArrayList<HashMap<String,Object>> pointerCoords = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < event.getPointerCount(); i++) {
|
||||
MotionEvent.PointerProperties properties = new MotionEvent.PointerProperties();
|
||||
event.getPointerProperties(i, properties);
|
||||
pointerProperties.add(encodePointerProperties(properties));
|
||||
|
||||
MotionEvent.PointerCoords coords = new MotionEvent.PointerCoords();
|
||||
event.getPointerCoords(i, coords);
|
||||
pointerCoords.add(encodePointerCoords(coords));
|
||||
}
|
||||
|
||||
HashMap<String, Object> eventMap = new HashMap<>();
|
||||
eventMap.put("downTime", event.getDownTime());
|
||||
eventMap.put("eventTime", event.getEventTime());
|
||||
eventMap.put("action", event.getAction());
|
||||
eventMap.put("pointerCount", event.getPointerCount());
|
||||
eventMap.put("pointerProperties", pointerProperties);
|
||||
eventMap.put("pointerCoords", pointerCoords);
|
||||
eventMap.put("metaState", event.getMetaState());
|
||||
eventMap.put("buttonState", event.getButtonState());
|
||||
eventMap.put("xPrecision", event.getXPrecision());
|
||||
eventMap.put("yPrecision", event.getYPrecision());
|
||||
eventMap.put("deviceId", event.getDeviceId());
|
||||
eventMap.put("edgeFlags", event.getEdgeFlags());
|
||||
eventMap.put("source", event.getSource());
|
||||
eventMap.put("flags", event.getFlags());
|
||||
|
||||
return eventMap;
|
||||
}
|
||||
|
||||
private static HashMap<String, Object> encodePointerProperties(PointerProperties properties) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("id", properties.id);
|
||||
map.put("toolType", properties.toolType);
|
||||
return map;
|
||||
}
|
||||
|
||||
private static HashMap<String, Object> encodePointerCoords(PointerCoords coords) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("orientation", coords.orientation);
|
||||
map.put("pressure", coords.pressure);
|
||||
map.put("size", coords.size);
|
||||
map.put("toolMajor", coords.toolMajor);
|
||||
map.put("toolMinor", coords.toolMinor);
|
||||
map.put("touchMajor", coords.touchMajor);
|
||||
map.put("touchMinor", coords.touchMinor);
|
||||
map.put("x", coords.x);
|
||||
map.put("y", coords.y);
|
||||
return map;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static MotionEvent decode(HashMap<String, Object> data) {
|
||||
List<PointerProperties> pointerProperties = new ArrayList<>();
|
||||
List<PointerCoords> pointerCoords = new ArrayList<>();
|
||||
|
||||
for (HashMap<String, Object> property : (List<HashMap<String, Object>>) data.get("pointerProperties")) {
|
||||
pointerProperties.add(decodePointerProperties(property)) ;
|
||||
}
|
||||
|
||||
for (HashMap<String, Object> coord : (List<HashMap<String, Object>>) data.get("pointerCoords")) {
|
||||
pointerCoords.add(decodePointerCoords(coord)) ;
|
||||
}
|
||||
|
||||
return MotionEvent.obtain(
|
||||
(int) data.get("downTime"),
|
||||
(int) data.get("eventTime"),
|
||||
(int) data.get("action"),
|
||||
(int) data.get("pointerCount"),
|
||||
pointerProperties.toArray(new PointerProperties[pointerProperties.size()]),
|
||||
pointerCoords.toArray(new PointerCoords[pointerCoords.size()]),
|
||||
(int) data.get("metaState"),
|
||||
(int) data.get("buttonState"),
|
||||
(float) (double) data.get("xPrecision"),
|
||||
(float) (double) data.get("yPrecision"),
|
||||
(int) data.get("deviceId"),
|
||||
(int) data.get("edgeFlags"),
|
||||
(int) data.get("source"),
|
||||
(int) data.get("flags")
|
||||
);
|
||||
}
|
||||
|
||||
private static PointerProperties decodePointerProperties(HashMap<String, Object> data) {
|
||||
PointerProperties properties = new PointerProperties();
|
||||
properties.id = (int) data.get("id");
|
||||
properties.toolType = (int) data.get("toolType");
|
||||
return properties;
|
||||
}
|
||||
|
||||
private static PointerCoords decodePointerCoords(HashMap<String, Object> data) {
|
||||
PointerCoords coords = new PointerCoords();
|
||||
coords.orientation = (float) (double) data.get("orientation");
|
||||
coords.pressure = (float) (double) data.get("pressure");
|
||||
coords.size = (float) (double) data.get("size");
|
||||
coords.toolMajor = (float) (double) data.get("toolMajor");
|
||||
coords.toolMinor = (float) (double) data.get("toolMinor");
|
||||
coords.touchMajor = (float) (double) data.get("touchMajor");
|
||||
coords.touchMinor = (float) (double) data.get("touchMinor");
|
||||
coords.x = (float) (double) data.get("x");
|
||||
coords.y = (float) (double) data.get("y");
|
||||
return coords;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package io.flutter.integration.androidviews;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.flutter.plugin.platform.PlatformView;
|
||||
|
||||
public class SimplePlatformView implements PlatformView, MethodChannel.MethodCallHandler {
|
||||
private final View mView;
|
||||
private final MethodChannel mMethodChannel;
|
||||
private final TouchPipe mTouchPipe;
|
||||
|
||||
SimplePlatformView(Context context, MethodChannel methodChannel) {
|
||||
mMethodChannel = methodChannel;
|
||||
mView = new View(context) {
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
};
|
||||
mView.setBackgroundColor(0xff0000ff);
|
||||
mMethodChannel.setMethodCallHandler(this);
|
||||
mTouchPipe = new TouchPipe(mMethodChannel, mView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return mView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
|
||||
switch(methodCall.method) {
|
||||
case "pipeTouchEvents":
|
||||
mTouchPipe.enable();
|
||||
result.success(null);
|
||||
return;
|
||||
case "stopTouchEvents":
|
||||
mTouchPipe.disable();
|
||||
result.success(null);
|
||||
return;
|
||||
}
|
||||
result.notImplemented();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package io.flutter.integration.androidviews;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import io.flutter.plugin.common.BinaryMessenger;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.flutter.plugin.platform.PlatformView;
|
||||
import io.flutter.plugin.platform.PlatformViewFactory;
|
||||
|
||||
public class SimpleViewFactory implements PlatformViewFactory {
|
||||
final BinaryMessenger messenger;
|
||||
|
||||
public SimpleViewFactory(BinaryMessenger messenger) {
|
||||
this.messenger = messenger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformView create(Context context, int id) {
|
||||
MethodChannel methodChannel = new MethodChannel(messenger, "simple_view/" + id);
|
||||
return new SimplePlatformView(context, methodChannel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package io.flutter.integration.androidviews;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
class TouchPipe implements View.OnTouchListener {
|
||||
private final MethodChannel mMethodChannel;
|
||||
private final View mView;
|
||||
|
||||
private boolean mEnabled;
|
||||
|
||||
TouchPipe(MethodChannel methodChannel, View view) {
|
||||
mMethodChannel = methodChannel;
|
||||
mView = view;
|
||||
}
|
||||
|
||||
public void enable() {
|
||||
if (mEnabled)
|
||||
return;
|
||||
mEnabled = true;
|
||||
mView.setOnTouchListener(this);
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
if(!mEnabled)
|
||||
return;
|
||||
mEnabled = false;
|
||||
mView.setOnTouchListener(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
mMethodChannel.invokeMethod("onTouch", MotionEventCodec.encode(event));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
29
dev/integration_tests/android_views/android/build.gradle
Normal file
29
dev/integration_tests/android_views/android/build.gradle
Normal file
@@ -0,0 +1,29 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.2'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.buildDir = '../build'
|
||||
subprojects {
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
}
|
||||
subprojects {
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
6
dev/integration_tests/android_views/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
dev/integration_tests/android_views/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#Fri Jun 23 08:50:38 CEST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||
15
dev/integration_tests/android_views/android/settings.gradle
Normal file
15
dev/integration_tests/android_views/android/settings.gradle
Normal file
@@ -0,0 +1,15 @@
|
||||
include ':app'
|
||||
|
||||
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||
|
||||
def plugins = new Properties()
|
||||
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||
if (pluginsFile.exists()) {
|
||||
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
|
||||
}
|
||||
|
||||
plugins.each { name, path ->
|
||||
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||
include ":$name"
|
||||
project(":$name").projectDir = pluginDirectory
|
||||
}
|
||||
45
dev/integration_tests/android_views/ios/.gitignore
vendored
Normal file
45
dev/integration_tests/android_views/ios/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
.idea/
|
||||
.vagrant/
|
||||
.sconsign.dblite
|
||||
.svn/
|
||||
|
||||
.DS_Store
|
||||
*.swp
|
||||
profile
|
||||
|
||||
DerivedData/
|
||||
build/
|
||||
GeneratedPluginRegistrant.h
|
||||
GeneratedPluginRegistrant.m
|
||||
|
||||
.generated/
|
||||
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.perspectivev3
|
||||
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
|
||||
xcuserdata
|
||||
|
||||
*.moved-aside
|
||||
|
||||
*.pyc
|
||||
*sync/
|
||||
Icon?
|
||||
.tags*
|
||||
|
||||
/Flutter/app.flx
|
||||
/Flutter/app.zip
|
||||
/Flutter/flutter_assets/
|
||||
/Flutter/App.framework
|
||||
/Flutter/Flutter.framework
|
||||
/Flutter/Generated.xcconfig
|
||||
/ServiceDefinitions.json
|
||||
|
||||
Pods/
|
||||
.symlinks/
|
||||
@@ -0,0 +1,438 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
|
||||
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
|
||||
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
|
||||
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
|
||||
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
|
||||
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
|
||||
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
|
||||
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
|
||||
3B80C3931E831B6300D905FE /* App.framework */,
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
||||
9740EEBA1CF902C7004384FC /* Flutter.framework */,
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */,
|
||||
);
|
||||
name = Flutter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146E51CF9000F007C117D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146EF1CF9000F007C117D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
|
||||
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||
97C147021CF9000F007C117D /* Info.plist */,
|
||||
97C146F11CF9000F007C117D /* Supporting Files */,
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
|
||||
);
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146F11CF9000F007C117D /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146F21CF9000F007C117D /* main.m */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
97C146ED1CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Runner;
|
||||
productName = Runner;
|
||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0910;
|
||||
ORGANIZATIONNAME = "The Chromium Authors";
|
||||
TargetAttributes = {
|
||||
97C146ED1CF9000F007C117D = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 97C146E51CF9000F007C117D;
|
||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
97C146ED1CF9000F007C117D /* Runner */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
97C146EC1CF9000F007C117D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Thin Binary";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
97C146EA1CF9000F007C117D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
|
||||
97C146F31CF9000F007C117D /* main.m in Sources */,
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C146FB1CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C147001CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
97C147031CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147041CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
97C147061CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = io.flutter.integration.platformViews;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147071CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = io.flutter.integration.platformViews;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147031CF9000F007C117D /* Debug */,
|
||||
97C147041CF9000F007C117D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147061CF9000F007C117D /* Debug */,
|
||||
97C147071CF9000F007C117D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0910"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
298
dev/integration_tests/android_views/lib/main.dart
Normal file
298
dev/integration_tests/android_views/lib/main.dart
Normal file
@@ -0,0 +1,298 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_driver/driver_extension.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
import 'motion_event_diff.dart';
|
||||
|
||||
MethodChannel channel = const MethodChannel('android_views_integration');
|
||||
|
||||
const String kEventsFileName = 'touchEvents';
|
||||
|
||||
/// Wraps a flutter driver [DataHandler] with one that waits until a delegate is set.
|
||||
///
|
||||
/// This allows the driver test to call [FlutterDriver.requestData] before the handler was
|
||||
/// set by the app in which case the requestData call will only complete once the app is ready
|
||||
/// for it.
|
||||
class FutureDataHandler {
|
||||
final Completer<DataHandler> handlerCompleter = new Completer<DataHandler>();
|
||||
|
||||
Future<String> handleMessage(String message) async {
|
||||
final DataHandler handler = await handlerCompleter.future;
|
||||
return handler(message);
|
||||
}
|
||||
}
|
||||
|
||||
FutureDataHandler driverDataHandler = new FutureDataHandler();
|
||||
|
||||
void main() {
|
||||
enableFlutterDriverExtension(handler: driverDataHandler.handleMessage);
|
||||
runApp(new MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new MaterialApp(
|
||||
title: 'Android Views Integration Test',
|
||||
home: new Scaffold(
|
||||
body: new PlatformViewPage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PlatformViewPage extends StatefulWidget {
|
||||
@override
|
||||
State createState() => new PlatformViewState();
|
||||
}
|
||||
|
||||
class PlatformViewState extends State<PlatformViewPage> {
|
||||
static const int kEventsBufferSize = 1000;
|
||||
|
||||
MethodChannel viewChannel;
|
||||
|
||||
/// The list of motion events that were passed to the FlutterView.
|
||||
List<Map<String, dynamic>> flutterViewEvents = <Map<String, dynamic>>[];
|
||||
|
||||
/// The list of motion events that were passed to the embedded view.
|
||||
List<Map<String, dynamic>> embeddedViewEvents = <Map<String, dynamic>>[];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Column(
|
||||
children: <Widget>[
|
||||
new SizedBox(
|
||||
height: 300.0,
|
||||
child: new AndroidView(
|
||||
viewType: 'simple_view',
|
||||
onPlatformViewCreated: onPlatformViewCreated),
|
||||
),
|
||||
new Expanded(
|
||||
child: new ListView.builder(
|
||||
itemBuilder: buildEventTile,
|
||||
itemCount: flutterViewEvents.length,
|
||||
),
|
||||
),
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
child: const Text('RECORD'),
|
||||
onPressed: listenToFlutterViewEvents,
|
||||
),
|
||||
new RaisedButton(
|
||||
child: const Text('CLEAR'),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
flutterViewEvents.clear();
|
||||
embeddedViewEvents.clear();
|
||||
});
|
||||
},
|
||||
),
|
||||
new RaisedButton(
|
||||
child: const Text('SAVE'),
|
||||
onPressed: () {
|
||||
const StandardMessageCodec codec = StandardMessageCodec();
|
||||
saveRecordedEvents(
|
||||
codec.encodeMessage(flutterViewEvents), context);
|
||||
},
|
||||
),
|
||||
new RaisedButton(
|
||||
key: const ValueKey<String>('play'),
|
||||
child: const Text('PLAY FILE'),
|
||||
onPressed: () { playEventsFile(); },
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> playEventsFile() async {
|
||||
const StandardMessageCodec codec = StandardMessageCodec();
|
||||
try {
|
||||
final ByteData data = await rootBundle.load('packages/assets_for_android_views/assets/touchEvents');
|
||||
final List<dynamic> unTypedRecordedEvents = codec.decodeMessage(data);
|
||||
final List<Map<String, dynamic>> recordedEvents = unTypedRecordedEvents
|
||||
.cast<Map<dynamic, dynamic>>()
|
||||
.map((Map<dynamic, dynamic> e) =>e.cast<String, dynamic>())
|
||||
.toList();
|
||||
await channel.invokeMethod('pipeFlutterViewEvents');
|
||||
await viewChannel.invokeMethod('pipeTouchEvents');
|
||||
print('replaying ${recordedEvents.length} motion events');
|
||||
for (Map<String, dynamic> event in recordedEvents.reversed) {
|
||||
await channel.invokeMethod('synthesizeEvent', event);
|
||||
}
|
||||
|
||||
await channel.invokeMethod('stopFlutterViewEvents');
|
||||
await viewChannel.invokeMethod('stopTouchEvents');
|
||||
|
||||
if (flutterViewEvents.length != embeddedViewEvents.length)
|
||||
return 'Synthesized ${flutterViewEvents.length} events but the embedded view received ${embeddedViewEvents.length} events';
|
||||
|
||||
final StringBuffer diff = new StringBuffer();
|
||||
for (int i = 0; i < flutterViewEvents.length; ++i) {
|
||||
final String currentDiff = diffMotionEvents(flutterViewEvents[i], embeddedViewEvents[i]);
|
||||
if (currentDiff.isEmpty)
|
||||
continue;
|
||||
if (diff.isNotEmpty)
|
||||
diff.write(', ');
|
||||
diff.write(currentDiff);
|
||||
}
|
||||
return diff.toString();
|
||||
} catch(e) {
|
||||
return e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
channel.setMethodCallHandler(onMethodChannelCall);
|
||||
}
|
||||
|
||||
Future<void> saveRecordedEvents(ByteData data, BuildContext context) async {
|
||||
if (!await channel.invokeMethod('getStoragePermission')) {
|
||||
showMessage(
|
||||
context, 'External storage permissions are required to save events');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final Directory outDir = await getExternalStorageDirectory();
|
||||
// This test only runs on Android so we can assume path separator is '/'.
|
||||
final File file = new File('${outDir.path}/$kEventsFileName');
|
||||
await file.writeAsBytes(data.buffer.asUint8List(0, data.lengthInBytes), flush: true);
|
||||
showMessage(context, 'Saved original events to ${file.path}');
|
||||
} catch (e) {
|
||||
showMessage(context, 'Failed saving ${e.toString()}');
|
||||
}
|
||||
}
|
||||
|
||||
void showMessage(BuildContext context, String message) {
|
||||
Scaffold.of(context).showSnackBar(new SnackBar(
|
||||
content: new Text(message),
|
||||
duration: const Duration(seconds: 3),
|
||||
));
|
||||
}
|
||||
|
||||
void onPlatformViewCreated(int id) {
|
||||
viewChannel = new MethodChannel('simple_view/$id');
|
||||
viewChannel.setMethodCallHandler(onViewMethodChannelCall);
|
||||
driverDataHandler.handlerCompleter.complete(handleDriverMessage);
|
||||
}
|
||||
|
||||
void listenToFlutterViewEvents() {
|
||||
channel.invokeMethod('pipeFlutterViewEvents');
|
||||
viewChannel.invokeMethod('pipeTouchEvents');
|
||||
new Timer(const Duration(seconds: 3), () {
|
||||
channel.invokeMethod('stopFlutterViewEvents');
|
||||
viewChannel.invokeMethod('stopTouchEvents');
|
||||
});
|
||||
}
|
||||
|
||||
Future<String> handleDriverMessage(String message) async {
|
||||
switch (message) {
|
||||
case 'run test':
|
||||
return playEventsFile();
|
||||
}
|
||||
return 'unknown message: "$message"';
|
||||
}
|
||||
|
||||
Future<dynamic> onMethodChannelCall(MethodCall call) {
|
||||
switch (call.method) {
|
||||
case 'onTouch':
|
||||
final Map<dynamic, dynamic> map = call.arguments;
|
||||
flutterViewEvents.insert(0, map.cast<String, dynamic>());
|
||||
if (flutterViewEvents.length > kEventsBufferSize)
|
||||
flutterViewEvents.removeLast();
|
||||
setState(() {});
|
||||
break;
|
||||
}
|
||||
return new Future<dynamic>.sync(null);
|
||||
}
|
||||
|
||||
Future<dynamic> onViewMethodChannelCall(MethodCall call) {
|
||||
switch (call.method) {
|
||||
case 'onTouch':
|
||||
final Map<dynamic, dynamic> map = call.arguments;
|
||||
embeddedViewEvents.insert(0, map.cast<String, dynamic>());
|
||||
if (embeddedViewEvents.length > kEventsBufferSize)
|
||||
embeddedViewEvents.removeLast();
|
||||
setState(() {});
|
||||
break;
|
||||
}
|
||||
return new Future<dynamic>.sync(null);
|
||||
}
|
||||
|
||||
Widget buildEventTile(BuildContext context, int index) {
|
||||
if (embeddedViewEvents.length > index)
|
||||
return new TouchEventDiff(
|
||||
flutterViewEvents[index], embeddedViewEvents[index]);
|
||||
return new Text(
|
||||
'Unmatched event, action: ${flutterViewEvents[index]['action']}');
|
||||
}
|
||||
}
|
||||
|
||||
class TouchEventDiff extends StatelessWidget {
|
||||
const TouchEventDiff(this.originalEvent, this.synthesizedEvent);
|
||||
|
||||
final Map<String, dynamic> originalEvent;
|
||||
final Map<String, dynamic> synthesizedEvent;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
Color color;
|
||||
final String diff = diffMotionEvents(originalEvent, synthesizedEvent);
|
||||
String msg;
|
||||
final int action = synthesizedEvent['action'];
|
||||
final String actionName = getActionName(getActionMasked(action), action);
|
||||
if (diff.isEmpty) {
|
||||
color = Colors.green;
|
||||
msg = 'Matched event (action $actionName)';
|
||||
} else {
|
||||
color = Colors.red;
|
||||
msg = '[$actionName] $diff';
|
||||
}
|
||||
return new GestureDetector(
|
||||
onLongPress: () {
|
||||
print('expected:');
|
||||
prettyPrintEvent(originalEvent);
|
||||
print('\nactual:');
|
||||
prettyPrintEvent(synthesizedEvent);
|
||||
},
|
||||
child: new Container(
|
||||
color: color,
|
||||
margin: const EdgeInsets.only(bottom: 2.0),
|
||||
child: new Text(msg),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void prettyPrintEvent(Map<String, dynamic> event) {
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
final int action = event['action'];
|
||||
final int maskedAction = getActionMasked(action);
|
||||
final String actionName = getActionName(maskedAction, action);
|
||||
|
||||
buffer.write('$actionName ');
|
||||
if (maskedAction == 5 || maskedAction == 6) {
|
||||
buffer.write('pointer: ${getPointerIdx(action)} ');
|
||||
}
|
||||
|
||||
final List<Map<dynamic, dynamic>> coords = event['pointerCoords'].cast<Map<dynamic, dynamic>>();
|
||||
for (int i = 0; i < coords.length; i++) {
|
||||
buffer.write('p$i x: ${coords[i]['x']} y: ${coords[i]['y']}, pressure: ${coords[i]['pressure']} ');
|
||||
}
|
||||
print(buffer.toString());
|
||||
}
|
||||
}
|
||||
|
||||
191
dev/integration_tests/android_views/lib/motion_event_diff.dart
Normal file
191
dev/integration_tests/android_views/lib/motion_event_diff.dart
Normal file
@@ -0,0 +1,191 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
// Android MotionEvent actions for which a pointer index is encoded in the
|
||||
// unmasked action code.
|
||||
const List<int> kPointerActions = <int>[
|
||||
0, // DOWN
|
||||
1, // UP
|
||||
5, // POINTER_DOWN
|
||||
6 // POINTER_UP
|
||||
];
|
||||
|
||||
const double kDoubleErrorMargin = 0.0001;
|
||||
|
||||
String diffMotionEvents(
|
||||
Map<String, dynamic> originalEvent,
|
||||
Map<String, dynamic> synthesizedEvent,
|
||||
) {
|
||||
final StringBuffer diff = new StringBuffer();
|
||||
|
||||
diffMaps(originalEvent, synthesizedEvent, diff, excludeKeys: const <String>[
|
||||
'pointerProperties', // Compared separately.
|
||||
'pointerCoords', // Compared separately.
|
||||
'source', // Unused by Flutter.
|
||||
'deviceId', // Android documentation says that's an arbitrary number that shouldn't be depended on.
|
||||
'action', // Compared separately.
|
||||
]);
|
||||
|
||||
diffActions(diff, originalEvent, synthesizedEvent);
|
||||
diffPointerProperties(diff, originalEvent, synthesizedEvent);
|
||||
diffPointerCoordsList(diff, originalEvent, synthesizedEvent);
|
||||
|
||||
return diff.toString();
|
||||
}
|
||||
|
||||
void diffActions(StringBuffer diffBuffer, Map<String, dynamic> originalEvent,
|
||||
Map<String, dynamic> synthesizedEvent) {
|
||||
final int synthesizedActionMasked =
|
||||
getActionMasked(synthesizedEvent['action']);
|
||||
final int originalActionMasked = getActionMasked(originalEvent['action']);
|
||||
final String synthesizedActionName =
|
||||
getActionName(synthesizedActionMasked, synthesizedEvent['action']);
|
||||
final String originalActionName =
|
||||
getActionName(originalActionMasked, originalEvent['action']);
|
||||
|
||||
if (synthesizedActionMasked != originalActionMasked)
|
||||
diffBuffer.write(
|
||||
'action (expected: $originalActionName actual: $synthesizedActionName) ');
|
||||
|
||||
if (kPointerActions.contains(originalActionMasked) &&
|
||||
originalActionMasked == synthesizedActionMasked) {
|
||||
final int originalPointer = getPointerIdx(originalEvent['action']);
|
||||
final int synthesizedPointer = getPointerIdx(synthesizedEvent['action']);
|
||||
if (originalPointer != synthesizedPointer)
|
||||
diffBuffer.write(
|
||||
'pointerIdx (expected: $originalPointer actual: $synthesizedPointer action: $originalActionName ');
|
||||
}
|
||||
}
|
||||
|
||||
void diffPointerProperties(StringBuffer diffBuffer,
|
||||
Map<String, dynamic> originalEvent, Map<String, dynamic> synthesizedEvent) {
|
||||
final List<Map<dynamic, dynamic>> expectedList =
|
||||
originalEvent['pointerProperties'].cast<Map<dynamic, dynamic>>();
|
||||
final List<Map<dynamic, dynamic>> actualList =
|
||||
synthesizedEvent['pointerProperties'].cast<Map<dynamic, dynamic>>();
|
||||
|
||||
if (expectedList.length != actualList.length) {
|
||||
diffBuffer.write(
|
||||
'pointerProperties (actual length: ${actualList.length}, expected length: ${expectedList.length} ');
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < expectedList.length; i++) {
|
||||
final Map<String, dynamic> expected =
|
||||
expectedList[i].cast<String, dynamic>();
|
||||
final Map<String, dynamic> actual = actualList[i].cast<String, dynamic>();
|
||||
diffMaps(expected, actual, diffBuffer,
|
||||
messagePrefix: '[pointerProperty $i] ');
|
||||
}
|
||||
}
|
||||
|
||||
void diffPointerCoordsList(StringBuffer diffBuffer,
|
||||
Map<String, dynamic> originalEvent, Map<String, dynamic> synthesizedEvent) {
|
||||
final List<Map<dynamic, dynamic>> expectedList =
|
||||
originalEvent['pointerCoords'].cast<Map<dynamic, dynamic>>();
|
||||
final List<Map<dynamic, dynamic>> actualList =
|
||||
synthesizedEvent['pointerCoords'].cast<Map<dynamic, dynamic>>();
|
||||
|
||||
if (expectedList.length != actualList.length) {
|
||||
diffBuffer.write(
|
||||
'pointerCoords (actual length: ${actualList.length}, expected length: ${expectedList.length} ');
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSinglePointerAction(originalEvent['action'])) {
|
||||
final int idx = getPointerIdx(originalEvent['action']);
|
||||
final Map<String, dynamic> expected =
|
||||
expectedList[idx].cast<String, dynamic>();
|
||||
final Map<String, dynamic> actual = actualList[idx].cast<String, dynamic>();
|
||||
diffPointerCoords(expected, actual, idx, diffBuffer);
|
||||
// For POINTER_UP and POINTER_DOWN events the engine drops the data for all pointers
|
||||
// but for the pointer that was taken up/down.
|
||||
// See: https://github.com/flutter/flutter/issues/19882
|
||||
//
|
||||
// Until that issue is resolved, we only compare the pointer for which the action
|
||||
// applies to here.
|
||||
//
|
||||
// TODO(amirh): Compare all pointers once the issue mentioned above is resolved.
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < expectedList.length; i++) {
|
||||
final Map<String, dynamic> expected =
|
||||
expectedList[i].cast<String, dynamic>();
|
||||
final Map<String, dynamic> actual = actualList[i].cast<String, dynamic>();
|
||||
diffPointerCoords(expected, actual, i, diffBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
void diffPointerCoords(Map<String, dynamic> expected,
|
||||
Map<String, dynamic> actual, int pointerIdx, StringBuffer diffBuffer) {
|
||||
diffMaps(expected, actual, diffBuffer,
|
||||
messagePrefix: '[pointerCoord $pointerIdx] ',
|
||||
excludeKeys: <String>[
|
||||
'size', // Currently the framework doesn't get the size from the engine.
|
||||
]);
|
||||
}
|
||||
|
||||
void diffMaps(
|
||||
Map<String, dynamic> expected,
|
||||
Map<String, dynamic> actual,
|
||||
StringBuffer diffBuffer, {
|
||||
List<String> excludeKeys = const <String>[],
|
||||
String messagePrefix = '',
|
||||
}) {
|
||||
const IterableEquality<String> eq = IterableEquality<String>();
|
||||
if (!eq.equals(expected.keys, actual.keys)) {
|
||||
diffBuffer.write(
|
||||
'${messagePrefix}keys (expected: ${expected.keys} actual: ${actual.keys} ');
|
||||
return;
|
||||
}
|
||||
for (String key in expected.keys) {
|
||||
if (excludeKeys.contains(key))
|
||||
continue;
|
||||
if (doublesApproximatelyMatch(expected[key], actual[key]))
|
||||
continue;
|
||||
|
||||
if (expected[key] != actual[key]) {
|
||||
diffBuffer.write(
|
||||
'$messagePrefix$key (expected: ${expected[key]} actual: ${actual[key]}) ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isSinglePointerAction(int action) {
|
||||
final int actionMasked = getActionMasked(action);
|
||||
return actionMasked == 5 || // POINTER_DOWN
|
||||
actionMasked == 6; // POINTER_UP
|
||||
}
|
||||
|
||||
int getActionMasked(int action) => action & 0xff;
|
||||
|
||||
int getPointerIdx(int action) => (action >> 8) & 0xff;
|
||||
|
||||
String getActionName(int actionMasked, int action) {
|
||||
const List<String> actionNames = <String>[
|
||||
'DOWN',
|
||||
'UP',
|
||||
'MOVE',
|
||||
'CANCEL',
|
||||
'OUTSIDE',
|
||||
'POINTER_DOWN',
|
||||
'POINTER_UP',
|
||||
'HOVER_MOVE',
|
||||
'SCROLL',
|
||||
'HOVER_ENTER',
|
||||
'HOVER_EXIT',
|
||||
'BUTTON_PRESS',
|
||||
'BUTTON_RELEASE'
|
||||
];
|
||||
if (actionMasked < actionNames.length)
|
||||
return '${actionNames[actionMasked]}($action)';
|
||||
else
|
||||
return 'ACTION_$actionMasked';
|
||||
}
|
||||
|
||||
bool doublesApproximatelyMatch(dynamic a, dynamic b) =>
|
||||
a is double && b is double && (a - b).abs() < kDoubleErrorMargin;
|
||||
22
dev/integration_tests/android_views/pubspec.yaml
Normal file
22
dev/integration_tests/android_views/pubspec.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
name: android_views
|
||||
description: An integration test for embedded Android views
|
||||
version: 1.0.0+1
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_driver:
|
||||
sdk: flutter
|
||||
path_provider: ^0.4.1
|
||||
collection: ^1.14.6
|
||||
assets_for_android_views:
|
||||
path: ../../../bin/cache/pkg/goldens/dev/integration_tests/assets_for_android_views
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_goldens:
|
||||
sdk: flutter
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:flutter_goldens_client/client.dart';
|
||||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
Future<void> main() async {
|
||||
|
||||
setUpAll(() async {
|
||||
print('Cloning goldens repository...');
|
||||
final GoldensClient goldensClient = new GoldensClient();
|
||||
await goldensClient.prepare();
|
||||
});
|
||||
|
||||
test('MotionEvents recomposition', () async {
|
||||
final FlutterDriver driver = await FlutterDriver.connect();
|
||||
final String errorMessage = await driver.requestData('run test');
|
||||
|
||||
expect(errorMessage, '');
|
||||
driver?.close();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user