Skip to content

Commit

Permalink
Revert "Fix error when resetting configurations in tear down phase" (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-sharma authored Feb 15, 2023
1 parent ba46cb8 commit 5a3957f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
14 changes: 0 additions & 14 deletions packages/flutter_test/lib/src/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:stack_trace/stack_trace.dart' as stack_trace;
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:vector_math/vector_math_64.dart';

Expand Down Expand Up @@ -920,13 +919,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
// So that we can assert that it remains the same after the test finishes.
_beforeTestCheckIntrinsicSizes = debugCheckIntrinsicSizes;

bool shouldTearDownVerifyInvariants = false;
addTearDown(() {
if (shouldTearDownVerifyInvariants) {
_verifyTearDownInvariants();
}
});

runApp(Container(key: UniqueKey(), child: _preTestMessage)); // Reset the tree to a known state.
await pump();
// Pretend that the first frame produced in the test body is the first frame
Expand Down Expand Up @@ -957,7 +949,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
_verifyErrorWidgetBuilderUnset(errorWidgetBuilderBeforeTest);
_verifyShouldPropagateDevicePointerEventsUnset(shouldPropagateDevicePointerEventsBeforeTest);
_verifyInvariants();
shouldTearDownVerifyInvariants = true;
}

assert(inTest);
Expand All @@ -967,11 +958,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
late bool _beforeTestCheckIntrinsicSizes;

void _verifyInvariants() {
// subclasses such as AutomatedTestWidgetsFlutterBinding overrides this
// to perform more verifications.
}

void _verifyTearDownInvariants() {
assert(debugAssertNoTransientCallbacks(
'An animation is still running even after the widget tree was disposed.'
));
Expand Down
13 changes: 0 additions & 13 deletions packages/flutter_test/test/bindings_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ library;
import 'dart:async';
import 'dart:io';

import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down Expand Up @@ -103,16 +102,4 @@ void main() {
});
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;
});
});
}

0 comments on commit 5a3957f

Please sign in to comment.