Ensure that the engine frame callbacks are installed if the first scheduled frame is a forced frame (#101544)

See https://github.com/flutter/flutter/issues/98419
This commit is contained in:
Jason Simmons 2022-04-08 08:18:48 -07:00 committed by GitHub
parent 221235c7ed
commit b63c4a6db0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -825,6 +825,7 @@ mixin SchedulerBinding on BindingBase {
debugPrintStack(label: 'scheduleForcedFrame() called. Current phase is $schedulerPhase.');
return true;
}());
ensureFrameCallbacksRegistered();
platformDispatcher.scheduleFrame();
_hasScheduledFrame = true;
}

View file

@ -0,0 +1,16 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/scheduler.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
test('scheduleForcedFrame sets up frame callbacks', () async {
SchedulerBinding.instance.scheduleForcedFrame();
expect(SchedulerBinding.instance.platformDispatcher.onBeginFrame, isNotNull);
});
}