mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-21 20:00:49 +01:00
FlutterView.display throws a null check error when the engine has replaced its display list and the view does not yet name one of the new displays, which happens while a window is dragged on Windows. Every read of the display now goes through displayOf, which gives null in that case. Fixes #930
23 lines
665 B
Dart
23 lines
665 B
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:mornye/utils/view_display.dart';
|
|
|
|
/// A view whose display the engine no longer lists, as while a desktop
|
|
/// window is dragged to another screen.
|
|
class _MovingView extends Fake implements FlutterView {
|
|
@override
|
|
Display get display => (null as Display?)!;
|
|
}
|
|
|
|
void main() {
|
|
testWidgets('a view between screens has no display instead of an error', (
|
|
tester,
|
|
) async {
|
|
expect(() => _MovingView().display, throwsA(isA<Error>()));
|
|
expect(displayOf(_MovingView()), isNull);
|
|
expect(displayOf(null), isNull);
|
|
expect(displayOf(tester.view), isNotNull);
|
|
});
|
|
}
|