32 lines
996 B
Dart
32 lines
996 B
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:hepan_everyday/app/tp_startup.dart';
|
|
import 'package:hepan_everyday/app/tp_launch_page.dart';
|
|
|
|
void main() {
|
|
testWidgets(
|
|
'slow initialization paints branded frames instead of waiting without a Flutter UI',
|
|
(tester) async {
|
|
final ready = Completer<void>();
|
|
final startup = launchApplication(
|
|
ready: ready.future,
|
|
child: const MaterialApp(home: Text('已读取课表')),
|
|
);
|
|
try {
|
|
await tester.pump();
|
|
await tester.pump(const Duration(seconds: 3));
|
|
expect(find.byType(TpLaunchPage), findsOneWidget);
|
|
expect(find.text('已读取课表'), findsNothing);
|
|
expect(tester.binding.sendFramesToEngine, isTrue);
|
|
} finally {
|
|
ready.complete();
|
|
await startup;
|
|
await tester.pumpAndSettle();
|
|
await tester.pumpWidget(const SizedBox());
|
|
}
|
|
},
|
|
);
|
|
}
|