[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:
parent
266b9f99a9
commit
38e0c25823
@ -538,7 +538,7 @@ Future<void> _runAddToAppLifeCycleTests() async {
|
|||||||
|
|
||||||
Future<void> _runFrameworkTests() async {
|
Future<void> _runFrameworkTests() async {
|
||||||
final bq.BigqueryApi bigqueryApi = await _getBigqueryApi();
|
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'];
|
final List<String> trackWidgetCreationAlternatives = <String>['--track-widget-creation', '--no-track-widget-creation'];
|
||||||
|
|
||||||
Future<void> runWidgets() async {
|
Future<void> runWidgets() async {
|
||||||
|
@ -3624,7 +3624,7 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
|
|||||||
RenderSemanticsAnnotations({
|
RenderSemanticsAnnotations({
|
||||||
RenderBox child,
|
RenderBox child,
|
||||||
bool container = false,
|
bool container = false,
|
||||||
bool explicitChildNodes,
|
bool explicitChildNodes = false,
|
||||||
bool excludeSemantics = false,
|
bool excludeSemantics = false,
|
||||||
bool enabled,
|
bool enabled,
|
||||||
bool checked,
|
bool checked,
|
||||||
|
@ -36,7 +36,7 @@ class RawKeyEventDataWeb extends RawKeyEventData {
|
|||||||
///
|
///
|
||||||
/// See <https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key>
|
/// See <https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key>
|
||||||
/// for more information.
|
/// for more information.
|
||||||
final String key;
|
final String? key;
|
||||||
|
|
||||||
/// The modifiers that were present when the key event occurred.
|
/// The modifiers that were present when the key event occurred.
|
||||||
///
|
///
|
||||||
@ -56,7 +56,7 @@ class RawKeyEventDataWeb extends RawKeyEventData {
|
|||||||
final int metaState;
|
final int metaState;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get keyLabel => key;
|
String? get keyLabel => key;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PhysicalKeyboardKey get physicalKey {
|
PhysicalKeyboardKey get physicalKey {
|
||||||
|
@ -149,7 +149,7 @@ void main() {
|
|||||||
|
|
||||||
test('TextPainter error test', () {
|
test('TextPainter error test', () {
|
||||||
final TextPainter painter = TextPainter(textDirection: TextDirection.ltr);
|
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', () {
|
test('TextPainter requires textDirection', () {
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
import 'package:flutter/painting.dart';
|
import 'package:flutter/painting.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import '../flutter_test_alternative.dart';
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
test('TextSpan equals', () {
|
test('TextSpan equals', () {
|
||||||
@ -44,7 +43,6 @@ void main() {
|
|||||||
TextSpan(),
|
TextSpan(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
null,
|
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: 'c',
|
text: 'c',
|
||||||
),
|
),
|
||||||
@ -59,7 +57,6 @@ void main() {
|
|||||||
' "b"\n'
|
' "b"\n'
|
||||||
' TextSpan:\n'
|
' TextSpan:\n'
|
||||||
' (empty)\n'
|
' (empty)\n'
|
||||||
' <null child>\n'
|
|
||||||
' TextSpan:\n'
|
' TextSpan:\n'
|
||||||
' "c"\n'
|
' "c"\n'
|
||||||
));
|
));
|
||||||
@ -245,21 +242,7 @@ void main() {
|
|||||||
null,
|
null,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
FlutterError error;
|
expect(() => text.computeToPlainText(StringBuffer()), anyOf(throwsFlutterError, throwsAssertionError));
|
||||||
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'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user