Files
TPSchedule/mobile/test/widgets/tp_startup_test.dart
T

30 lines
910 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';
void main() {
testWidgets(
'startup shows brand while initializing and immediately proceeds when ready',
(tester) async {
final ready = Completer<void>();
await tester.pumpWidget(
TpStartup(
ready: ready.future,
child: const MaterialApp(home: Scaffold(body: Text('已准备好课表'))),
),
);
await tester.pump();
expect(find.text('TPSchedule'), findsOneWidget);
expect(find.text('已准备好课表'), findsNothing);
ready.complete();
await tester.pump();
await tester.pump();
expect(find.text('已准备好课表'), findsOneWidget);
await tester.pumpAndSettle();
expect(find.text('TPSchedule'), findsNothing);
},
);
}