[flutter_tools] reland: enable --null-assertions for flutter framework tests (#64120)

Reland of acdb909 with fixes to semantics.dart

#61042
This commit is contained in:
Jonah Williams 2020-08-19 13:25:42 -07:00 committed by GitHub
parent 266b9f99a9
commit 38e0c25823
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 24 deletions

View file

@ -538,7 +538,7 @@ Future<void> _runAddToAppLifeCycleTests() async {
Future<void> _runFrameworkTests() async {
final bq.BigqueryApi bigqueryApi = await _getBigqueryApi();
final List<String> nullSafetyOptions = <String>['--enable-experiment=non-nullable'];
final List<String> nullSafetyOptions = <String>['--enable-experiment=non-nullable', '--null-assertions'];
final List<String> trackWidgetCreationAlternatives = <String>['--track-widget-creation', '--no-track-widget-creation'];
Future<void> runWidgets() async {

View file

@ -3624,7 +3624,7 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
RenderSemanticsAnnotations({
RenderBox child,
bool container = false,
bool explicitChildNodes,
bool explicitChildNodes = false,
bool excludeSemantics = false,
bool enabled,
bool checked,

View file

@ -36,7 +36,7 @@ class RawKeyEventDataWeb extends RawKeyEventData {
///
/// See <https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key>
/// for more information.
final String key;
final String? key;
/// The modifiers that were present when the key event occurred.
///
@ -56,7 +56,7 @@ class RawKeyEventDataWeb extends RawKeyEventData {
final int metaState;
@override
String get keyLabel => key;
String? get keyLabel => key;
@override
PhysicalKeyboardKey get physicalKey {

View file

@ -149,7 +149,7 @@ void main() {
test('TextPainter error test', () {
final TextPainter painter = TextPainter(textDirection: TextDirection.ltr);
expect(() { painter.paint(null, Offset.zero); }, throwsFlutterError);
expect(() { painter.paint(null, Offset.zero); }, anyOf(throwsFlutterError, throwsAssertionError));
});
test('TextPainter requires textDirection', () {

View file

@ -6,8 +6,7 @@
import 'package:flutter/painting.dart';
import 'package:flutter/widgets.dart';
import '../flutter_test_alternative.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
test('TextSpan equals', () {
@ -44,7 +43,6 @@ void main() {
TextSpan(),
],
),
null,
TextSpan(
text: 'c',
),
@ -59,7 +57,6 @@ void main() {
' "b"\n'
' TextSpan:\n'
' (empty)\n'
' <null child>\n'
' TextSpan:\n'
' "c"\n'
));
@ -245,21 +242,7 @@ void main() {
null,
],
);
FlutterError error;
try {
text.computeToPlainText(StringBuffer());
} on FlutterError catch (e) {
error = e;
}
expect(error, isNotNull);
expect(error.toStringDeep(),
'FlutterError\n'
' TextSpan contains a null child.\n'
' A TextSpan object with a non-null child list should not have any\n'
' nulls in its child list.\n'
' The full text in question was:\n'
' TextSpan("foo bar")\n'
);
expect(() => text.computeToPlainText(StringBuffer()), anyOf(throwsFlutterError, throwsAssertionError));
});
}