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(); 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); }, ); }