## UI 配色 - 健康仪表盘: 背景从蓝紫粉三色渐变改为 #4FACFE 纯色蓝, 白字清晰不抢眼 - app_colors / app_design_tokens / app_theme: 配色体系微调 - 多个 widget 和页面跟随配色更新(health_drawer/admin_drawer/doctor_drawer/enterprise_widgets 等) ## 登录页品牌升级 - 新增品牌素材: drawer_background_v2 / login_background_v2 / health_login_character_transparent - login_page 重构, 接入新品牌视觉 - app.dart 启动流程调整 ## iOS / Android 配置 - Info.plist: 权限描述调整 - AppIcon / LaunchImage: 资源更新 - AndroidManifest: 权限微调 ## 隐私文案修订 - privacy.html: 蓝牙设备描述调整为"标准蓝牙血压服务", 移除未上线设备类型表述 - terms.html: 移除"在线医生咨询"相关条款, 服务范围收窄 ## 通知中心 - notification_center_page: 重构通知项布局 ## 其他 - 删除已完成的计划/spec 文档(ui-system-first-pass / apple-sign-in / secondary-page-color-refresh / notification-preferences-design / ui-design-system) - 新增 native_navigation_test - 新增 HANDOFF 交接文档 - home_message_order_test 更新 - .gitignore 调整
163 lines
5.4 KiB
Dart
163 lines
5.4 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:health_app/pages/home/widgets/chat_messages_view.dart';
|
|
import 'package:health_app/providers/chat_provider.dart';
|
|
|
|
void main() {
|
|
test('chat messages keep their natural display order', () {
|
|
final messages = [
|
|
ChatMessage(
|
|
id: 'oldest',
|
|
role: 'user',
|
|
content: '第一条',
|
|
createdAt: DateTime(2026, 1, 1),
|
|
),
|
|
ChatMessage(
|
|
id: 'newest',
|
|
role: 'assistant',
|
|
content: '最新一条',
|
|
createdAt: DateTime(2026, 1, 2),
|
|
),
|
|
];
|
|
|
|
expect(messageAtDisplayIndex(messages, 0).id, 'oldest');
|
|
expect(messageAtDisplayIndex(messages, 1).id, 'newest');
|
|
});
|
|
|
|
test('today health card stays in the normal message stream', () {
|
|
final taskCard = ChatMessage(
|
|
id: 'task_card',
|
|
role: 'assistant',
|
|
content: '',
|
|
createdAt: DateTime(2026, 1, 1),
|
|
type: MessageType.taskCard,
|
|
);
|
|
final userMessage = ChatMessage(
|
|
id: 'user',
|
|
role: 'user',
|
|
content: '你好',
|
|
createdAt: DateTime(2026, 1, 2),
|
|
);
|
|
|
|
final messages = [taskCard, userMessage];
|
|
|
|
expect(messageAtDisplayIndex(messages, 0).id, 'task_card');
|
|
expect(messageAtDisplayIndex(messages, 1).id, 'user');
|
|
});
|
|
|
|
test('today health keeps one cached snapshot during background refresh', () {
|
|
final providers = File(
|
|
'lib/providers/data_providers.dart',
|
|
).readAsStringSync();
|
|
final card = File(
|
|
'lib/pages/home/widgets/chat_messages_view.dart',
|
|
).readAsStringSync();
|
|
final home = File('lib/pages/home/home_page.dart').readAsStringSync();
|
|
|
|
expect(providers, contains('todayHealthSnapshotProvider'));
|
|
expect(
|
|
providers,
|
|
isNot(
|
|
contains(
|
|
'notificationUnreadCountProvider = FutureProvider.autoDispose',
|
|
),
|
|
),
|
|
);
|
|
expect(
|
|
providers,
|
|
isNot(
|
|
contains(
|
|
'medicationReminderProvider =\n FutureProvider.autoDispose',
|
|
),
|
|
),
|
|
);
|
|
expect(
|
|
providers,
|
|
isNot(
|
|
contains(
|
|
'currentExercisePlanProvider =\n FutureProvider.autoDispose',
|
|
),
|
|
),
|
|
);
|
|
expect(card, contains('ref.watch(todayHealthSnapshotProvider)'));
|
|
expect(card, contains('final snapshot = snapshotAsync.value'));
|
|
expect(card, contains('正在获取今日健康'));
|
|
expect(home, contains('_refreshTodayHealthIfCached()'));
|
|
});
|
|
|
|
test('drawer keeps seven recent conversations and expands in place', () {
|
|
final source = File('lib/widgets/health_drawer.dart').readAsStringSync();
|
|
|
|
expect(source, contains('static const int _previewCount = 7;'));
|
|
expect(source, contains('bool _expanded = false;'));
|
|
expect(source, isNot(contains("pushRoute(ref, 'conversationHistory')")));
|
|
});
|
|
|
|
test('history actions stay inside the section hit-test area', () {
|
|
final source = File('lib/widgets/health_drawer.dart').readAsStringSync();
|
|
|
|
expect(source, isNot(contains('top: -46')));
|
|
expect(source, contains('trailing:'));
|
|
});
|
|
|
|
test('drawer sections use spacing without horizontal divider lines', () {
|
|
final source = File('lib/widgets/health_drawer.dart').readAsStringSync();
|
|
|
|
expect(source, isNot(contains('Divider(')));
|
|
expect(source, contains('const SizedBox(height: 22)'));
|
|
});
|
|
|
|
test('home drawer gesture is limited to the conversation stream', () {
|
|
final source = File('lib/pages/home/home_page.dart').readAsStringSync();
|
|
|
|
expect(source, contains('drawerEnableOpenDragGesture: false'));
|
|
expect(
|
|
source,
|
|
contains('onHorizontalDragUpdate: _updateConversationDrawerDrag'),
|
|
);
|
|
expect(source, isNot(contains('_drawerDragStartX')));
|
|
});
|
|
|
|
test('agent capsules use slightly larger icons and labels', () {
|
|
final source = File('lib/pages/home/home_page.dart').readAsStringSync();
|
|
final cards = File(
|
|
'lib/pages/home/widgets/chat_messages_view.dart',
|
|
).readAsStringSync();
|
|
final drawer = File('lib/widgets/health_drawer.dart').readAsStringSync();
|
|
|
|
expect(source, contains('width: 18'));
|
|
expect(source, contains('height: 18'));
|
|
expect(source, contains('visual.icon,'));
|
|
expect(source, contains('size: 13'));
|
|
expect(source, contains('fontSize: 15'));
|
|
expect(source, contains('gradient: selected'));
|
|
expect(source, contains('? AppColors.actionOutlineGradient'));
|
|
expect(source, contains('selected ? null : Colors.transparent'));
|
|
expect(source, contains('color: Colors.white'));
|
|
expect(cards, isNot(contains('LucideIcons.footprints')));
|
|
expect(cards, contains('AppModuleVisuals.exercise.icon'));
|
|
expect(drawer, contains('AppModuleVisuals.exercise.icon'));
|
|
});
|
|
|
|
test('upload and send actions stay inside one input capsule', () {
|
|
final source = File('lib/pages/home/home_page.dart').readAsStringSync();
|
|
final input = source.substring(
|
|
source.indexOf('Widget _buildInputBar()'),
|
|
source.indexOf('void _showAttachmentPicker'),
|
|
);
|
|
|
|
expect(input, contains('borderRadius: AppRadius.pillBorder'));
|
|
expect(input, contains('LucideIcons.plus'));
|
|
expect(input, contains('LucideIcons.send'));
|
|
expect(input, contains('border: InputBorder.none'));
|
|
expect(input, contains('crossAxisAlignment: CrossAxisAlignment.center'));
|
|
expect(
|
|
RegExp('gradient: AppColors.primaryGradient').allMatches(input).length,
|
|
2,
|
|
);
|
|
expect(input, isNot(contains('Border.all(color: AppColors.borderLight)')));
|
|
expect(source, isNot(contains('class _RoundToolButton')));
|
|
});
|
|
}
|