import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:meeyao_qianwen/app/app_theme.dart'; import 'package:meeyao_qianwen/features/divination/data/models/divination_params.dart'; import 'package:meeyao_qianwen/features/divination/data/models/divination_result.dart'; import 'package:meeyao_qianwen/features/divination/presentation/screens/divination_result_screen.dart'; import 'package:meeyao_qianwen/l10n/app_localizations.dart'; void main() { testWidgets('result screen shows key sections', (tester) async { final params = DivinationParams( method: DivinationMethod.auto, questionType: QuestionType.health, question: '近期状态是否平稳', divinationTime: DateTime(2026, 4, 3, 20, 30), coinBalance: 10, userId: 'u_test', ); final data = DivinationResultData( params: params, binaryCode: '101001', changedBinaryCode: '100001', guaName: '山火贲', targetGuaName: '山雷颐', upperName: '艮', lowerName: '离', signType: '中上签', keywords: '稳中求进、审时度势、蓄势待发', conclusion: '1. 方向可行\n2. 节奏宜稳', analysis: '当前阶段需先稳住节奏,再做关键推进。', suggestion: '1. 控节奏\n2. 重复盘', ganzhi: GanzhiData( yearGanZhi: '丙午', monthGanZhi: '辛卯', dayGanZhi: '丁未', timeGanZhi: '庚戌', yearKongWang: '子丑', monthKongWang: '戌亥', dayKongWang: '寅卯', timeKongWang: '寅卯', yueJian: '卯木', riChen: '未土', yuePo: '酉金', riChong: '丑土', ), wuXingStatus: {'木': '旺', '火': '相', '土': '休', '金': '囚', '水': '死'}, yaoLines: [ YaoLineData( index: 0, spirit: '龙', relation: '父母', branch: '卯', element: '木', type: YaoType.oldYin, mark: '世', ), YaoLineData( index: 1, spirit: '雀', relation: '兄弟', branch: '丑', element: '土', type: YaoType.youngYang, mark: '', ), YaoLineData( index: 2, spirit: '勾', relation: '妻财', branch: '亥', element: '水', type: YaoType.youngYin, mark: '', ), YaoLineData( index: 3, spirit: '蛇', relation: '妻财', branch: '酉', element: '金', type: YaoType.oldYang, mark: '应', ), YaoLineData( index: 4, spirit: '虎', relation: '子孙', branch: '未', element: '土', type: YaoType.youngYang, mark: '', ), YaoLineData( index: 5, spirit: '玄', relation: '兄弟', branch: '巳', element: '火', type: YaoType.oldYin, mark: '', ), ], targetYaoLines: [ YaoLineData( index: 0, spirit: '龙', relation: '父母', branch: '子', element: '水', type: YaoType.youngYang, mark: '世', ), YaoLineData( index: 1, spirit: '雀', relation: '兄弟', branch: '丑', element: '土', type: YaoType.youngYang, mark: '', ), YaoLineData( index: 2, spirit: '勾', relation: '妻财', branch: '亥', element: '水', type: YaoType.youngYin, mark: '', ), YaoLineData( index: 3, spirit: '蛇', relation: '妻财', branch: '申', element: '金', type: YaoType.youngYin, mark: '应', ), YaoLineData( index: 4, spirit: '虎', relation: '子孙', branch: '未', element: '土', type: YaoType.youngYang, mark: '', ), YaoLineData( index: 5, spirit: '玄', relation: '兄弟', branch: '午', element: '火', type: YaoType.youngYang, mark: '', ), ], ); await tester.pumpWidget( MaterialApp( theme: AppTheme.light(), locale: const Locale('zh'), localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: AppLocalizations.supportedLocales, home: DivinationResultScreen(data: data), ), ); await tester.pump(const Duration(milliseconds: 1000)); await tester.pumpAndSettle(); expect(find.text('解卦结果'), findsOneWidget); expect(find.text('AI解卦'), findsOneWidget); expect(find.text('基础信息'), findsOneWidget); expect(find.text('卦象详情'), findsOneWidget); expect(find.text('解卦结论'), findsOneWidget); expect(find.text('○ 老阳(变)'), findsOneWidget); expect(find.text('× 老阴(变)'), findsOneWidget); expect(find.text('○'), findsWidgets); expect(find.text('×'), findsWidgets); }); }