Unverified Commit 3a18e6ee authored by nt4f04uNd's avatar nt4f04uNd Committed by GitHub

Fix reassemble in LiveTestWidgetsFlutterBinding (#92217)

parent 6ae721de
......@@ -1391,6 +1391,7 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
Completer<void>? _pendingFrame;
bool _expectingFrame = false;
bool _expectingFrameToReassemble = false;
bool _viewNeedsPaint = false;
bool _runningAsyncTasks = false;
......@@ -1426,12 +1427,19 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
super.scheduleForcedFrame();
}
@override
Future<void> reassembleApplication() {
_expectingFrameToReassemble = true;
return super.reassembleApplication();
}
bool? _doDrawThisFrame;
@override
void handleBeginFrame(Duration? rawTimeStamp) {
assert(_doDrawThisFrame == null);
if (_expectingFrame ||
_expectingFrameToReassemble ||
(framePolicy == LiveTestWidgetsFlutterBindingFramePolicy.fullyLive) ||
(framePolicy == LiveTestWidgetsFlutterBindingFramePolicy.benchmarkLive) ||
(framePolicy == LiveTestWidgetsFlutterBindingFramePolicy.benchmark) ||
......@@ -1450,6 +1458,7 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
super.handleDrawFrame();
_doDrawThisFrame = null;
_viewNeedsPaint = false;
_expectingFrameToReassemble = false;
if (_expectingFrame) { // set during pump
assert(_pendingFrame != null);
_pendingFrame!.complete(); // unlocks the test API
......
......@@ -94,4 +94,10 @@ void main() {
expect(widgetCenter.dx, windowCenterX);
expect(widgetCenter.dy, windowCenterY);
});
testWidgets("reassembleApplication doesn't get stuck", (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/79150
await expectLater(tester.binding.reassembleApplication(), completes);
}, timeout: const Timeout(Duration(seconds: 30)));
}
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