Fix error when resetting configurations in tear down phase (#114468)

* move _verifyInvariants

* fix

* fix (mimic import test_api.dart)

* fix

* Update binding.dart

* add tests

* try to move

* Revert "try to move"

This reverts commit d3c466d226cc1abe195af83a2630c70f08e25d7d.

* Update binding.dart
This commit is contained in:
fzyzcjy
2023-02-15 08:00:17 +08:00
committed by GitHub
parent c102bf4673
commit 577ad2ee8a
2 changed files with 27 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ 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';
@@ -102,4 +103,16 @@ 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;
});
});
}