- 后端: remaining_endpoints拆分为6个独立文件 - 后端: AI Agent Handler从ai_chat_endpoints抽取为7个独立处理器 - 后端: 食物识别prompt改为输出结构化JSON - 前端: 饮食识别从Mock替换为真实VLM API调用 - 前端: 首页图片上传URL修复(/api/upload→/api/files/upload) - 前端: 拍饮食按钮导航到独立DietCapturePage - 前端: 删除无用agent_bar.dart - 前端: 修复widget_test.dart过期属性名 - 前端: 恢复ServicePackageCard和详情页 - 新增6份实施文档(情况/问诊/报告/建档/日历/视觉统一)
71 lines
2.5 KiB
Dart
71 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:health_app/core/app_theme.dart';
|
|
import 'package:health_app/pages/auth/login_page.dart';
|
|
|
|
void main() {
|
|
testWidgets('主题颜色正确', (tester) async {
|
|
expect(AppTheme.primary, const Color(0xFF8B9CF7));
|
|
expect(AppTheme.bg, const Color(0xFFF8F9FC));
|
|
expect(AppTheme.error, const Color(0xFFF56C6C));
|
|
expect(AppTheme.success, const Color(0xFF6ECF8A));
|
|
});
|
|
|
|
testWidgets('登录页渲染正常', (tester) async {
|
|
await tester.pumpWidget(const ProviderScope(child: MaterialApp(home: LoginPage())));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.text('健康管家'), findsOneWidget);
|
|
expect(find.text('登 录'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('获取验证码按钮存在', (tester) async {
|
|
await tester.pumpWidget(const ProviderScope(child: MaterialApp(home: LoginPage())));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.text('获取验证码'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('AI 气泡样式', (tester) async {
|
|
await tester.pumpWidget(MaterialApp(
|
|
theme: AppTheme.lightTheme,
|
|
home: Scaffold(body: Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Container(
|
|
constraints: const BoxConstraints(maxWidth: 300),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: const Border(left: BorderSide(color: Color(0xFF8B9CF7), width: 3)),
|
|
),
|
|
child: const Text('收到!已记录', style: TextStyle(fontSize: 16)),
|
|
),
|
|
)),
|
|
));
|
|
await tester.pumpAndSettle();
|
|
expect(find.text('收到!已记录'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('用户气泡样式', (tester) async {
|
|
await tester.pumpWidget(MaterialApp(
|
|
theme: AppTheme.lightTheme,
|
|
home: Scaffold(body: Align(
|
|
alignment: Alignment.centerRight,
|
|
child: Container(
|
|
constraints: const BoxConstraints(maxWidth: 300),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF8B9CF7),
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: const Text('血压 135/85', style: TextStyle(fontSize: 16, color: Colors.white)),
|
|
),
|
|
)),
|
|
));
|
|
await tester.pumpAndSettle();
|
|
expect(find.text('血压 135/85'), findsOneWidget);
|
|
});
|
|
}
|