Unverified Commit 66ff7786 authored by xubaolin's avatar xubaolin Committed by GitHub

Do not output the error msg to the console when run a throwable test (#91593)

parent f9c4b227
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -38,9 +39,16 @@ void main() { ...@@ -38,9 +39,16 @@ void main() {
), ),
); );
final FlutterExceptionHandler? handler = FlutterError.onError;
FlutterErrorDetails? error;
FlutterError.onError = (FlutterErrorDetails details) {
error = details;
};
await tester.drag(find.text('BottomSheet'), const Offset(0.0, 150.0)); await tester.drag(find.text('BottomSheet'), const Offset(0.0, 150.0));
expect(tester.takeException(), isNotNull); expect(error, isNotNull);
FlutterError.onError = handler;
}); });
testWidgets('Tapping on a modal BottomSheet should not dismiss it', (WidgetTester tester) async { testWidgets('Tapping on a modal BottomSheet should not dismiss it', (WidgetTester tester) async {
......
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