Unverified Commit a195bcc0 authored by Abhishek Ghaskata's avatar Abhishek Ghaskata Committed by GitHub

Migrate dev/integration_tests/ui to null safety (#80624)

parent 0379dcd0
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
......@@ -11,14 +11,14 @@ void main() {
}
class Test extends SingleChildRenderObjectWidget {
const Test({ Key key }) : super(key: key);
const Test({ Key? key }) : super(key: key);
@override
RenderTest createRenderObject(BuildContext context) => RenderTest();
}
class RenderTest extends RenderProxyBox {
RenderTest({ RenderBox child }) : super(child);
RenderTest({ RenderBox? child }) : super(child);
@override
void debugPaintSize(PaintingContext context, Offset offset) {
......
......@@ -11,7 +11,7 @@ void main() {
}
class DriverTestApp extends StatefulWidget {
const DriverTestApp({Key key}) : super(key: key);
const DriverTestApp({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() {
......@@ -59,9 +59,9 @@ class DriverTestAppState extends State<DriverTestApp> {
DropdownButton<Letter>(
key: const ValueKey<String>('dropdown'),
value: _selectedValue,
onChanged: (Letter newValue) {
onChanged: (Letter? newValue) {
setState(() {
_selectedValue = newValue;
_selectedValue = newValue!;
});
},
items: const <DropdownMenuItem<Letter>>[
......
......@@ -12,7 +12,7 @@ void main() {
}
class Empty extends StatelessWidget {
const Empty({Key key}) : super(key: key);
const Empty({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => Container();
......
......@@ -8,7 +8,7 @@ import 'package:flutter_driver/driver_extension.dart';
import 'keys.dart' as keys;
void main() {
enableFlutterDriverExtension(handler: (String message) async {
enableFlutterDriverExtension(handler: (String? message) async {
// TODO(cbernaschina): remove when test flakiness is resolved
return 'keyboard_resize';
});
......@@ -16,7 +16,7 @@ void main() {
}
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
......@@ -29,7 +29,7 @@ class MyApp extends StatelessWidget {
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key key}) : super(key: key);
const MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
......@@ -60,7 +60,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
floatingActionButton: FloatingActionButton(
key: const Key(keys.kUnfocusButton),
onPressed: () { textField.focusNode.unfocus(); },
onPressed: () { textField.focusNode!.unfocus(); },
tooltip: 'Unfocus',
child: const Icon(Icons.done),
),
......
......@@ -14,7 +14,7 @@ void main() {
}
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
......@@ -27,7 +27,7 @@ class MyApp extends StatelessWidget {
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key key}) : super(key: key);
const MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
......
......@@ -14,13 +14,13 @@ void main() {
}
class ShowLicenses extends StatelessWidget {
const ShowLicenses({Key key}) : super(key: key);
const ShowLicenses({Key? key}) : super(key: key);
Widget _buildTestResultWidget(
BuildContext context,
AsyncSnapshot<List<LicenseEntry>> snapshot,
) {
final List<LicenseEntry> entries = snapshot.data;
final List<LicenseEntry> entries = snapshot.data ?? <LicenseEntry>[];
String flutterPackage = '';
final List<String> flutterParagraphs = <String>[];
String enginePackage = '';
......@@ -41,7 +41,6 @@ class ShowLicenses extends StatelessWidget {
}
final List<Widget> result = <Widget>[];
if (entries.isNotEmpty) {
result.addAll(<Widget>[
const Text('License Check Test', key: ValueKey<String>('Header')),
Text(flutterPackage, key: const ValueKey<String>('FlutterPackage')),
......@@ -51,7 +50,6 @@ class ShowLicenses extends StatelessWidget {
Text(engineParagraphs.join(' '), key: const ValueKey<String>('EngineLicense')),
Text('${engineParagraphs.length}', key: const ValueKey<String>('EngineCount')),
]);
}
return ListView(
children: result,
......
......@@ -18,9 +18,9 @@ void main() {
textDirection: TextDirection.ltr,
),
onPressed: () {
Navigator.push<Object>(
Navigator.push<Object?>(
context,
MaterialPageRoute<dynamic>(
MaterialPageRoute<Object?>(
builder: (BuildContext context) {
return const Material(
child: Center(
......
......@@ -9,7 +9,7 @@ void main() {
}
class Test extends StatefulWidget {
const Test({ Key key }) : super(key: key);
const Test({ Key? key }) : super(key: key);
@override
State<Test> createState() => _TestState();
......
......@@ -9,7 +9,7 @@ import 'package:flutter_driver/driver_extension.dart';
// To use this test: "flutter drive --route '/smuggle-it' lib/route.dart"
void main() {
enableFlutterDriverExtension(handler: (String message) async {
enableFlutterDriverExtension(handler: (String? message) async {
return ui.window.defaultRouteName;
});
}
......@@ -16,7 +16,7 @@ void main() {
}
class Toggler extends StatefulWidget {
const Toggler({Key key}) : super(key: key);
const Toggler({Key? key}) : super(key: key);
@override
State<Toggler> createState() => TogglerState();
......
......@@ -2,7 +2,7 @@ name: integration_ui
description: Flutter non-plugin UI integration tests.
environment:
sdk: ">=2.8.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"
# The "image" dependency below seems to only be needed for test_driver/screenshot_test.dart
# It can probably be removed, see the comment in that file.
......
......@@ -6,14 +6,14 @@ import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
await driver?.close();
await driver.close();
});
test('check that we are painting in debugPaintSize mode', () async {
......
......@@ -6,14 +6,14 @@ import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
await driver?.close();
await driver.close();
});
test('check that we are in normal mode', () async {
......
......@@ -6,14 +6,14 @@ import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
await driver?.close();
await driver.close();
});
test('check that we are showing the performance overlay', () async {
......
......@@ -6,7 +6,7 @@ import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
......
......@@ -11,7 +11,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('FlutterDriver', () {
final SerializableFinder presentText = find.text('present');
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
......
......@@ -8,7 +8,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
// Connect and disconnect from the empty app.
void main() {
group('FlutterDriver', () {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
......
......@@ -8,14 +8,14 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('end-to-end test', () {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
await driver?.close();
await driver.close();
});
test('Ensure keyboard dismissal resizes the view to original size', () async {
......
......@@ -8,14 +8,14 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('end-to-end test', () {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
await driver?.close();
await driver.close();
});
test('Textfield scrolls back into view after covered by keyboard', () async {
......
......@@ -20,7 +20,7 @@ void main() {
final String license = licenseFile.readAsStringSync().split(newlineSplit).join(' ').trim();
group('License file check', () {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
......@@ -28,9 +28,7 @@ void main() {
});
tearDownAll(() async {
if (driver != null) {
await driver.close();
}
});
test('flutter license', () async {
......
......@@ -8,14 +8,14 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('flutter run test --route', () {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
await driver?.close();
await driver.close();
});
test('sanity check flutter drive --route', () async {
......
......@@ -15,7 +15,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('FlutterDriver', () {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
......@@ -32,18 +32,18 @@ void main() {
await driver.waitFor(toggleBtn);
bool cardsShouldBeVisible = false;
Image imageBefore = decodePng(await driver.screenshot());
Image? imageBefore = decodePng(await driver.screenshot());
for (int i = 0; i < 10; i += 1) {
await driver.tap(toggleBtn);
cardsShouldBeVisible = !cardsShouldBeVisible;
final Image imageAfter = decodePng(await driver.screenshot());
final Image? imageAfter = decodePng(await driver.screenshot());
if (cardsShouldBeVisible) {
expect(imageBefore.data, isNot(cardsAreVisible));
expect(imageAfter.data, cardsAreVisible);
expect(imageBefore?.data, isNot(cardsAreVisible));
expect(imageAfter?.data, cardsAreVisible);
} else {
expect(imageBefore.data, cardsAreVisible);
expect(imageAfter.data, isNot(cardsAreVisible));
expect(imageBefore?.data, cardsAreVisible);
expect(imageAfter?.data, isNot(cardsAreVisible));
}
imageBefore = imageAfter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment