앱 단위·화면·통합 테스트
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fancake/core/ui/planet_25d.dart';
|
||||
import 'package:fancake/core/ui/planet_fx_scope.dart';
|
||||
import 'package:fancake/features/galaxy/galaxy_data.dart';
|
||||
import 'package:fancake/features/galaxy/widgets/zap_feedback.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('진화 중 ZAP 효과만 억제하고 확정 기여는 표시하며 종료 후 복귀한다', (tester) async {
|
||||
Future<void> show(int stage, String? tx, {bool planet = true}) =>
|
||||
tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: PlanetFxScope(
|
||||
child: Stack(
|
||||
children: [
|
||||
if (planet)
|
||||
Center(
|
||||
child: Planet25D(
|
||||
image: 'assets/figma/planet-home.png',
|
||||
size: 200,
|
||||
stage: stage,
|
||||
),
|
||||
),
|
||||
Positioned.fill(
|
||||
child: ZapFeedback(
|
||||
touchSerial: 0,
|
||||
pending: false,
|
||||
result: tx == null
|
||||
? null
|
||||
: ZapResult(
|
||||
txId: tx,
|
||||
balanceAfter: 900,
|
||||
contributedPop: 37,
|
||||
),
|
||||
source: const Offset(100, 300),
|
||||
target: const Offset(100, 100),
|
||||
radius: 60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
final paints = find.descendant(
|
||||
of: find.byType(ZapFeedback),
|
||||
matching: find.byType(CustomPaint),
|
||||
);
|
||||
await show(1, null);
|
||||
await show(2, 'one');
|
||||
await tester.pump();
|
||||
expect(find.text('이상 반응'), findsOneWidget);
|
||||
expect(find.text('37 POP 기여 완료'), findsOneWidget);
|
||||
expect(paints, findsNothing);
|
||||
await tester.pump(const Duration(seconds: 4));
|
||||
await tester.pump();
|
||||
await show(2, 'two');
|
||||
expect(paints, findsOneWidget);
|
||||
expect(find.text('37 POP 기여 완료'), findsOneWidget);
|
||||
await show(3, 'three');
|
||||
await tester.pump();
|
||||
expect(paints, findsNothing);
|
||||
await show(3, 'three', planet: false);
|
||||
await tester.pump();
|
||||
expect(paints, findsOneWidget, reason: '연출 소유자가 제거되면 억제가 남지 않아야 한다');
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user