From 2d437f51c31bf4c8b62621dc902dee0a10d723fb Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 11 May 2017 14:29:20 -0700 Subject: [PATCH] Add end-to-end test to verify resize on keyboard dismissal (#10005) Adds an initial integration test that: 1. captures laid-out widget size 2. focuses a text field to show the keyboard and resize the view 3. unfocuses the text field to dismiss the keyboard and resize the view 4. verify that the final widget size matches the initial size --- dev/devicelab/bin/tasks/integration_ui.dart | 15 + .../bin/tasks/integration_ui_ios.dart | 15 + dev/devicelab/lib/tasks/integration_ui.dart | 31 ++ dev/devicelab/manifest.yaml | 14 + dev/integration_tests/ui/.gitignore | 10 + dev/integration_tests/ui/README.md | 7 + dev/integration_tests/ui/android/.gitignore | 12 + .../ui/android/app/build.gradle | 46 ++ .../android/app/src/main/AndroidManifest.xml | 36 ++ .../integration_ui/MainActivity.java | 20 + .../io/flutter/plugins/PluginRegistry.java | 14 + dev/integration_tests/ui/android/build.gradle | 29 ++ .../ui/android/gradle.properties | 1 + .../ui/android/settings.gradle | 15 + dev/integration_tests/ui/ios/.gitignore | 37 ++ .../ui/ios/Flutter/AppFrameworkInfo.plist | 30 ++ .../ui/ios/Flutter/Debug.xcconfig | 1 + .../ui/ios/Flutter/Release.xcconfig | 1 + .../ui/ios/Runner.xcodeproj/project.pbxproj | 427 ++++++++++++++++++ .../contents.xcworkspacedata | 10 + .../xcshareddata/xcschemes/Runner.xcscheme | 91 ++++ .../contents.xcworkspacedata | 7 + .../ui/ios/Runner/AppDelegate.h | 10 + .../ui/ios/Runner/AppDelegate.m | 19 + .../Runner/Base.lproj/LaunchScreen.storyboard | 27 ++ .../ui/ios/Runner/Base.lproj/Main.storyboard | 26 ++ .../ui/ios/Runner/Info.plist | 49 ++ .../ui/ios/Runner/PluginRegistry.h | 18 + .../ui/ios/Runner/PluginRegistry.m | 15 + dev/integration_tests/ui/ios/Runner/main.m | 14 + .../ui/lib/keyboard_resize.dart | 62 +++ dev/integration_tests/ui/lib/keys.dart | 7 + dev/integration_tests/ui/pubspec.yaml | 14 + .../ui/test_driver/keyboard_resize_test.dart | 45 ++ 34 files changed, 1175 insertions(+) create mode 100644 dev/devicelab/bin/tasks/integration_ui.dart create mode 100644 dev/devicelab/bin/tasks/integration_ui_ios.dart create mode 100644 dev/devicelab/lib/tasks/integration_ui.dart create mode 100644 dev/integration_tests/ui/.gitignore create mode 100644 dev/integration_tests/ui/README.md create mode 100644 dev/integration_tests/ui/android/.gitignore create mode 100644 dev/integration_tests/ui/android/app/build.gradle create mode 100644 dev/integration_tests/ui/android/app/src/main/AndroidManifest.xml create mode 100644 dev/integration_tests/ui/android/app/src/main/java/com/yourcompany/integration_ui/MainActivity.java create mode 100644 dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java create mode 100644 dev/integration_tests/ui/android/build.gradle create mode 100644 dev/integration_tests/ui/android/gradle.properties create mode 100644 dev/integration_tests/ui/android/settings.gradle create mode 100644 dev/integration_tests/ui/ios/.gitignore create mode 100644 dev/integration_tests/ui/ios/Flutter/AppFrameworkInfo.plist create mode 100644 dev/integration_tests/ui/ios/Flutter/Debug.xcconfig create mode 100644 dev/integration_tests/ui/ios/Flutter/Release.xcconfig create mode 100644 dev/integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj create mode 100644 dev/integration_tests/ui/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 dev/integration_tests/ui/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme create mode 100644 dev/integration_tests/ui/ios/Runner.xcworkspace/contents.xcworkspacedata create mode 100644 dev/integration_tests/ui/ios/Runner/AppDelegate.h create mode 100644 dev/integration_tests/ui/ios/Runner/AppDelegate.m create mode 100644 dev/integration_tests/ui/ios/Runner/Base.lproj/LaunchScreen.storyboard create mode 100644 dev/integration_tests/ui/ios/Runner/Base.lproj/Main.storyboard create mode 100644 dev/integration_tests/ui/ios/Runner/Info.plist create mode 100644 dev/integration_tests/ui/ios/Runner/PluginRegistry.h create mode 100644 dev/integration_tests/ui/ios/Runner/PluginRegistry.m create mode 100644 dev/integration_tests/ui/ios/Runner/main.m create mode 100644 dev/integration_tests/ui/lib/keyboard_resize.dart create mode 100644 dev/integration_tests/ui/lib/keys.dart create mode 100644 dev/integration_tests/ui/pubspec.yaml create mode 100644 dev/integration_tests/ui/test_driver/keyboard_resize_test.dart diff --git a/dev/devicelab/bin/tasks/integration_ui.dart b/dev/devicelab/bin/tasks/integration_ui.dart new file mode 100644 index 0000000000..58cfb64e70 --- /dev/null +++ b/dev/devicelab/bin/tasks/integration_ui.dart @@ -0,0 +1,15 @@ +// Copyright 2017 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_devicelab/tasks/integration_ui.dart'; +import 'package:flutter_devicelab/framework/adb.dart'; +import 'package:flutter_devicelab/framework/framework.dart'; + +/// End to end tests for Android. +Future main() async { + deviceOperatingSystem = DeviceOperatingSystem.android; + await task(runEndToEndTests); +} diff --git a/dev/devicelab/bin/tasks/integration_ui_ios.dart b/dev/devicelab/bin/tasks/integration_ui_ios.dart new file mode 100644 index 0000000000..0be5f2b8ff --- /dev/null +++ b/dev/devicelab/bin/tasks/integration_ui_ios.dart @@ -0,0 +1,15 @@ +// Copyright 2017 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_devicelab/tasks/integration_ui.dart'; +import 'package:flutter_devicelab/framework/adb.dart'; +import 'package:flutter_devicelab/framework/framework.dart'; + +/// End to end tests for iOS. +Future main() async { + deviceOperatingSystem = DeviceOperatingSystem.ios; + await task(runEndToEndTests); +} diff --git a/dev/devicelab/lib/tasks/integration_ui.dart b/dev/devicelab/lib/tasks/integration_ui.dart new file mode 100644 index 0000000000..74af11f264 --- /dev/null +++ b/dev/devicelab/lib/tasks/integration_ui.dart @@ -0,0 +1,31 @@ +// Copyright 2017 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 '../framework/adb.dart'; +import '../framework/framework.dart'; +import '../framework/ios.dart'; +import '../framework/utils.dart'; + +Future runEndToEndTests() async { + final Device device = await devices.workingDevice; + await device.unlock(); + final String deviceId = device.deviceId; + final Directory testDirectory = dir('${flutterDirectory.path}/dev/integration_tests/ui'); + await inDirectory(testDirectory, () async { + await flutter('packages', options: ['get']); + + if (deviceOperatingSystem == DeviceOperatingSystem.ios) { + await prepareProvisioningCertificates(testDirectory.path); + // This causes an Xcode project to be created. + await flutter('build', options: ['ios']); + } + + await flutter('drive', options: ['-d', deviceId, 'lib/keyboard_resize.dart']); + }); + + return new TaskResult.success({}); +} diff --git a/dev/devicelab/manifest.yaml b/dev/devicelab/manifest.yaml index 5cb7ce9491..04728586a6 100644 --- a/dev/devicelab/manifest.yaml +++ b/dev/devicelab/manifest.yaml @@ -158,6 +158,13 @@ tasks: stage: devicelab required_agent_capabilities: ["has-android-device"] + integration_ui: + description: > + Runs end-to-end Flutter tests on Android. + stage: devicelab + required_agent_capabilities: ["has-android-device"] + flaky: true + # iOS on-device tests channels_integration_test_ios: @@ -221,6 +228,13 @@ tasks: # required_agent_capabilities: ["has-ios-device"] # flaky: true + integration_ui_ios: + description: > + Runs end-to-end Flutter tests on iOS. + stage: devicelab_ios + required_agent_capabilities: ["has-ios-device"] + flaky: true + # Tests running on Windows host channels_integration_test_win: diff --git a/dev/integration_tests/ui/.gitignore b/dev/integration_tests/ui/.gitignore new file mode 100644 index 0000000000..eb15c3d27c --- /dev/null +++ b/dev/integration_tests/ui/.gitignore @@ -0,0 +1,10 @@ +.DS_Store +.atom/ +.idea +.packages +.pub/ +build/ +ios/.generated/ +packages +pubspec.lock +.flutter-plugins diff --git a/dev/integration_tests/ui/README.md b/dev/integration_tests/ui/README.md new file mode 100644 index 0000000000..ff91ce7c10 --- /dev/null +++ b/dev/integration_tests/ui/README.md @@ -0,0 +1,7 @@ +# Flutter UI integration tests + +This project contains a collection of non-plugin-dependent UI integration tests. + +## keyboard\_resize + +Verifies that showing and hiding the keyboard resizes the content. diff --git a/dev/integration_tests/ui/android/.gitignore b/dev/integration_tests/ui/android/.gitignore new file mode 100644 index 0000000000..5c4ef82869 --- /dev/null +++ b/dev/integration_tests/ui/android/.gitignore @@ -0,0 +1,12 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures + +/gradle +/gradlew +/gradlew.bat diff --git a/dev/integration_tests/ui/android/app/build.gradle b/dev/integration_tests/ui/android/app/build.gradle new file mode 100644 index 0000000000..4e2e46b56c --- /dev/null +++ b/dev/integration_tests/ui/android/app/build.gradle @@ -0,0 +1,46 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withInputStream { stream -> + localProperties.load(stream) + } +} + +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.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + 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 { + androidTestCompile 'com.android.support:support-annotations:25.0.0' + androidTestCompile 'com.android.support.test:runner:0.5' + androidTestCompile 'com.android.support.test:rules:0.5' +} diff --git a/dev/integration_tests/ui/android/app/src/main/AndroidManifest.xml b/dev/integration_tests/ui/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..ff95aa5b55 --- /dev/null +++ b/dev/integration_tests/ui/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + diff --git a/dev/integration_tests/ui/android/app/src/main/java/com/yourcompany/integration_ui/MainActivity.java b/dev/integration_tests/ui/android/app/src/main/java/com/yourcompany/integration_ui/MainActivity.java new file mode 100644 index 0000000000..96e27d2b7a --- /dev/null +++ b/dev/integration_tests/ui/android/app/src/main/java/com/yourcompany/integration_ui/MainActivity.java @@ -0,0 +1,20 @@ +// Copyright 2017 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 com.yourcompany.integration_ui; + +import android.os.Bundle; +import io.flutter.app.FlutterActivity; +import io.flutter.plugins.PluginRegistry; + +public class MainActivity extends FlutterActivity { + PluginRegistry pluginRegistry; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + pluginRegistry = new PluginRegistry(); + pluginRegistry.registerAll(this); + } +} diff --git a/dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java b/dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java new file mode 100644 index 0000000000..92f7a749c4 --- /dev/null +++ b/dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java @@ -0,0 +1,14 @@ +package io.flutter.plugins; + +import io.flutter.app.FlutterActivity; + + +/** + * Generated file. Do not edit. + */ + +public class PluginRegistry { + + public void registerAll(FlutterActivity activity) { + } +} diff --git a/dev/integration_tests/ui/android/build.gradle b/dev/integration_tests/ui/android/build.gradle new file mode 100644 index 0000000000..ee5325df80 --- /dev/null +++ b/dev/integration_tests/ui/android/build.gradle @@ -0,0 +1,29 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:2.2.3' + } +} + +allprojects { + repositories { + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14.1' +} diff --git a/dev/integration_tests/ui/android/gradle.properties b/dev/integration_tests/ui/android/gradle.properties new file mode 100644 index 0000000000..8bd86f6805 --- /dev/null +++ b/dev/integration_tests/ui/android/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/dev/integration_tests/ui/android/settings.gradle b/dev/integration_tests/ui/android/settings.gradle new file mode 100644 index 0000000000..115da6cb4f --- /dev/null +++ b/dev/integration_tests/ui/android/settings.gradle @@ -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.withInputStream { stream -> plugins.load(stream) } +} + +plugins.each { name, path -> + def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() + include ":$name" + project(":$name").projectDir = pluginDirectory +} diff --git a/dev/integration_tests/ui/ios/.gitignore b/dev/integration_tests/ui/ios/.gitignore new file mode 100644 index 0000000000..d0a7d98562 --- /dev/null +++ b/dev/integration_tests/ui/ios/.gitignore @@ -0,0 +1,37 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ + +*.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/App.framework +/Flutter/Flutter.framework +/Flutter/Generated.xcconfig +/ServiceDefinitions.json diff --git a/dev/integration_tests/ui/ios/Flutter/AppFrameworkInfo.plist b/dev/integration_tests/ui/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000000..6c2de8086b --- /dev/null +++ b/dev/integration_tests/ui/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + UIRequiredDeviceCapabilities + + arm64 + + MinimumOSVersion + 8.0 + + diff --git a/dev/integration_tests/ui/ios/Flutter/Debug.xcconfig b/dev/integration_tests/ui/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000000..592ceee85b --- /dev/null +++ b/dev/integration_tests/ui/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/dev/integration_tests/ui/ios/Flutter/Release.xcconfig b/dev/integration_tests/ui/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000000..592ceee85b --- /dev/null +++ b/dev/integration_tests/ui/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/dev/integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj b/dev/integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..0b4c7bcefc --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,427 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* PluginRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* PluginRegistry.m */; }; + 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 */; }; + 9740EEBB1CF902C7004384FC /* app.flx in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB71CF902C7004384FC /* app.flx */; }; + 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 */; }; + 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 /* PluginRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PluginRegistry.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* PluginRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginRegistry.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 9740EEB71CF902C7004384FC /* app.flx */ = {isa = PBXFileReference; lastKnownFileType = file; name = app.flx; path = Flutter/app.flx; sourceTree = ""; }; + 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; + 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 = ""; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* 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 = ( + 9740EEB71CF902C7004384FC /* app.flx */, + 3B80C3931E831B6300D905FE /* App.framework */, + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEBA1CF902C7004384FC /* Flutter.framework */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, + 1498D2321E8E86230040F4C2 /* PluginRegistry.h */, + 1498D2331E8E89220040F4C2 /* PluginRegistry.m */, + ); + path = Runner; + sourceTree = ""; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 97C146F21CF9000F007C117D /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + CF3B75C9A7D2FA2A4C99F110 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* 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 = 0830; + 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 = ( + 9740EEBB1CF902C7004384FC /* app.flx in Resources */, + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 9740EEB41CF90195004384FC /* Debug.xcconfig 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 /* PluginRegistry.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* 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_BOOL_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR; + 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_BOOL_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR; + 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 = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + 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.e2e; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + 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.e2e; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + 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 */; +} diff --git a/dev/integration_tests/ui/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/dev/integration_tests/ui/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..21a3cc14c7 --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/dev/integration_tests/ui/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/dev/integration_tests/ui/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000000..1c95807881 --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/integration_tests/ui/ios/Runner.xcworkspace/contents.xcworkspacedata b/dev/integration_tests/ui/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..1d526a16ed --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/dev/integration_tests/ui/ios/Runner/AppDelegate.h b/dev/integration_tests/ui/ios/Runner/AppDelegate.h new file mode 100644 index 0000000000..138b680780 --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner/AppDelegate.h @@ -0,0 +1,10 @@ +// Copyright 2017 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 +#import + +@interface AppDelegate : FlutterAppDelegate + +@end diff --git a/dev/integration_tests/ui/ios/Runner/AppDelegate.m b/dev/integration_tests/ui/ios/Runner/AppDelegate.m new file mode 100644 index 0000000000..32e67603ce --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner/AppDelegate.m @@ -0,0 +1,19 @@ +// Copyright 2017 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. + +#include "AppDelegate.h" +#include "PluginRegistry.h" + +@implementation AppDelegate { + PluginRegistry *plugins; +} + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + FlutterViewController *flutterController = + (FlutterViewController *)self.window.rootViewController; + plugins = [[PluginRegistry alloc] initWithController:flutterController]; + return YES; +} + +@end diff --git a/dev/integration_tests/ui/ios/Runner/Base.lproj/LaunchScreen.storyboard b/dev/integration_tests/ui/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000000..ebf48f6039 --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/integration_tests/ui/ios/Runner/Base.lproj/Main.storyboard b/dev/integration_tests/ui/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000000..f3c28516fb --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/integration_tests/ui/ios/Runner/Info.plist b/dev/integration_tests/ui/ios/Runner/Info.plist new file mode 100644 index 0000000000..15b52b05e5 --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + IntegrationUI + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/dev/integration_tests/ui/ios/Runner/PluginRegistry.h b/dev/integration_tests/ui/ios/Runner/PluginRegistry.h new file mode 100644 index 0000000000..df039db515 --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner/PluginRegistry.h @@ -0,0 +1,18 @@ +// +// Generated file. Do not edit. +// + +#ifndef PluginRegistry_h +#define PluginRegistry_h + +#import + + +@interface PluginRegistry : NSObject + + +- (instancetype)initWithController:(FlutterViewController *)controller; + +@end + +#endif /* PluginRegistry_h */ diff --git a/dev/integration_tests/ui/ios/Runner/PluginRegistry.m b/dev/integration_tests/ui/ios/Runner/PluginRegistry.m new file mode 100644 index 0000000000..0a34729946 --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner/PluginRegistry.m @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +#import "PluginRegistry.h" + +@implementation PluginRegistry + +- (instancetype)initWithController:(FlutterViewController *)controller { + if (self = [super init]) { + } + return self; +} + +@end diff --git a/dev/integration_tests/ui/ios/Runner/main.m b/dev/integration_tests/ui/ios/Runner/main.m new file mode 100644 index 0000000000..945818bd51 --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner/main.m @@ -0,0 +1,14 @@ +// Copyright 2017 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 +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, + NSStringFromClass([AppDelegate class])); + } +} diff --git a/dev/integration_tests/ui/lib/keyboard_resize.dart b/dev/integration_tests/ui/lib/keyboard_resize.dart new file mode 100644 index 0000000000..46aee05550 --- /dev/null +++ b/dev/integration_tests/ui/lib/keyboard_resize.dart @@ -0,0 +1,62 @@ +// Copyright 2017 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:flutter/material.dart'; +import 'package:flutter_driver/driver_extension.dart'; + +import 'keys.dart' as keys; + +void main() { + enableFlutterDriverExtension(); + runApp(new MyApp()); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return new MaterialApp( + title: 'Text Editing', + theme: new ThemeData(primarySwatch: Colors.blue), + home: new MyHomePage(), + ); + } +} + +class MyHomePage extends StatefulWidget { + @override + _MyHomePageState createState() => new _MyHomePageState(); +} + +class _MyHomePageState extends State { + TextEditingController _controller = new TextEditingController(); + + @override + Widget build(BuildContext context) { + final TextField textField = new TextField( + key: const Key(keys.kDefaultTextField), + controller: _controller, + focusNode: new FocusNode(), + ); + return new Scaffold( + body: new Stack( + fit: StackFit.expand, + alignment: FractionalOffset.bottomCenter, + children: [ + new LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + return new Center(child: new Text('${constraints.biggest.height}', key: const Key(keys.kHeightText))); + } + ), + textField, + ], + ), + floatingActionButton: new FloatingActionButton( + key: const Key(keys.kUnfocusButton), + onPressed: () { textField.focusNode.unfocus(); }, + tooltip: 'Unfocus', + child: new Icon(Icons.done), + ), + ); + } +} diff --git a/dev/integration_tests/ui/lib/keys.dart b/dev/integration_tests/ui/lib/keys.dart new file mode 100644 index 0000000000..ebd7ba0630 --- /dev/null +++ b/dev/integration_tests/ui/lib/keys.dart @@ -0,0 +1,7 @@ +// Copyright 2017 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. + +const String kDefaultTextField = 'default_textfield'; +const String kHeightText = 'height_text'; +const String kUnfocusButton = 'unfocus_button'; diff --git a/dev/integration_tests/ui/pubspec.yaml b/dev/integration_tests/ui/pubspec.yaml new file mode 100644 index 0000000000..45a58cb415 --- /dev/null +++ b/dev/integration_tests/ui/pubspec.yaml @@ -0,0 +1,14 @@ +name: integration_ui +description: Flutter non-plugin UI integration tests. + +dependencies: + flutter: + sdk: flutter + flutter_driver: + sdk: flutter +dev_dependencies: + flutter_test: + sdk: flutter + test: any +flutter: + uses-material-design: true diff --git a/dev/integration_tests/ui/test_driver/keyboard_resize_test.dart b/dev/integration_tests/ui/test_driver/keyboard_resize_test.dart new file mode 100644 index 0000000000..66ab03082b --- /dev/null +++ b/dev/integration_tests/ui/test_driver/keyboard_resize_test.dart @@ -0,0 +1,45 @@ +import 'dart:async'; + +import 'package:integration_ui/keys.dart' as keys; +import 'package:flutter_driver/flutter_driver.dart'; +import 'package:test/test.dart'; + +void main() { + group('end-to-end test', () { + FlutterDriver driver; + + setUpAll(() async { + driver = await FlutterDriver.connect(); + }); + + tearDownAll(() async { + if (driver != null) + driver.close(); + }); + + test('Ensure keyboard dismissal resizes the view to original size', () async { + final SerializableFinder heightText = find.byValueKey(keys.kHeightText); + await driver.waitFor(heightText); + + // Measure the initial height. + final String startHeight = await driver.getText(heightText); + + // Focus the text field to show the keyboard. + final SerializableFinder defaultTextField = find.byValueKey(keys.kDefaultTextField); + await driver.waitFor(defaultTextField); + await driver.tap(defaultTextField); + await new Future.delayed(const Duration(seconds: 1)); + + // Unfocus the text field to dismiss the keyboard. + final SerializableFinder unfocusButton = find.byValueKey(keys.kUnfocusButton); + await driver.waitFor(unfocusButton); + await driver.tap(unfocusButton); + await new Future.delayed(const Duration(seconds: 1)); + + // Measure the final height. + final String endHeight = await driver.getText(heightText); + + expect(endHeight, startHeight); + }); + }); +}