Unverified Commit 5a3957f3 authored by Loïc Sharma's avatar Loïc Sharma Committed by GitHub

Revert "Fix error when resetting configurations in tear down phase" (#120739)

Reverts flutter/flutter#114468 by @fzyzcjy

Example failure: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8789140722059256001/+/u/run_test.dart_for_tool_integration_tests_shard_and_subshard_1_4/test_stdout
parent ba46cb8d
...@@ -15,7 +15,6 @@ import 'package:flutter/services.dart'; ...@@ -15,7 +15,6 @@ import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:stack_trace/stack_trace.dart' as stack_trace; import 'package:stack_trace/stack_trace.dart' as stack_trace;
import 'package:test_api/expect.dart' show fail; import 'package:test_api/expect.dart' show fail;
import 'package:test_api/scaffolding.dart'; // ignore: deprecated_member_use
import 'package:test_api/test_api.dart' as test_package show Timeout; // ignore: deprecated_member_use import 'package:test_api/test_api.dart' as test_package show Timeout; // ignore: deprecated_member_use
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
...@@ -920,13 +919,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase ...@@ -920,13 +919,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
// So that we can assert that it remains the same after the test finishes. // So that we can assert that it remains the same after the test finishes.
_beforeTestCheckIntrinsicSizes = debugCheckIntrinsicSizes; _beforeTestCheckIntrinsicSizes = debugCheckIntrinsicSizes;
bool shouldTearDownVerifyInvariants = false;
addTearDown(() {
if (shouldTearDownVerifyInvariants) {
_verifyTearDownInvariants();
}
});
runApp(Container(key: UniqueKey(), child: _preTestMessage)); // Reset the tree to a known state. runApp(Container(key: UniqueKey(), child: _preTestMessage)); // Reset the tree to a known state.
await pump(); await pump();
// Pretend that the first frame produced in the test body is the first frame // Pretend that the first frame produced in the test body is the first frame
...@@ -957,7 +949,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase ...@@ -957,7 +949,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
_verifyErrorWidgetBuilderUnset(errorWidgetBuilderBeforeTest); _verifyErrorWidgetBuilderUnset(errorWidgetBuilderBeforeTest);
_verifyShouldPropagateDevicePointerEventsUnset(shouldPropagateDevicePointerEventsBeforeTest); _verifyShouldPropagateDevicePointerEventsUnset(shouldPropagateDevicePointerEventsBeforeTest);
_verifyInvariants(); _verifyInvariants();
shouldTearDownVerifyInvariants = true;
} }
assert(inTest); assert(inTest);
...@@ -967,11 +958,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase ...@@ -967,11 +958,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
late bool _beforeTestCheckIntrinsicSizes; late bool _beforeTestCheckIntrinsicSizes;
void _verifyInvariants() { void _verifyInvariants() {
// subclasses such as AutomatedTestWidgetsFlutterBinding overrides this
// to perform more verifications.
}
void _verifyTearDownInvariants() {
assert(debugAssertNoTransientCallbacks( assert(debugAssertNoTransientCallbacks(
'An animation is still running even after the widget tree was disposed.' 'An animation is still running even after the widget tree was disposed.'
)); ));
......
...@@ -12,7 +12,6 @@ library; ...@@ -12,7 +12,6 @@ library;
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -103,16 +102,4 @@ void main() { ...@@ -103,16 +102,4 @@ void main() {
}); });
expect(responded, true); expect(responded, true);
}); });
group('should be able to reset values in either tearDown or end of function', () {
testWidgets('addTearDown should work', (WidgetTester tester) async {
timeDilation = 2;
addTearDown(() => timeDilation = 1);
});
testWidgets('directly reset should work', (WidgetTester tester) async {
timeDilation = 2;
timeDilation = 1;
});
});
} }
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