1707 lines
75 KiB
Dart
1707 lines
75 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:flutter_test/flutter_test.dart';
|
||
import 'package:yumi/app/config/app_config.dart';
|
||
import 'package:yumi/app/config/business_logic_strategy.dart';
|
||
import 'package:yumi/app/config/configs/variant1_config.dart';
|
||
import 'package:yumi/app/config/strategies/base_business_logic_strategy.dart';
|
||
import 'package:yumi/app/config/strategies/variant1_business_logic_strategy.dart';
|
||
import 'package:yumi/ui_kit/theme/socialchat_theme.dart';
|
||
|
||
void main() {
|
||
group('BusinessLogicStrategy Tests', () {
|
||
test('Home tab index test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
expect(strategy.getHomeInitialTabIndex(), isA<int>());
|
||
});
|
||
|
||
test(
|
||
'First recharge position test',
|
||
() {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
final pos = strategy.getFirstRechargePosition();
|
||
expect(pos, isA<Map<String, double?>>());
|
||
expect(pos.containsKey('top'), true);
|
||
expect(pos.containsKey('bottom'), true);
|
||
expect(pos.containsKey('start'), true);
|
||
expect(pos.containsKey('end'), true);
|
||
});
|
||
|
||
test('Variant1 home tab index test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
expect(strategy.getHomeInitialTabIndex(), 0);
|
||
});
|
||
|
||
test(
|
||
'Variant1 recharge position test',
|
||
() {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
final pos = strategy.getFirstRechargePosition();
|
||
expect(pos['top'], 100.0);
|
||
expect(pos['start'], 15.0);
|
||
expect(pos['bottom'], null);
|
||
expect(pos['end'], null);
|
||
});
|
||
|
||
test('Config strategy test', () {
|
||
final c = SCVariant1Config();
|
||
expect(c.businessLogicStrategy, isA<Variant1BusinessLogicStrategy>());
|
||
});
|
||
|
||
test('Config init test', () {
|
||
// 直接测试初始化方法
|
||
AppConfig.initialize();
|
||
expect(AppConfig.current, isA<SCVariant1Config>());
|
||
expect(AppConfig.current.businessLogicStrategy,
|
||
isA<Variant1BusinessLogicStrategy>());
|
||
});
|
||
});
|
||
|
||
group('Admin Page Strategy Tests', () {
|
||
test('Admin editing test', () {
|
||
final s = BaseBusinessLogicStrategy();
|
||
|
||
// 测试编辑页面背景图片
|
||
expect(s.getAdminEditingBackgroundImage(),
|
||
"sc_images/room/at_icon_room_settig_bg.png");
|
||
|
||
// 测试编辑页面按钮渐变颜色
|
||
final wg = s.getAdminEditingButtonGradient('warning');
|
||
expect(wg, isA<List<Color>>());
|
||
expect(wg.length, 2);
|
||
expect(wg[0], const Color(0xffC670FF));
|
||
expect(wg[1], const Color(0xff7726FF));
|
||
|
||
// 测试编辑页面图标路径
|
||
expect(s.getAdminEditingIcon('specialIdBg'),
|
||
"sc_images/general/at_icon_special_id_bg.png");
|
||
expect(s.getAdminEditingIcon('normalIdBg'),
|
||
"sc_images/general/at_icon_id_bg.png");
|
||
expect(s.getAdminEditingIcon('copyId'),
|
||
"sc_images/room/at_icon_user_card_copy_id.png");
|
||
expect(s.getAdminEditingIcon('addPic'),
|
||
"sc_images/general/at_icon_add_pic.png");
|
||
expect(s.getAdminEditingIcon('closePic'),
|
||
"sc_images/general/at_icon_pic_close.png");
|
||
expect(s.getAdminEditingIcon('checked'),
|
||
"sc_images/general/at_icon_checked.png");
|
||
expect(s.getAdminEditingIcon('unknown'), "");
|
||
|
||
// 测试编辑页面输入框装饰
|
||
final inputDecoration = s.getAdminEditingInputDecoration();
|
||
expect(inputDecoration, isA<BoxDecoration>());
|
||
expect(inputDecoration.color, Colors.white);
|
||
expect(inputDecoration.borderRadius,
|
||
BorderRadius.circular(8)); // 注意:BorderRadius.circular(8) 与 BorderRadius.circular(8) 比较
|
||
|
||
// 测试最大图片上传数量
|
||
expect(s.getAdminEditingMaxImageUploadCount(), 3);
|
||
|
||
// 测试描述最大长度
|
||
expect(s.getAdminEditingDescriptionMaxLength(), 200);
|
||
|
||
// 测试违规类型映射
|
||
final userViolationMapping =
|
||
s.getAdminEditingViolationTypeMapping('User');
|
||
expect(userViolationMapping, isA<Map<String, int>>());
|
||
expect(userViolationMapping['Pornography'], 1);
|
||
expect(userViolationMapping['Illegal information'], 2);
|
||
|
||
final roomViolationMapping =
|
||
s.getAdminEditingViolationTypeMapping('Room');
|
||
expect(roomViolationMapping, isA<Map<String, int>>());
|
||
expect(roomViolationMapping['Pornography'], 3);
|
||
expect(roomViolationMapping['Illegal information'], 4);
|
||
expect(roomViolationMapping['Fraud'], 5);
|
||
expect(roomViolationMapping['Other'], 6);
|
||
});
|
||
|
||
test('Search test', () {
|
||
final s = BaseBusinessLogicStrategy();
|
||
|
||
// 测试搜索页面背景图片
|
||
expect(s.getAdminSearchBackgroundImage('userSearch'),
|
||
"sc_images/index/at_icon_coupon_head_bg.png");
|
||
expect(s.getAdminSearchBackgroundImage('roomSearch'),
|
||
"sc_images/index/at_icon_coupon_head_bg.png");
|
||
|
||
// 测试搜索按钮渐变颜色
|
||
final buttonGradient = s.getAdminSearchButtonGradient('userSearch');
|
||
expect(buttonGradient, isA<List<Color>>());
|
||
expect(buttonGradient.length, 2);
|
||
expect(buttonGradient[0], Colors.transparent);
|
||
expect(buttonGradient[1], Colors.transparent);
|
||
|
||
// 测试搜索按钮文本颜色
|
||
expect(s.getAdminSearchButtonTextColor('userSearch'), Colors.black);
|
||
|
||
// 测试编辑图标路径
|
||
expect(s.getAdminSearchEditIcon('userSearch'),
|
||
"sc_images/room/at_icon_room_edit.png");
|
||
|
||
// 测试搜索框边框颜色
|
||
expect(s.getAdminSearchInputBorderColor('userSearch'),
|
||
Colors.black12);
|
||
|
||
// 测试搜索框文本颜色
|
||
expect(s.getAdminSearchInputTextColor('userSearch'), Colors.grey);
|
||
|
||
// 测试用户信息图标路径
|
||
expect(s.getAdminSearchUserInfoIcon('specialIdBg'),
|
||
"sc_images/general/at_icon_special_id_bg.png");
|
||
expect(s.getAdminSearchUserInfoIcon('normalIdBg'),
|
||
"sc_images/general/at_icon_id_bg.png");
|
||
expect(s.getAdminSearchUserInfoIcon('copyId'),
|
||
"sc_images/room/at_icon_user_card_copy_id.png");
|
||
expect(s.getAdminSearchUserInfoIcon('unknown'), "");
|
||
});
|
||
|
||
test('Variant1 editing test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试编辑页面背景图片(马甲包目前使用相同图片)
|
||
expect(strategy.getAdminEditingBackgroundImage(),
|
||
"sc_images/room/at_icon_room_settig_bg.png");
|
||
|
||
// 测试编辑页面按钮渐变颜色(马甲包使用不同渐变)
|
||
final buttonGradient = strategy.getAdminEditingButtonGradient('warning');
|
||
expect(buttonGradient, isA<List<Color>>());
|
||
expect(buttonGradient.length, 2);
|
||
expect(buttonGradient[0], const Color(0xffFF9326));
|
||
expect(buttonGradient[1], const Color(0xffFEB219));
|
||
|
||
// 测试编辑页面图标路径(马甲包目前使用相同图标)
|
||
expect(strategy.getAdminEditingIcon('specialIdBg'),
|
||
"sc_images/general/at_icon_special_id_bg.png");
|
||
|
||
// 测试编辑页面输入框装饰(马甲包使用不同装饰)
|
||
final inputDecoration = strategy.getAdminEditingInputDecoration();
|
||
expect(inputDecoration, isA<BoxDecoration>());
|
||
expect(inputDecoration.color, const Color(0xfff2f2f2));
|
||
expect(inputDecoration.borderRadius, BorderRadius.circular(56));
|
||
|
||
// 测试最大图片上传数量(马甲包使用不同值)
|
||
expect(strategy.getAdminEditingMaxImageUploadCount(), 5);
|
||
|
||
// 测试描述最大长度(马甲包使用不同值)
|
||
expect(strategy.getAdminEditingDescriptionMaxLength(), 300);
|
||
|
||
// 测试违规类型映射(马甲包使用相同映射)
|
||
final roomViolationMapping =
|
||
strategy.getAdminEditingViolationTypeMapping('Room');
|
||
expect(roomViolationMapping['Pornography'], 3);
|
||
expect(roomViolationMapping['Other'], 6);
|
||
});
|
||
|
||
test('Variant1 search methods',
|
||
() {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试搜索页面背景图片(马甲包使用相同图片)
|
||
expect(strategy.getAdminSearchBackgroundImage('userSearch'),
|
||
"sc_images/index/at_icon_coupon_head_bg.png");
|
||
|
||
// 测试搜索按钮渐变颜色(马甲包使用不同渐变)
|
||
final buttonGradient = strategy.getAdminSearchButtonGradient('userSearch');
|
||
expect(buttonGradient, isA<List<Color>>());
|
||
expect(buttonGradient.length, 2);
|
||
expect(buttonGradient[0], const Color(0xffFF9326));
|
||
expect(buttonGradient[1], const Color(0xffFEB219));
|
||
|
||
// 测试搜索按钮文本颜色(马甲包使用不同颜色)
|
||
expect(strategy.getAdminSearchButtonTextColor('userSearch'), Colors.white);
|
||
|
||
// 测试编辑图标路径(马甲包使用相同图标)
|
||
expect(strategy.getAdminSearchEditIcon('userSearch'),
|
||
"sc_images/room/at_icon_room_edit.png");
|
||
|
||
// 测试搜索框边框颜色(马甲包使用不同颜色)
|
||
expect(strategy.getAdminSearchInputBorderColor('userSearch'),
|
||
const Color(0xffFF5722));
|
||
|
||
// 测试搜索框文本颜色(马甲包使用不同颜色)
|
||
expect(strategy.getAdminSearchInputTextColor('userSearch'), Colors.black87);
|
||
|
||
// 测试用户信息图标路径(马甲包使用相同图标)
|
||
expect(strategy.getAdminSearchUserInfoIcon('specialIdBg'),
|
||
"sc_images/general/at_icon_special_id_bg.png");
|
||
});
|
||
});
|
||
|
||
group('Media Page Strategy Tests', () {
|
||
test('Image preview test',
|
||
() {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试图片预览页面背景颜色
|
||
expect(strategy.getImagePreviewBackgroundColor(), Colors.black);
|
||
|
||
// 测试图片预览画廊背景颜色
|
||
expect(strategy.getImagePreviewGalleryBackgroundColor(), Colors.black);
|
||
|
||
// 测试图片预览AppBar背景颜色
|
||
expect(strategy.getImagePreviewAppBarBackgroundColor(), Colors.black54);
|
||
|
||
// 测试图片预览返回图标颜色
|
||
expect(strategy.getImagePreviewBackIconColor(), Colors.white);
|
||
|
||
// 测试图片预览文本颜色
|
||
expect(strategy.getImagePreviewTextColor(), Colors.white);
|
||
|
||
// 测试图片预览加载指示器颜色
|
||
expect(strategy.getImagePreviewLoadingIndicatorColor(),
|
||
const Color(0xFFFF9500));
|
||
|
||
// 测试图片预览AppBar透明度
|
||
expect(strategy.getImagePreviewAppBarOpacity(), 0.54);
|
||
});
|
||
|
||
test('Video player test',
|
||
() {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试视频播放页面背景颜色
|
||
expect(strategy.getVideoPlayerBackgroundColor(), Colors.black);
|
||
|
||
// 测试视频播放控制界面背景颜色
|
||
expect(strategy.getVideoPlayerControlsBackgroundColor(), Colors.black38);
|
||
|
||
// 测试视频播放图标颜色
|
||
expect(strategy.getVideoPlayerIconColor(), Colors.white);
|
||
|
||
// 测试视频播放底部控制栏背景颜色
|
||
expect(strategy.getVideoPlayerBottomControlsBackgroundColor(),
|
||
Colors.black54);
|
||
|
||
// 测试视频播放进度条活动颜色
|
||
expect(strategy.getVideoPlayerProgressBarActiveColor(), Colors.red);
|
||
|
||
// 测试视频播放进度条非活动颜色
|
||
expect(strategy.getVideoPlayerProgressBarInactiveColor(), Colors.grey);
|
||
|
||
// 测试视频播放文本颜色
|
||
expect(strategy.getVideoPlayerTextColor(), Colors.white);
|
||
|
||
// 测试视频播放加载指示器颜色
|
||
expect(strategy.getVideoPlayerLoadingIndicatorColor(), Colors.red);
|
||
|
||
// 测试视频播放控制界面透明度
|
||
expect(strategy.getVideoPlayerControlsOpacity(), 0.38);
|
||
|
||
// 测试视频播放底部控制栏透明度
|
||
expect(strategy.getVideoPlayerBottomControlsOpacity(), 0.54);
|
||
|
||
// 测试视频播放控制界面显示持续时间
|
||
expect(strategy.getVideoPlayerControlsDisplayDuration(), 3);
|
||
});
|
||
|
||
test('Variant1 image preview test',
|
||
() {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试马甲包图片预览页面背景颜色(深灰色)
|
||
expect(strategy.getImagePreviewBackgroundColor(),
|
||
const Color(0xff1a1a1a));
|
||
|
||
// 测试马甲包图片预览画廊背景颜色(深灰色)
|
||
expect(strategy.getImagePreviewGalleryBackgroundColor(),
|
||
const Color(0xff1a1a1a));
|
||
|
||
// 测试马甲包图片预览AppBar背景颜色(深灰色70%透明度)
|
||
expect(strategy.getImagePreviewAppBarBackgroundColor(),
|
||
const Color(0xff1a1a1a).withOpacity(0.7));
|
||
|
||
// 测试马甲包图片预览返回图标颜色(浅灰色)
|
||
expect(strategy.getImagePreviewBackIconColor(),
|
||
const Color(0xffe6e6e6));
|
||
|
||
// 测试马甲包图片预览文本颜色(浅灰色)
|
||
expect(strategy.getImagePreviewTextColor(),
|
||
const Color(0xffe6e6e6));
|
||
|
||
// 测试马甲包图片预览加载指示器颜色(橙色主题色)
|
||
expect(strategy.getImagePreviewLoadingIndicatorColor(),
|
||
const Color(0xffFF5722));
|
||
|
||
// 测试马甲包图片预览AppBar透明度
|
||
expect(strategy.getImagePreviewAppBarOpacity(), 0.7);
|
||
});
|
||
|
||
test('Variant1 video player test',
|
||
() {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试马甲包视频播放页面背景颜色(深灰色)
|
||
expect(strategy.getVideoPlayerBackgroundColor(),
|
||
const Color(0xff1a1a1a));
|
||
|
||
// 测试马甲包视频播放控制界面背景颜色(深灰色50%透明度)
|
||
expect(strategy.getVideoPlayerControlsBackgroundColor(),
|
||
const Color(0xff1a1a1a).withOpacity(0.5));
|
||
|
||
// 测试马甲包视频播放图标颜色(浅灰色)
|
||
expect(strategy.getVideoPlayerIconColor(),
|
||
const Color(0xffe6e6e6));
|
||
|
||
// 测试马甲包视频播放底部控制栏背景颜色(深灰色60%透明度)
|
||
expect(strategy.getVideoPlayerBottomControlsBackgroundColor(),
|
||
const Color(0xff1a1a1a).withOpacity(0.6));
|
||
|
||
// 测试马甲包视频播放进度条活动颜色(橙色主题色)
|
||
expect(strategy.getVideoPlayerProgressBarActiveColor(),
|
||
const Color(0xffFF5722));
|
||
|
||
// 测试马甲包视频播放进度条非活动颜色(深灰色)
|
||
expect(strategy.getVideoPlayerProgressBarInactiveColor(),
|
||
const Color(0xff666666));
|
||
|
||
// 测试马甲包视频播放文本颜色(浅灰色)
|
||
expect(strategy.getVideoPlayerTextColor(),
|
||
const Color(0xffe6e6e6));
|
||
|
||
// 测试马甲包视频播放加载指示器颜色(橙色主题色)
|
||
expect(strategy.getVideoPlayerLoadingIndicatorColor(),
|
||
const Color(0xffFF5722));
|
||
|
||
// 测试马甲包视频播放控制界面透明度
|
||
expect(strategy.getVideoPlayerControlsOpacity(), 0.5);
|
||
|
||
// 测试马甲包视频播放底部控制栏透明度
|
||
expect(strategy.getVideoPlayerBottomControlsOpacity(), 0.6);
|
||
|
||
// 测试马甲包视频播放控制界面显示持续时间(5秒)
|
||
expect(strategy.getVideoPlayerControlsDisplayDuration(), 5);
|
||
});
|
||
});
|
||
|
||
group('Report Page Strategy Tests', () {
|
||
test('Report page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试报告页面背景图片
|
||
expect(strategy.getReportPageBackgroundImage(),
|
||
"sc_images/room/at_icon_room_settig_bg.png");
|
||
|
||
// 测试报告页面提示文本颜色
|
||
expect(strategy.getReportPageHintTextColor(), Colors.black38);
|
||
|
||
// 测试报告页面容器背景颜色
|
||
expect(strategy.getReportPageContainerBackgroundColor(), Colors.white);
|
||
|
||
// 测试报告页面边框颜色
|
||
expect(strategy.getReportPageBorderColor(), const Color(0xffE6E6E6));
|
||
|
||
// 测试报告页面主要文本颜色
|
||
expect(strategy.getReportPagePrimaryTextColor(), Colors.black);
|
||
|
||
// 测试报告页面次要提示文本颜色
|
||
expect(strategy.getReportPageSecondaryHintTextColor(), Colors.black45);
|
||
|
||
// 测试报告页面未选中边框颜色
|
||
expect(strategy.getReportPageUnselectedBorderColor(), Colors.grey);
|
||
|
||
// 测试报告页面提交按钮背景颜色(原始应用使用主题色,但Base策略返回蓝色占位符)
|
||
expect(strategy.getReportPageSubmitButtonBackgroundColor(), Colors.blue);
|
||
|
||
// 测试报告页面提交按钮文本颜色
|
||
expect(strategy.getReportPageSubmitButtonTextColor(), Colors.white);
|
||
|
||
// 测试报告页面图标
|
||
expect(strategy.getReportPageIcon('addPic'),
|
||
"sc_images/general/at_icon_add_pic.png");
|
||
expect(strategy.getReportPageIcon('closePic'),
|
||
"sc_images/general/at_icon_pic_close.png");
|
||
expect(strategy.getReportPageIcon('checked'),
|
||
"sc_images/general/at_icon_checked.png");
|
||
expect(strategy.getReportPageIcon('unknown'), "");
|
||
});
|
||
|
||
test('Variant1 report page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试报告页面背景图片(马甲包使用相同图片)
|
||
expect(strategy.getReportPageBackgroundImage(),
|
||
"sc_images/room/at_icon_room_settig_bg.png");
|
||
|
||
// 测试报告页面提示文本颜色(马甲包使用深灰色)
|
||
expect(strategy.getReportPageHintTextColor(),
|
||
const Color(0xff666666));
|
||
|
||
// 测试报告页面容器背景颜色(马甲包使用白色)
|
||
expect(strategy.getReportPageContainerBackgroundColor(), Colors.white);
|
||
|
||
// 测试报告页面边框颜色(马甲包使用浅灰色)
|
||
expect(strategy.getReportPageBorderColor(),
|
||
const Color(0xffCCCCCC));
|
||
|
||
// 测试报告页面主要文本颜色(马甲包使用黑色)
|
||
expect(strategy.getReportPagePrimaryTextColor(), Colors.black);
|
||
|
||
// 测试报告页面次要提示文本颜色(马甲包使用深灰色)
|
||
expect(strategy.getReportPageSecondaryHintTextColor(),
|
||
const Color(0xff666666));
|
||
|
||
// 测试报告页面未选中边框颜色(马甲包使用灰色)
|
||
expect(strategy.getReportPageUnselectedBorderColor(), Colors.grey);
|
||
|
||
// 测试报告页面提交按钮背景颜色(马甲包使用橙色主题色)
|
||
expect(strategy.getReportPageSubmitButtonBackgroundColor(),
|
||
const Color(0xffFF5722));
|
||
|
||
// 测试报告页面提交按钮文本颜色(马甲包使用白色)
|
||
expect(strategy.getReportPageSubmitButtonTextColor(), Colors.white);
|
||
|
||
// 测试报告页面图标(马甲包使用相同图标)
|
||
expect(strategy.getReportPageIcon('addPic'),
|
||
"sc_images/general/at_icon_add_pic.png");
|
||
expect(strategy.getReportPageIcon('closePic'),
|
||
"sc_images/general/at_icon_pic_close.png");
|
||
expect(strategy.getReportPageIcon('checked'),
|
||
"sc_images/general/at_icon_checked.png");
|
||
expect(strategy.getReportPageIcon('unknown'), "");
|
||
});
|
||
});
|
||
|
||
group('Store Page Strategy Tests', () {
|
||
test('Store page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试Store页面背景图片
|
||
expect(strategy.getStorePageBackgroundImage(),
|
||
"sc_images/room/at_icon_room_settig_bg.png");
|
||
|
||
// 测试Store页面购物袋图标
|
||
expect(strategy.getStorePageShoppingBagIcon(),
|
||
"sc_images/store/at_icon_shop_bag.png");
|
||
|
||
// 测试Store页面购物袋图标外边距
|
||
final shoppingBagMargin = strategy.getStorePageShoppingBagMargin();
|
||
expect(shoppingBagMargin, isA<EdgeInsetsDirectional>());
|
||
expect(shoppingBagMargin.end, 10.0);
|
||
|
||
// 测试Store页面Tab标签内边距
|
||
final tabLabelPadding = strategy.getStorePageTabLabelPadding();
|
||
expect(tabLabelPadding, isA<EdgeInsets>());
|
||
expect(tabLabelPadding.left, 12.0);
|
||
expect(tabLabelPadding.end, 12.0);
|
||
|
||
// 测试Store页面Tab标签选中文本样式
|
||
final selectedTabStyle = strategy.getStorePageTabLabelStyle();
|
||
expect(selectedTabStyle, isA<TextStyle>());
|
||
expect(selectedTabStyle.fontSize, 15.0);
|
||
expect(selectedTabStyle.color, Colors.black87);
|
||
expect(selectedTabStyle.fontWeight, FontWeight.w600);
|
||
|
||
// 测试Store页面Tab标签未选中文本样式
|
||
final unselectedTabStyle = strategy.getStorePageTabUnselectedLabelStyle();
|
||
expect(unselectedTabStyle, isA<TextStyle>());
|
||
expect(unselectedTabStyle.fontSize, 13.0);
|
||
expect(unselectedTabStyle.color, Colors.black38);
|
||
expect(unselectedTabStyle.fontWeight, FontWeight.w500);
|
||
|
||
// 测试Store页面Tab指示器颜色
|
||
expect(strategy.getStorePageTabIndicatorColor(),
|
||
const Color(0xffFF5722)); // SocialChatTheme.primaryColor
|
||
|
||
// 测试Store页面Tab分割线颜色
|
||
expect(strategy.getStorePageTabDividerColor(), Colors.transparent);
|
||
|
||
// 测试Store页面底部Divider颜色
|
||
expect(strategy.getStorePageBottomDividerColor(),
|
||
const Color(0x1F000000)); // Colors.black12
|
||
|
||
// 测试Store页面底部Divider厚度
|
||
expect(strategy.getStorePageBottomDividerThickness(), 0.5);
|
||
|
||
// 测试Store页面底部Divider高度
|
||
expect(strategy.getStorePageBottomDividerHeight(), 24.0);
|
||
|
||
// 测试Store页面金币图标
|
||
expect(strategy.getStorePageGoldIcon(),
|
||
"sc_images/general/at_icon_jb.png");
|
||
|
||
// 测试Store页面金币文本颜色
|
||
expect(strategy.getStorePageGoldTextColor(),
|
||
const Color(0xFFFFE134));
|
||
|
||
// 测试Store页面金币图标颜色
|
||
expect(strategy.getStorePageGoldIconColor(),
|
||
const Color(0xFFFFE134));
|
||
});
|
||
|
||
test('Store item test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试Store商品项背景颜色
|
||
expect(strategy.getStoreItemBackgroundColor(), Colors.white);
|
||
|
||
// 测试Store商品项未选中边框颜色
|
||
expect(strategy.getStoreItemUnselectedBorderColor(),
|
||
const Color(0x1F000000)); // Colors.black12
|
||
|
||
// 测试Store商品项选中边框颜色
|
||
expect(strategy.getStoreItemSelectedBorderColor(),
|
||
const Color(0xffFF9500)); // SocialChatTheme.primaryLight
|
||
|
||
// 测试Store商品项金币图标
|
||
expect(strategy.getStoreItemGoldIcon(),
|
||
"sc_images/general/at_icon_jb.png");
|
||
|
||
// 测试Store商品项价格文本颜色
|
||
expect(strategy.getStoreItemPriceTextColor(), Colors.black);
|
||
|
||
// 测试Store商品项购买按钮背景颜色
|
||
expect(strategy.getStoreItemBuyButtonColor(),
|
||
const Color(0xffFF9500)); // SocialChatTheme.primaryLight
|
||
|
||
// 测试Store商品项购买按钮文本颜色
|
||
expect(strategy.getStoreItemBuyButtonTextColor(), Colors.white);
|
||
|
||
// 测试Store商品项操作图标
|
||
expect(strategy.getStoreItemActionIcon('headdress'),
|
||
"sc_images/store/at_icon_shop_item_search.png");
|
||
expect(strategy.getStoreItemActionIcon('mountains'),
|
||
"sc_images/store/at_icon_shop_item_play.png");
|
||
expect(strategy.getStoreItemActionIcon('chatbox'),
|
||
"sc_images/store/at_icon_shop_item_search.png");
|
||
expect(strategy.getStoreItemActionIcon('theme'),
|
||
"sc_images/store/at_icon_store_theme_rev.png");
|
||
expect(strategy.getStoreItemActionIcon('unknown'), "sc_images/store/at_icon_store_theme_rev.png");
|
||
});
|
||
|
||
test('Variant1 store page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试Store页面背景图片(马甲包使用相同图片)
|
||
expect(strategy.getStorePageBackgroundImage(),
|
||
"sc_images/room/at_icon_room_settig_bg.png");
|
||
|
||
// 测试Store页面购物袋图标(马甲包使用相同图标)
|
||
expect(strategy.getStorePageShoppingBagIcon(),
|
||
"sc_images/store/at_icon_shop_bag.png");
|
||
|
||
// 测试Store页面购物袋图标外边距(马甲包保持相同外边距)
|
||
final shoppingBagMargin = strategy.getStorePageShoppingBagMargin();
|
||
expect(shoppingBagMargin, isA<EdgeInsetsDirectional>());
|
||
expect(shoppingBagMargin.end, 10.0);
|
||
|
||
// 测试Store页面Tab标签内边距(马甲包保持相同内边距)
|
||
final tabLabelPadding = strategy.getStorePageTabLabelPadding();
|
||
expect(tabLabelPadding, isA<EdgeInsets>());
|
||
expect(tabLabelPadding.left, 12.0);
|
||
expect(tabLabelPadding.end, 12.0);
|
||
|
||
// 测试Store页面Tab标签选中文本样式(马甲包使用主题色)
|
||
final selectedTabStyle = strategy.getStorePageTabLabelStyle();
|
||
expect(selectedTabStyle, isA<TextStyle>());
|
||
expect(selectedTabStyle.fontSize, 15.0);
|
||
expect(selectedTabStyle.color, const Color(0xffFF5722)); // 马甲包主题橙色
|
||
expect(selectedTabStyle.fontWeight, FontWeight.w600);
|
||
|
||
// 测试Store页面Tab标签未选中文本样式(马甲包使用灰色)
|
||
final unselectedTabStyle = strategy.getStorePageTabUnselectedLabelStyle();
|
||
expect(unselectedTabStyle, isA<TextStyle>());
|
||
expect(unselectedTabStyle.fontSize, 13.0);
|
||
expect(unselectedTabStyle.color, const Color(0xff757575)); // 马甲包灰色
|
||
expect(unselectedTabStyle.fontWeight, FontWeight.w500);
|
||
|
||
// 测试Store页面Tab指示器颜色(马甲包使用主题色)
|
||
expect(strategy.getStorePageTabIndicatorColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题橙色
|
||
|
||
// 测试Store页面Tab分割线颜色(马甲包保持透明)
|
||
expect(strategy.getStorePageTabDividerColor(), Colors.transparent);
|
||
|
||
// 测试Store页面底部Divider颜色(马甲包使用浅灰色)
|
||
expect(strategy.getStorePageBottomDividerColor(),
|
||
const Color(0xffEEEEEE)); // 浅灰色,替代Colors.black12
|
||
|
||
// 测试Store页面底部Divider厚度(马甲包保持相同)
|
||
expect(strategy.getStorePageBottomDividerThickness(), 0.5);
|
||
|
||
// 测试Store页面底部Divider高度(马甲包保持相同)
|
||
expect(strategy.getStorePageBottomDividerHeight(), 24.0);
|
||
|
||
// 测试Store页面金币图标(马甲包使用相同图标)
|
||
expect(strategy.getStorePageGoldIcon(),
|
||
"sc_images/general/at_icon_jb.png");
|
||
|
||
// 测试Store页面金币文本颜色(马甲包使用主题色)
|
||
expect(strategy.getStorePageGoldTextColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题橙色
|
||
|
||
// 测试Store页面金币图标颜色(马甲包使用主题色)
|
||
expect(strategy.getStorePageGoldIconColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题橙色
|
||
});
|
||
|
||
test('Variant1 store item test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试Store商品项背景颜色(马甲包使用表面色)
|
||
expect(strategy.getStoreItemBackgroundColor(),
|
||
const Color(0xffffffff)); // SocialChatTheme.surfaceColor - 白色
|
||
|
||
// 测试Store商品项未选中边框颜色(马甲包使用浅灰色)
|
||
expect(strategy.getStoreItemUnselectedBorderColor(),
|
||
const Color(0xffE0E0E0)); // 浅灰色,替代Colors.black12
|
||
|
||
// 测试Store商品项选中边框颜色(马甲包使用主题色)
|
||
expect(strategy.getStoreItemSelectedBorderColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题橙色
|
||
|
||
// 测试Store商品项金币图标(马甲包使用相同图标)
|
||
expect(strategy.getStoreItemGoldIcon(),
|
||
"sc_images/general/at_icon_jb.png");
|
||
|
||
// 测试Store商品项价格文本颜色(马甲包使用主要文本颜色)
|
||
expect(strategy.getStoreItemPriceTextColor(),
|
||
const Color(0xff212121)); // SocialChatTheme.textPrimary - 深灰色
|
||
|
||
// 测试Store商品项购买按钮背景颜色(马甲包使用主题色)
|
||
expect(strategy.getStoreItemBuyButtonColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题橙色
|
||
|
||
// 测试Store商品项购买按钮文本颜色(马甲包使用主色上的文本颜色)
|
||
expect(strategy.getStoreItemBuyButtonTextColor(),
|
||
const Color(0xffffffff)); // SocialChatTheme.textOnPrimary - 白色
|
||
|
||
// 测试Store商品项操作图标(马甲包使用相同图标)
|
||
expect(strategy.getStoreItemActionIcon('headdress'),
|
||
"sc_images/store/at_icon_shop_item_search.png");
|
||
expect(strategy.getStoreItemActionIcon('mountains'),
|
||
"sc_images/store/at_icon_shop_item_play.png");
|
||
expect(strategy.getStoreItemActionIcon('chatbox'),
|
||
"sc_images/store/at_icon_shop_item_search.png");
|
||
expect(strategy.getStoreItemActionIcon('theme'),
|
||
"sc_images/store/at_icon_store_theme_rev.png");
|
||
expect(strategy.getStoreItemActionIcon('unknown'), "sc_images/store/at_icon_store_theme_rev.png");
|
||
});
|
||
});
|
||
|
||
group('Voice Room Page Strategy Tests', () {
|
||
test('Voice room test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试语音房间页面背景颜色
|
||
expect(strategy.getVoiceRoomBackgroundColor(), Colors.transparent);
|
||
|
||
// 测试语音房间页面Tab标签选中颜色
|
||
expect(strategy.getVoiceRoomTabLabelColor(), Colors.white);
|
||
|
||
// 测试语音房间页面Tab标签未选中颜色
|
||
expect(strategy.getVoiceRoomTabUnselectedLabelColor(), Colors.white54);
|
||
|
||
// 测试语音房间页面Tab指示器颜色
|
||
expect(strategy.getVoiceRoomTabIndicatorColor(), Colors.transparent);
|
||
|
||
// 测试语音房间页面Tab分割线颜色
|
||
expect(strategy.getVoiceRoomTabDividerColor(), Colors.transparent);
|
||
|
||
// 测试语音房间页面Tab标签内边距
|
||
final tabLabelPadding = strategy.getVoiceRoomTabLabelPadding();
|
||
expect(tabLabelPadding, isA<EdgeInsets>());
|
||
expect(tabLabelPadding.left, 12.0);
|
||
expect(tabLabelPadding.end, 12.0);
|
||
|
||
// 测试语音房间页面聊天容器外边距
|
||
final chatContainerMargin = strategy.getVoiceRoomChatContainerMargin();
|
||
expect(chatContainerMargin, isA<EdgeInsets>());
|
||
expect(chatContainerMargin.right, 52.0);
|
||
|
||
// 测试语音房间页面Tab标签选中文本样式
|
||
final selectedTabStyle = strategy.getVoiceRoomTabLabelStyle();
|
||
expect(selectedTabStyle, isA<TextStyle>());
|
||
expect(selectedTabStyle.fontSize, 15.0);
|
||
expect(selectedTabStyle.fontFamily, "MyCustomFont");
|
||
|
||
// 测试语音房间页面Tab标签未选中文本样式
|
||
final unselectedTabStyle = strategy.getVoiceRoomTabUnselectedLabelStyle();
|
||
expect(unselectedTabStyle, isA<TextStyle>());
|
||
expect(unselectedTabStyle.fontSize, 13.0);
|
||
expect(unselectedTabStyle.fontFamily, "MyCustomFont");
|
||
|
||
// 测试语音房间默认背景图像路径
|
||
expect(strategy.getVoiceRoomDefaultBackgroundImage(),
|
||
"sc_images/room/at_icon_room_defaut_bg.png");
|
||
});
|
||
|
||
test('Variant1 voice room test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试马甲包语音房间页面背景颜色(深灰色)
|
||
expect(strategy.getVoiceRoomBackgroundColor(),
|
||
const Color(0xff1a1a1a));
|
||
|
||
// 测试马甲包语音房间页面Tab标签选中颜色(浅灰色)
|
||
expect(strategy.getVoiceRoomTabLabelColor(),
|
||
const Color(0xffe6e6e6));
|
||
|
||
// 测试马甲包语音房间页面Tab标签未选中颜色(灰色)
|
||
expect(strategy.getVoiceRoomTabUnselectedLabelColor(),
|
||
const Color(0xff999999));
|
||
|
||
// 测试马甲包语音房间页面Tab指示器颜色(马甲包主题色)
|
||
expect(strategy.getVoiceRoomTabIndicatorColor(),
|
||
const Color(0xffFF5722));
|
||
|
||
// 测试马甲包语音房间页面Tab分割线颜色(透明)
|
||
expect(strategy.getVoiceRoomTabDividerColor(), Colors.transparent);
|
||
|
||
// 测试马甲包语音房间页面Tab标签内边距(与原始应用相同)
|
||
final tabLabelPadding = strategy.getVoiceRoomTabLabelPadding();
|
||
expect(tabLabelPadding, isA<EdgeInsets>());
|
||
expect(tabLabelPadding.left, 12.0);
|
||
expect(tabLabelPadding.end, 12.0);
|
||
|
||
// 测试马甲包语音房间页面聊天容器外边距(与原始应用相同)
|
||
final chatContainerMargin = strategy.getVoiceRoomChatContainerMargin();
|
||
expect(chatContainerMargin, isA<EdgeInsets>());
|
||
expect(chatContainerMargin.end, 52.0);
|
||
|
||
// 测试马甲包语音房间页面Tab标签选中文本样式(与原始应用相同)
|
||
final selectedTabStyle = strategy.getVoiceRoomTabLabelStyle();
|
||
expect(selectedTabStyle, isA<TextStyle>());
|
||
expect(selectedTabStyle.fontSize, 15.0);
|
||
expect(selectedTabStyle.fontFamily, "MyCustomFont");
|
||
|
||
// 测试马甲包语音房间页面Tab标签未选中文本样式(与原始应用相同)
|
||
final unselectedTabStyle = strategy.getVoiceRoomTabUnselectedLabelStyle();
|
||
expect(unselectedTabStyle, isA<TextStyle>());
|
||
expect(unselectedTabStyle.fontSize, 13.0);
|
||
expect(unselectedTabStyle.fontFamily, "MyCustomFont");
|
||
|
||
// 测试马甲包语音房间默认背景图像路径(与原始应用相同)
|
||
expect(strategy.getVoiceRoomDefaultBackgroundImage(),
|
||
"sc_images/room/at_icon_room_defaut_bg.png");
|
||
});
|
||
});
|
||
|
||
group('Recharge Page Strategy Tests', () {
|
||
test('Recharge page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试充值页面背景图片
|
||
expect(strategy.getRechargePageBackgroundImage(),
|
||
"sc_images/room/at_icon_room_settig_bg.png");
|
||
|
||
// 测试充值页面Scaffold背景颜色
|
||
expect(strategy.getRechargePageScaffoldBackgroundColor(), Colors.transparent);
|
||
|
||
// 测试充值页面对话框屏障颜色
|
||
expect(strategy.getRechargePageDialogBarrierColor(), Colors.transparent);
|
||
|
||
// 测试充值页面对话框容器背景颜色
|
||
expect(strategy.getRechargePageDialogContainerBackgroundColor(), Colors.white30);
|
||
|
||
// 测试充值页面对话框文本颜色
|
||
expect(strategy.getRechargePageDialogTextColor(), Colors.black38);
|
||
|
||
// 测试充值页面主容器背景颜色
|
||
expect(strategy.getRechargePageMainContainerBackgroundColor(), Colors.white);
|
||
|
||
// 测试充值页面按钮背景颜色
|
||
expect(strategy.getRechargePageButtonBackgroundColor(),
|
||
const Color(0xFFE6F7FF)); // 近似主题浅色
|
||
|
||
// 测试充值页面按钮文本颜色
|
||
expect(strategy.getRechargePageButtonTextColor(), Colors.white);
|
||
|
||
// 测试充值页面钱包背景图像路径
|
||
expect(strategy.getRechargePageWalletBackgroundImage(),
|
||
"sc_images/index/at_icon_wallet_bg.png");
|
||
|
||
// 测试充值页面钱包图标路径
|
||
expect(strategy.getRechargePageWalletIcon(),
|
||
"sc_images/index/at_icon_wallet_icon.png");
|
||
|
||
// 测试充值页面钱包文本颜色
|
||
expect(strategy.getRechargePageWalletTextColor(), Colors.white);
|
||
|
||
// 测试充值页面金币图标路径(默认图标)
|
||
expect(strategy.getRechargePageGoldIcon(),
|
||
"sc_images/general/at_icon_jb.png");
|
||
|
||
// 测试充值页面选中项背景颜色
|
||
expect(strategy.getRechargePageSelectedItemBackgroundColor(),
|
||
const Color(0xFFE6F7FF)); // 近似主题浅色
|
||
|
||
// 测试充值页面选中项边框颜色
|
||
expect(strategy.getRechargePageSelectedItemBorderColor(),
|
||
const Color(0xFF1890FF)); // 近似主题主色
|
||
|
||
// 测试充值页面未选中项边框颜色
|
||
expect(strategy.getRechargePageUnselectedItemBorderColor(),
|
||
const Color(0xffE6E6E6));
|
||
|
||
// 测试充值页面未选中项背景颜色
|
||
expect(strategy.getRechargePageUnselectedItemBackgroundColor(), Colors.white);
|
||
|
||
// 测试充值页面项目文本颜色
|
||
expect(strategy.getRechargePageItemTextColor(), Colors.black54);
|
||
|
||
// 测试充值页面价格文本颜色
|
||
expect(strategy.getRechargePageItemPriceTextColor(), Colors.black);
|
||
|
||
// 测试根据索引获取充值页面金币图标路径
|
||
expect(strategy.getRechargePageGoldIconByIndex(0),
|
||
"sc_images/general/at_icon_jb.png");
|
||
expect(strategy.getRechargePageGoldIconByIndex(1),
|
||
"sc_images/general/at_icon_jb2.png");
|
||
expect(strategy.getRechargePageGoldIconByIndex(2),
|
||
"sc_images/general/at_icon_jb3.png");
|
||
expect(strategy.getRechargePageGoldIconByIndex(99),
|
||
"sc_images/general/at_icon_jb.png"); // 默认图标
|
||
|
||
// 测试充值页面记录图标路径
|
||
expect(strategy.getRechargePageRecordIcon(),
|
||
"sc_images/index/at_icon_recharge_recod.png");
|
||
|
||
// 测试充值页面Apple产品项背景颜色
|
||
expect(strategy.getRechargePageAppleItemBackgroundColor(), Colors.white);
|
||
});
|
||
|
||
test('Variant1 recharge page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试充值页面背景图片(马甲包使用相同图片)
|
||
expect(strategy.getRechargePageBackgroundImage(),
|
||
"sc_images/room/at_icon_room_settig_bg.png");
|
||
|
||
// 测试充值页面Scaffold背景颜色(马甲包使用深灰色)
|
||
expect(strategy.getRechargePageScaffoldBackgroundColor(),
|
||
const Color(0xff1a1a1a)); // #1a1a1a
|
||
|
||
// 测试充值页面对话框屏障颜色(马甲包使用深灰色半透明)
|
||
expect(strategy.getRechargePageDialogBarrierColor(),
|
||
const Color(0xCC1a1a1a)); // withOpacity(0.8)
|
||
|
||
// 测试充值页面对话框容器背景颜色(马甲包使用深灰色)
|
||
expect(strategy.getRechargePageDialogContainerBackgroundColor(),
|
||
const Color(0xff333333)); // 深灰色
|
||
|
||
// 测试充值页面对话框文本颜色(马甲包使用浅灰色)
|
||
expect(strategy.getRechargePageDialogTextColor(),
|
||
const Color(0xffe6e6e6)); // #e6e6e6
|
||
|
||
// 测试充值页面主容器背景颜色(马甲包使用深灰色)
|
||
expect(strategy.getRechargePageMainContainerBackgroundColor(),
|
||
const Color(0xff1a1a1a)); // #1a1a1a
|
||
|
||
// 测试充值页面按钮背景颜色(马甲包使用主题色)
|
||
expect(strategy.getRechargePageButtonBackgroundColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题色
|
||
|
||
// 测试充值页面按钮文本颜色(马甲包使用白色,与原始应用相同)
|
||
expect(strategy.getRechargePageButtonTextColor(), Colors.white);
|
||
|
||
// 测试充值页面钱包背景图像路径(马甲包使用相同图片)
|
||
expect(strategy.getRechargePageWalletBackgroundImage(),
|
||
"sc_images/index/at_icon_wallet_bg.png");
|
||
|
||
// 测试充值页面钱包图标路径(马甲包使用相同图标)
|
||
expect(strategy.getRechargePageWalletIcon(),
|
||
"sc_images/index/at_icon_wallet_icon.png");
|
||
|
||
// 测试充值页面钱包文本颜色(马甲包使用浅灰色)
|
||
expect(strategy.getRechargePageWalletTextColor(),
|
||
const Color(0xffe6e6e6)); // #e6e6e6
|
||
|
||
// 测试充值页面金币图标路径(马甲包使用相同图标)
|
||
expect(strategy.getRechargePageGoldIcon(),
|
||
"sc_images/general/at_icon_jb.png");
|
||
|
||
// 测试充值页面选中项背景颜色(马甲包使用主题色半透明)
|
||
expect(strategy.getRechargePageSelectedItemBackgroundColor(),
|
||
const Color(0x33FF5722)); // withOpacity(0.2)
|
||
|
||
// 测试充值页面选中项边框颜色(马甲包使用主题色)
|
||
expect(strategy.getRechargePageSelectedItemBorderColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题色
|
||
|
||
// 测试充值页面未选中项边框颜色(马甲包使用深灰色)
|
||
expect(strategy.getRechargePageUnselectedItemBorderColor(),
|
||
const Color(0xff666666)); // 深灰色
|
||
|
||
// 测试充值页面未选中项背景颜色(马甲包使用深灰色)
|
||
expect(strategy.getRechargePageUnselectedItemBackgroundColor(),
|
||
const Color(0xff2a2a2a)); // 深灰色背景
|
||
|
||
// 测试充值页面项目文本颜色(马甲包使用浅灰色)
|
||
expect(strategy.getRechargePageItemTextColor(),
|
||
const Color(0xffe6e6e6)); // #e6e6e6
|
||
|
||
// 测试充值页面价格文本颜色(马甲包使用白色)
|
||
expect(strategy.getRechargePageItemPriceTextColor(), Colors.white);
|
||
|
||
// 测试根据索引获取充值页面金币图标路径(马甲包使用相同图标)
|
||
expect(strategy.getRechargePageGoldIconByIndex(0),
|
||
"sc_images/general/at_icon_jb.png");
|
||
expect(strategy.getRechargePageGoldIconByIndex(1),
|
||
"sc_images/general/at_icon_jb2.png");
|
||
expect(strategy.getRechargePageGoldIconByIndex(2),
|
||
"sc_images/general/at_icon_jb3.png");
|
||
expect(strategy.getRechargePageGoldIconByIndex(99),
|
||
"sc_images/general/at_icon_jb.png"); // 默认图标
|
||
|
||
// 测试充值页面记录图标路径(马甲包使用相同图标)
|
||
expect(strategy.getRechargePageRecordIcon(),
|
||
"sc_images/index/at_icon_recharge_recod.png");
|
||
|
||
// 测试充值页面Apple产品项背景颜色(马甲包使用深灰色)
|
||
expect(strategy.getRechargePageAppleItemBackgroundColor(),
|
||
const Color(0xff2a2a2a)); // 深灰色
|
||
});
|
||
});
|
||
|
||
group('Dynamic Page Strategy Tests', () {
|
||
test('Dynamic page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试动态页面背景图像路径
|
||
expect(strategy.getDynamicPageBackgroundImage(),
|
||
"sc_images/index/at_icon_index_mask.png");
|
||
|
||
// 测试动态页面Scaffold背景颜色
|
||
expect(strategy.getDynamicPageScaffoldBackgroundColor(), Colors.transparent);
|
||
|
||
// 测试动态页面AppBar背景颜色
|
||
expect(strategy.getDynamicPageAppBarBackgroundColor(), Colors.transparent);
|
||
|
||
// 测试动态页面Tab标签选中颜色
|
||
expect(strategy.getDynamicPageTabLabelColor(), Colors.black87);
|
||
|
||
// 测试动态页面Tab标签未选中颜色
|
||
expect(strategy.getDynamicPageTabUnselectedLabelColor(), Colors.black38);
|
||
|
||
// 测试动态页面Tab指示器颜色
|
||
expect(strategy.getDynamicPageTabIndicatorColor(), Colors.transparent);
|
||
|
||
// 测试动态页面Tab分割线颜色
|
||
expect(strategy.getDynamicPageTabDividerColor(), Colors.transparent);
|
||
|
||
// 测试动态页面添加动态按钮图标路径
|
||
expect(strategy.getDynamicPageAddButtonIcon(),
|
||
"sc_images/dynamic/at_icon_add_dynamic_btn.png");
|
||
|
||
// 测试动态页面Tab标签是否可滚动
|
||
expect(strategy.shouldDynamicPageTabScrollable(), true);
|
||
|
||
// 测试动态页面Tab标签选中文本样式
|
||
expect(strategy.getDynamicPageTabLabelStyle(),
|
||
const TextStyle(
|
||
fontWeight: FontWeight.bold,
|
||
fontSize: 16,
|
||
));
|
||
|
||
// 测试动态页面Tab标签未选中文本样式
|
||
expect(strategy.getDynamicPageTabUnselectedLabelStyle(),
|
||
const TextStyle(
|
||
fontWeight: FontWeight.normal,
|
||
fontSize: 15,
|
||
));
|
||
});
|
||
|
||
test('Variant1 dynamic page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试动态页面背景图像路径(马甲包使用相同图片)
|
||
expect(strategy.getDynamicPageBackgroundImage(),
|
||
"sc_images/index/at_icon_index_mask.png");
|
||
|
||
// 测试动态页面Scaffold背景颜色(马甲包保持透明)
|
||
expect(strategy.getDynamicPageScaffoldBackgroundColor(), Colors.transparent);
|
||
|
||
// 测试动态页面AppBar背景颜色(马甲包保持透明)
|
||
expect(strategy.getDynamicPageAppBarBackgroundColor(), Colors.transparent);
|
||
|
||
// 测试动态页面Tab标签选中颜色(马甲包使用主要文本颜色)
|
||
expect(strategy.getDynamicPageTabLabelColor(),
|
||
const Color(0xff212121)); // SocialChatTheme.textPrimary
|
||
|
||
// 测试动态页面Tab标签未选中颜色(马甲包使用次要文本颜色)
|
||
expect(strategy.getDynamicPageTabUnselectedLabelColor(),
|
||
const Color(0xff757575)); // SocialChatTheme.textSecondary
|
||
|
||
// 测试动态页面Tab指示器颜色(马甲包使用主题色)
|
||
expect(strategy.getDynamicPageTabIndicatorColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题色
|
||
|
||
// 测试动态页面Tab分割线颜色(马甲包保持透明)
|
||
expect(strategy.getDynamicPageTabDividerColor(), Colors.transparent);
|
||
|
||
// 测试动态页面添加动态按钮图标路径(马甲包使用相同图标)
|
||
expect(strategy.getDynamicPageAddButtonIcon(),
|
||
"sc_images/dynamic/at_icon_add_dynamic_btn.png");
|
||
|
||
// 测试动态页面Tab标签是否可滚动(马甲包保持相同行为)
|
||
expect(strategy.shouldDynamicPageTabScrollable(), true);
|
||
|
||
// 测试动态页面Tab标签选中文本样式(马甲包应用主题颜色)
|
||
expect(strategy.getDynamicPageTabLabelStyle(),
|
||
const TextStyle(
|
||
fontWeight: FontWeight.bold,
|
||
fontSize: 16,
|
||
color: Color(0xff212121), // SocialChatTheme.textPrimary
|
||
));
|
||
|
||
// 测试动态页面Tab标签未选中文本样式(马甲包应用主题颜色)
|
||
expect(strategy.getDynamicPageTabUnselectedLabelStyle(),
|
||
const TextStyle(
|
||
fontWeight: FontWeight.normal,
|
||
fontSize: 15,
|
||
color: Color(0xff757575), // SocialChatTheme.textSecondary
|
||
));
|
||
});
|
||
});
|
||
|
||
group('Splash Page Strategy Tests', () {
|
||
test('Splash page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试启动页面背景图像路径
|
||
expect(strategy.getSplashPageBackgroundImage(), "sc_images/splash/splash.png");
|
||
|
||
// 测试启动页面图标路径
|
||
expect(strategy.getSplashPageIcon(), "sc_images/splash/at_icon_splash_icon.png");
|
||
|
||
// 测试启动页面跳过按钮背景图像路径
|
||
expect(strategy.getSplashPageSkipButtonBackground(),
|
||
"sc_images/splash/at_icon_splash_skip_bg.png");
|
||
|
||
// 测试启动页面跳过按钮文本颜色
|
||
expect(strategy.getSplashPageSkipButtonTextColor(), Colors.white);
|
||
|
||
// 测试启动页面游戏名称背景图像路径
|
||
expect(strategy.getSplashPageKingGamesNameBackground(),
|
||
"sc_images/index/at_icon_splash_king_games_name_bg.png");
|
||
|
||
// 测试启动页面游戏名称文本颜色
|
||
expect(strategy.getSplashPageKingGamesTextColor(), Colors.white);
|
||
|
||
// 测试启动页面CP名称背景图像路径
|
||
expect(strategy.getSplashPageCpNameBackground(),
|
||
"sc_images/index/at_icon_splash_cp_name_bg.png");
|
||
|
||
// 测试启动页面CP名称文本颜色
|
||
expect(strategy.getSplashPageCpTextColor(), Colors.white);
|
||
});
|
||
|
||
test('Variant1 splash page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试启动页面背景图像路径(马甲包目前使用相同图像)
|
||
expect(strategy.getSplashPageBackgroundImage(), "sc_images/splash/splash.png");
|
||
|
||
// 测试启动页面图标路径(马甲包目前使用相同图标)
|
||
expect(strategy.getSplashPageIcon(), "sc_images/splash/at_icon_splash_icon.png");
|
||
|
||
// 测试启动页面跳过按钮背景图像路径(马甲包目前使用相同图像)
|
||
expect(strategy.getSplashPageSkipButtonBackground(),
|
||
"sc_images/splash/at_icon_splash_skip_bg.png");
|
||
|
||
// 测试启动页面跳过按钮文本颜色(马甲包使用主色上的文本颜色)
|
||
expect(strategy.getSplashPageSkipButtonTextColor(), isA<Color>());
|
||
|
||
// 测试启动页面游戏名称背景图像路径(马甲包目前使用相同图像)
|
||
expect(strategy.getSplashPageKingGamesNameBackground(),
|
||
"sc_images/index/at_icon_splash_king_games_name_bg.png");
|
||
|
||
// 测试启动页面游戏名称文本颜色(马甲包使用主色上的文本颜色)
|
||
expect(strategy.getSplashPageKingGamesTextColor(), isA<Color>());
|
||
|
||
// 测试启动页面CP名称背景图像路径(马甲包目前使用相同图像)
|
||
expect(strategy.getSplashPageCpNameBackground(),
|
||
"sc_images/index/at_icon_splash_cp_name_bg.png");
|
||
|
||
// 测试启动页面CP名称文本颜色(马甲包使用主色上的文本颜色)
|
||
expect(strategy.getSplashPageCpTextColor(), isA<Color>());
|
||
});
|
||
|
||
});
|
||
|
||
group('WebView Page Strategy Tests', () {
|
||
test('Webview page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试WebView页面AppBar背景颜色
|
||
expect(strategy.getWebViewPageAppBarBackgroundColor(), Colors.white);
|
||
|
||
// 测试WebView页面标题文本颜色
|
||
expect(strategy.getWebViewPageTitleTextColor(), const Color(0xff333333));
|
||
|
||
// 测试WebView页面返回箭头图标颜色
|
||
expect(strategy.getWebViewPageBackArrowColor(), const Color(0xff333333));
|
||
|
||
// 测试WebView页面进度条背景颜色
|
||
expect(strategy.getWebViewPageProgressBarBackgroundColor(), Colors.white70.withOpacity(0));
|
||
|
||
// 测试WebView页面进度条活动颜色
|
||
expect(strategy.getWebViewPageProgressBarActiveColor(), const Color(0xffFF6000));
|
||
|
||
// 测试游戏WebView页面关闭图标颜色
|
||
expect(strategy.getGameWebViewCloseIconColor(), Colors.white);
|
||
|
||
// 测试游戏WebView页面Scaffold背景颜色
|
||
expect(strategy.getGameWebViewScaffoldBackgroundColor(), Colors.transparent);
|
||
|
||
// 测试游戏WebView页面加载指示器颜色
|
||
expect(strategy.getGameWebViewLoadingIndicatorColor(), const Color(0xffFF6000));
|
||
|
||
// 测试游戏WebView页面进度条背景颜色
|
||
expect(strategy.getGameWebViewProgressBarBackgroundColor(), Colors.white70.withOpacity(0));
|
||
});
|
||
|
||
test('Variant1 webview page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试WebView页面AppBar背景颜色(马甲包使用背景颜色)
|
||
expect(strategy.getWebViewPageAppBarBackgroundColor(), isA<Color>());
|
||
|
||
// 测试WebView页面标题文本颜色(马甲包使用主要文本颜色)
|
||
expect(strategy.getWebViewPageTitleTextColor(), isA<Color>());
|
||
|
||
// 测试WebView页面返回箭头图标颜色(马甲包使用主要文本颜色)
|
||
expect(strategy.getWebViewPageBackArrowColor(), isA<Color>());
|
||
|
||
// 测试WebView页面进度条背景颜色(马甲包使用透明背景)
|
||
expect(strategy.getWebViewPageProgressBarBackgroundColor(), Colors.transparent);
|
||
|
||
// 测试WebView页面进度条活动颜色(马甲包使用主题色)
|
||
expect(strategy.getWebViewPageProgressBarActiveColor(), isA<Color>());
|
||
|
||
// 测试游戏WebView页面关闭图标颜色(马甲包使用主要文本颜色)
|
||
expect(strategy.getGameWebViewCloseIconColor(), isA<Color>());
|
||
|
||
// 测试游戏WebView页面Scaffold背景颜色(马甲包使用背景颜色)
|
||
expect(strategy.getGameWebViewScaffoldBackgroundColor(), isA<Color>());
|
||
|
||
// 测试游戏WebView页面进度条背景颜色(马甲包使用背景颜色半透明)
|
||
expect(strategy.getGameWebViewProgressBarBackgroundColor(), isA<Color>());
|
||
|
||
// 测试游戏WebView页面加载指示器颜色(马甲包使用主题色)
|
||
expect(strategy.getGameWebViewLoadingIndicatorColor(), isA<Color>());
|
||
});
|
||
});
|
||
|
||
group('Search Page Strategy Tests', () {
|
||
test('Search page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试搜索页面Scaffold背景颜色
|
||
expect(strategy.getSearchPageScaffoldBackgroundColor(), Colors.white);
|
||
|
||
// 测试搜索页面返回图标颜色
|
||
expect(strategy.getSearchPageBackIconColor(), const Color(0xffBBBBBB));
|
||
|
||
// 测试搜索页面输入框边框颜色
|
||
expect(strategy.getSearchPageInputBorderColor(), Colors.transparent);
|
||
|
||
// 测试搜索页面输入框文本颜色
|
||
expect(strategy.getSearchPageInputTextColor(), Colors.grey);
|
||
|
||
// 测试搜索页面按钮文本颜色
|
||
expect(strategy.getSearchPageButtonTextColor(), Colors.black);
|
||
|
||
// 测试搜索页面按钮渐变颜色
|
||
final buttonGradient = strategy.getSearchPageButtonGradient();
|
||
expect(buttonGradient, isA<List<Color>>());
|
||
expect(buttonGradient.length, 2);
|
||
expect(buttonGradient[0], Colors.transparent);
|
||
expect(buttonGradient[1], Colors.transparent);
|
||
|
||
// 测试搜索页面搜索结果Tab标签内边距
|
||
final tabLabelPadding = strategy.getSearchPageResultTabLabelPadding();
|
||
expect(tabLabelPadding, isA<EdgeInsets>());
|
||
expect(tabLabelPadding.left, 15.0);
|
||
expect(tabLabelPadding.right, 15.0);
|
||
|
||
// 测试搜索页面搜索结果Tab标签选中颜色
|
||
expect(strategy.getSearchPageResultTabLabelColor(), Colors.black);
|
||
|
||
// 测试搜索页面搜索结果Tab标签未选中颜色
|
||
expect(strategy.getSearchPageResultTabUnselectedLabelColor(), Colors.black26);
|
||
|
||
// 测试搜索页面搜索结果Tab标签未选中文本样式
|
||
final unselectedTabStyle = strategy.getSearchPageResultTabUnselectedLabelStyle();
|
||
expect(unselectedTabStyle, isA<TextStyle>());
|
||
expect(unselectedTabStyle.fontSize, 17.0);
|
||
expect(unselectedTabStyle.fontWeight, FontWeight.w400);
|
||
|
||
// 测试搜索页面搜索结果Tab标签选中文本样式
|
||
final selectedTabStyle = strategy.getSearchPageResultTabLabelStyle();
|
||
expect(selectedTabStyle, isA<TextStyle>());
|
||
expect(selectedTabStyle.fontSize, 18.0);
|
||
expect(selectedTabStyle.fontWeight, FontWeight.w600);
|
||
|
||
// 测试搜索页面搜索结果Tab指示器颜色
|
||
expect(strategy.getSearchPageResultTabIndicatorColor(), isA<LinearGradient>());
|
||
|
||
// 测试搜索页面搜索结果Tab指示器宽度
|
||
expect(strategy.getSearchPageResultTabIndicatorWidth(), 15.0);
|
||
|
||
// 测试搜索页面搜索结果背景颜色
|
||
expect(strategy.getSearchPageResultBackgroundColor(), const Color(0xffFFF8DA));
|
||
|
||
// 测试搜索页面历史项背景颜色
|
||
expect(strategy.getSearchPageHistoryItemBackgroundColor(), const Color(0xffFF9500));
|
||
|
||
// 测试搜索页面历史项文本颜色
|
||
expect(strategy.getSearchPageHistoryItemTextColor(), Colors.white);
|
||
|
||
// 测试搜索页面清空历史图标路径
|
||
expect(strategy.getSearchPageClearHistoryIcon(),
|
||
"sc_images/general/at_icon_delete.png");
|
||
|
||
// 测试搜索页面空数据图标路径
|
||
expect(strategy.getSearchPageEmptyDataIcon(),
|
||
"sc_images/room/at_icon_room_defaut_bg.png");
|
||
});
|
||
|
||
test('Variant1 search page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试搜索页面Scaffold背景颜色(马甲包使用背景颜色)
|
||
expect(strategy.getSearchPageScaffoldBackgroundColor(),
|
||
const Color(0xfff5f5f5)); // 马甲包背景颜色
|
||
|
||
// 测试搜索页面返回图标颜色(马甲包使用主要文本颜色)
|
||
expect(strategy.getSearchPageBackIconColor(),
|
||
const Color(0xff666666)); // 深灰色
|
||
|
||
// 测试搜索页面输入框边框颜色(马甲包使用主题色)
|
||
expect(strategy.getSearchPageInputBorderColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题色
|
||
|
||
// 测试搜索页面输入框文本颜色(马甲包使用主要文本颜色)
|
||
expect(strategy.getSearchPageInputTextColor(),
|
||
const Color(0xff212121)); // 主要文本颜色
|
||
|
||
// 测试搜索页面按钮文本颜色(马甲包使用主色上的文本颜色)
|
||
expect(strategy.getSearchPageButtonTextColor(),
|
||
Colors.white); // 白色
|
||
|
||
// 测试搜索页面按钮渐变颜色(马甲包使用主题渐变)
|
||
final buttonGradient = strategy.getSearchPageButtonGradient();
|
||
expect(buttonGradient, isA<List<Color>>());
|
||
expect(buttonGradient.length, 2);
|
||
expect(buttonGradient[0], const Color(0xffFF5722).withOpacity(0.8)); // 马甲包主题色,不透明度0.8
|
||
expect(buttonGradient[1], const Color(0xffFF5722).withOpacity(0.6)); // 马甲包主题色,不透明度0.6
|
||
|
||
// 测试搜索页面搜索结果Tab标签内边距(与原始应用相同)
|
||
final tabLabelPadding = strategy.getSearchPageResultTabLabelPadding();
|
||
expect(tabLabelPadding, isA<EdgeInsets>());
|
||
expect(tabLabelPadding.left, 15.0);
|
||
expect(tabLabelPadding.right, 15.0);
|
||
|
||
// 测试搜索页面搜索结果Tab标签选中颜色(马甲包使用主要文本颜色)
|
||
expect(strategy.getSearchPageResultTabLabelColor(),
|
||
const Color(0xff212121)); // 主要文本颜色
|
||
|
||
// 测试搜索页面搜索结果Tab标签未选中颜色(马甲包使用次要文本颜色)
|
||
expect(strategy.getSearchPageResultTabUnselectedLabelColor(),
|
||
const Color(0xff757575)); // 次要文本颜色
|
||
|
||
// 测试搜索页面搜索结果Tab标签未选中文本样式(马甲包使用次要文本颜色)
|
||
final unselectedTabStyle = strategy.getSearchPageResultTabUnselectedLabelStyle();
|
||
expect(unselectedTabStyle, isA<TextStyle>());
|
||
expect(unselectedTabStyle.fontSize, 17.0);
|
||
expect(unselectedTabStyle.fontWeight, FontWeight.w400);
|
||
expect(unselectedTabStyle.color, const Color(0xff757575)); // 次要文本颜色
|
||
|
||
// 测试搜索页面搜索结果Tab标签选中文本样式(马甲包使用主要文本颜色)
|
||
final selectedTabStyle = strategy.getSearchPageResultTabLabelStyle();
|
||
expect(selectedTabStyle, isA<TextStyle>());
|
||
expect(selectedTabStyle.fontSize, 18.0);
|
||
expect(selectedTabStyle.fontWeight, FontWeight.w600);
|
||
expect(selectedTabStyle.color, const Color(0xff212121)); // 主要文本颜色
|
||
|
||
// 测试搜索页面搜索结果Tab指示器颜色(马甲包使用主题色)
|
||
final indicatorGradient = strategy.getSearchPageResultTabIndicatorColor();
|
||
expect(indicatorGradient, isA<LinearGradient>());
|
||
expect(indicatorGradient.colors.length, 2);
|
||
expect(indicatorGradient.colors[0], const Color(0xffFF5722)); // 马甲包主题色
|
||
expect(indicatorGradient.colors[1], const Color(0xffFF9A00)); // 主题色渐变
|
||
|
||
// 测试搜索页面搜索结果Tab指示器宽度(与原始应用相同)
|
||
expect(strategy.getSearchPageResultTabIndicatorWidth(), 15.0);
|
||
|
||
// 测试搜索页面搜索结果背景颜色(马甲包使用浅主题色)
|
||
expect(strategy.getSearchPageResultBackgroundColor(),
|
||
const Color(0xffFFECB3)); // 浅橙色背景
|
||
|
||
// 测试搜索页面历史项背景颜色(马甲包使用主题色)
|
||
expect(strategy.getSearchPageHistoryItemBackgroundColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题色
|
||
|
||
// 测试搜索页面历史项文本颜色(马甲包使用主色上的文本颜色)
|
||
expect(strategy.getSearchPageHistoryItemTextColor(),
|
||
Colors.white); // 白色
|
||
|
||
// 测试搜索页面清空历史图标路径(与原始应用相同)
|
||
expect(strategy.getSearchPageClearHistoryIcon(),
|
||
"sc_images/general/at_icon_delete.png");
|
||
|
||
// 测试搜索页面空数据图标路径(与原始应用相同)
|
||
expect(strategy.getSearchPageEmptyDataIcon(),
|
||
"sc_images/room/at_icon_room_defaut_bg.png");
|
||
});
|
||
});
|
||
|
||
group('Task Page Strategy Tests', () {
|
||
test('Task page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试任务页面背景图片
|
||
expect(strategy.getTaskPageBackgroundImage(),
|
||
"sc_images/room/at_icon_room_settig_bg.png");
|
||
|
||
// 测试任务页面返回按钮颜色
|
||
expect(strategy.getTaskPageBackButtonColor(), Colors.black);
|
||
|
||
// 测试任务页面Scaffold背景颜色
|
||
expect(strategy.getTaskPageScaffoldBackgroundColor(), Colors.white);
|
||
|
||
// 测试任务页面容器背景颜色
|
||
expect(strategy.getTaskPageContainerBackgroundColor(), Colors.white);
|
||
|
||
// 测试任务页面边框颜色
|
||
expect(strategy.getTaskPageBorderColor(), const Color(0xffE6E6E6));
|
||
|
||
// 测试任务页面特殊边框颜色
|
||
expect(strategy.getTaskPageSpecialBorderColor(), const Color(0xffBB92FF));
|
||
|
||
// 测试任务页面主要文本颜色
|
||
expect(strategy.getTaskPagePrimaryTextColor(), Colors.white);
|
||
|
||
// 测试任务页面金币文本颜色
|
||
expect(strategy.getTaskPageGoldTextColor(), const Color(0xffFFB627));
|
||
|
||
// 测试任务页面经验文本颜色
|
||
expect(strategy.getTaskPageExpTextColor(), const Color(0xff52FF90));
|
||
|
||
// 测试任务页面主题颜色
|
||
expect(strategy.getTaskPageThemeColor(), SocialChatTheme.primaryColor);
|
||
|
||
// 测试任务页面主题浅色
|
||
expect(strategy.getTaskPageThemeLightColor(), SocialChatTheme.primaryLight);
|
||
|
||
// 测试任务页面可领取按钮渐变颜色
|
||
final receivableGradient = strategy.getTaskPageReceivableButtonGradient();
|
||
expect(receivableGradient, isA<List<Color>>());
|
||
expect(receivableGradient.length, 2);
|
||
expect(receivableGradient[0], const Color(0xffBB92FF));
|
||
expect(receivableGradient[1], const Color(0xff8B45FF));
|
||
|
||
// 测试任务页面已完成按钮渐变颜色
|
||
final completedGradient = strategy.getTaskPageCompletedButtonGradient();
|
||
expect(completedGradient, isA<List<Color>>());
|
||
expect(completedGradient.length, 2);
|
||
expect(completedGradient[0], const Color(0xffDADADA));
|
||
expect(completedGradient[1], const Color(0xff585859));
|
||
|
||
// 测试任务页面按钮文本颜色
|
||
expect(strategy.getTaskPageButtonTextColor(), Colors.white);
|
||
|
||
// 测试任务页面蒙版颜色
|
||
expect(strategy.getTaskPageMaskColor(), Colors.black);
|
||
|
||
// 测试任务页面头部背景图片
|
||
expect(strategy.getTaskPageHeadBackgroundImage(),
|
||
"sc_images/index/at_icon_task_head_bg.png");
|
||
|
||
// 测试任务页面金币图标
|
||
expect(strategy.getTaskPageGoldIcon(),
|
||
"sc_images/general/at_icon_jb.png");
|
||
|
||
// 测试任务页面经验图标
|
||
expect(strategy.getTaskPageExpIcon(),
|
||
"sc_images/index/at_icon_task_exp.png");
|
||
|
||
// 测试任务页面邀请奖励背景图片
|
||
expect(strategy.getTaskPageInvitationRewardBackgroundImage(),
|
||
"sc_images/index/at_icon_invitation_bg.png");
|
||
|
||
// 测试任务页面礼物袋文本颜色
|
||
expect(strategy.getTaskPageGiftBagTextColor(), Colors.white);
|
||
|
||
// 测试任务页面AppBar背景颜色
|
||
expect(strategy.getTaskPageAppBarBackgroundColor(), Colors.transparent);
|
||
|
||
// 测试任务页面透明容器颜色
|
||
expect(strategy.getTaskPageTransparentContainerColor(), Colors.transparent);
|
||
});
|
||
|
||
test('Variant1 task page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试任务页面背景图片(马甲包使用相同图片)
|
||
expect(strategy.getTaskPageBackgroundImage(),
|
||
"sc_images/room/at_icon_room_settig_bg.png");
|
||
|
||
// 测试任务页面返回按钮颜色(马甲包使用主要文本颜色)
|
||
expect(strategy.getTaskPageBackButtonColor(),
|
||
const Color(0xff212121)); // SocialChatTheme.textPrimary
|
||
|
||
// 测试任务页面Scaffold背景颜色(马甲包使用背景颜色)
|
||
expect(strategy.getTaskPageScaffoldBackgroundColor(),
|
||
const Color(0xfff5f5f5)); // 马甲包背景颜色
|
||
|
||
// 测试任务页面容器背景颜色(马甲包使用表面颜色)
|
||
expect(strategy.getTaskPageContainerBackgroundColor(),
|
||
const Color(0xffffffff)); // SocialChatTheme.surfaceColor
|
||
|
||
// 测试任务页面边框颜色(马甲包使用边框颜色)
|
||
expect(strategy.getTaskPageBorderColor(),
|
||
const Color(0xffE0E0E0)); // SocialChatTheme.borderColor
|
||
|
||
// 测试任务页面特殊边框颜色(马甲包使用主题色)
|
||
expect(strategy.getTaskPageSpecialBorderColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题色
|
||
|
||
// 测试任务页面主要文本颜色(马甲包使用主要文本颜色)
|
||
expect(strategy.getTaskPagePrimaryTextColor(),
|
||
const Color(0xff212121)); // SocialChatTheme.textPrimary
|
||
|
||
// 测试任务页面金币文本颜色(马甲包使用主题色)
|
||
expect(strategy.getTaskPageGoldTextColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题色
|
||
|
||
// 测试任务页面经验文本颜色(马甲包使用成功颜色)
|
||
expect(strategy.getTaskPageExpTextColor(),
|
||
const Color(0xff4CAF50)); // SocialChatTheme.successColor
|
||
|
||
// 测试任务页面主题颜色(马甲包使用主题色)
|
||
expect(strategy.getTaskPageThemeColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题色
|
||
|
||
// 测试任务页面主题浅色(马甲包使用主题浅色)
|
||
expect(strategy.getTaskPageThemeLightColor(),
|
||
const Color(0xffFF9500)); // 马甲包主题浅色
|
||
|
||
// 测试任务页面可领取按钮渐变颜色(马甲包使用主题渐变)
|
||
final receivableGradient = strategy.getTaskPageReceivableButtonGradient();
|
||
expect(receivableGradient, isA<List<Color>>());
|
||
expect(receivableGradient.length, 2);
|
||
expect(receivableGradient[0], const Color(0xffFF5722)); // 马甲包主题色
|
||
expect(receivableGradient[1], const Color(0xffFF9A00)); // 主题色渐变
|
||
|
||
// 测试任务页面已完成按钮渐变颜色(马甲包使用灰色渐变)
|
||
final completedGradient = strategy.getTaskPageCompletedButtonGradient();
|
||
expect(completedGradient, isA<List<Color>>());
|
||
expect(completedGradient.length, 2);
|
||
expect(completedGradient[0], const Color(0xffCCCCCC)); // 浅灰色
|
||
expect(completedGradient[1], const Color(0xff999999)); // 深灰色
|
||
|
||
// 测试任务页面按钮文本颜色(马甲包使用主色上的文本颜色)
|
||
expect(strategy.getTaskPageButtonTextColor(),
|
||
const Color(0xffffffff)); // SocialChatTheme.textOnPrimary
|
||
|
||
// 测试任务页面蒙版颜色(马甲包使用透明黑色)
|
||
expect(strategy.getTaskPageMaskColor(),
|
||
Colors.black.withOpacity(0.5)); // 半透明黑色
|
||
|
||
// 测试任务页面头部背景图片(马甲包使用相同图片)
|
||
expect(strategy.getTaskPageHeadBackgroundImage(),
|
||
"sc_images/index/at_icon_task_head_bg.png");
|
||
|
||
// 测试任务页面金币图标(马甲包使用相同图标)
|
||
expect(strategy.getTaskPageGoldIcon(),
|
||
"sc_images/general/at_icon_jb.png");
|
||
|
||
// 测试任务页面经验图标(马甲包使用相同图标)
|
||
expect(strategy.getTaskPageExpIcon(),
|
||
"sc_images/index/at_icon_task_exp.png");
|
||
|
||
// 测试任务页面邀请奖励背景图片(马甲包使用相同图片)
|
||
expect(strategy.getTaskPageInvitationRewardBackgroundImage(),
|
||
"sc_images/index/at_icon_invitation_bg.png");
|
||
|
||
// 测试任务页面礼物袋文本颜色(马甲包使用白色)
|
||
expect(strategy.getTaskPageGiftBagTextColor(), Colors.white);
|
||
|
||
// 测试任务页面AppBar背景颜色(马甲包使用透明)
|
||
expect(strategy.getTaskPageAppBarBackgroundColor(), Colors.transparent);
|
||
|
||
// 测试任务页面透明容器颜色(马甲包使用透明)
|
||
expect(strategy.getTaskPageTransparentContainerColor(), Colors.transparent);
|
||
});
|
||
});
|
||
|
||
group('Settings Pages Strategy Tests', () {
|
||
test('Settings page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试设置页面背景图片
|
||
expect(strategy.getSettingsPageBackgroundImage(),
|
||
"sc_images/person/at_icon_edit_userinfo_bg.png");
|
||
|
||
// 测试设置页面次要文本颜色
|
||
expect(strategy.getSettingsPageSecondaryTextColor(), Colors.black38);
|
||
|
||
// 测试设置页面主要容器背景颜色
|
||
expect(strategy.getSettingsPageMainContainerBackgroundColor(), Colors.white);
|
||
|
||
// 测试设置页面主要容器边框颜色
|
||
expect(strategy.getSettingsPageMainContainerBorderColor(),
|
||
const Color(0xffE6E6E6));
|
||
|
||
// 测试设置页面主要文本颜色
|
||
expect(strategy.getSettingsPagePrimaryTextColor(), Colors.black);
|
||
|
||
// 测试设置页面图标颜色
|
||
expect(strategy.getSettingsPageIconColor(), Colors.black26);
|
||
});
|
||
|
||
test('Language page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试语言页面背景图片
|
||
expect(strategy.getLanguagePageBackgroundImage(),
|
||
"sc_images/person/at_icon_edit_userinfo_bg.png");
|
||
|
||
// 测试语言页面主要文本颜色
|
||
expect(strategy.getLanguagePagePrimaryTextColor(), Colors.black);
|
||
|
||
// 测试语言页面复选框活动颜色
|
||
expect(strategy.getLanguagePageCheckboxActiveColor(),
|
||
SocialChatTheme.primaryColor);
|
||
|
||
// 测试语言页面复选框边框颜色
|
||
expect(strategy.getLanguagePageCheckboxBorderColor(),
|
||
const Color(0xffD4D4D4));
|
||
|
||
// 测试语言页面复选框对勾颜色
|
||
expect(strategy.getLanguagePageCheckColor(), Colors.transparent);
|
||
|
||
// 测试语言页面复选框边框圆角
|
||
expect(strategy.getLanguagePageCheckboxBorderRadius(), 15);
|
||
|
||
// 测试语言页面复选框边框宽度
|
||
expect(strategy.getLanguagePageCheckboxBorderWidth(), 2);
|
||
|
||
// 测试语言页面Scaffold背景颜色
|
||
expect(strategy.getLanguagePageScaffoldBackgroundColor(), Colors.transparent);
|
||
});
|
||
|
||
test('Account page test', () {
|
||
final strategy = BaseBusinessLogicStrategy();
|
||
|
||
// 测试账户页面背景图片
|
||
expect(strategy.getAccountPageBackgroundImage(),
|
||
"sc_images/person/at_icon_edit_userinfo_bg.png");
|
||
|
||
// 测试账户页面次要文本颜色
|
||
expect(strategy.getAccountPageSecondaryTextColor(),
|
||
Colors.black38); // 原始应用次要文本颜色
|
||
|
||
// 测试账户页面主容器背景颜色
|
||
expect(strategy.getAccountPageMainContainerBackgroundColor(), Colors.white);
|
||
|
||
// 测试账户页面主容器边框颜色
|
||
expect(strategy.getAccountPageMainContainerBorderColor(),
|
||
const Color(0xffE6E6E6));
|
||
|
||
// 测试账户页面主要文本颜色
|
||
expect(strategy.getAccountPagePrimaryTextColor(), Colors.black);
|
||
|
||
// 测试账户页面图标颜色
|
||
expect(strategy.getAccountPageIconColor(), Colors.black26);
|
||
|
||
// 测试账户页面分隔线颜色
|
||
expect(strategy.getAccountPageDividerColor(), Colors.black12);
|
||
});
|
||
|
||
test('Variant1 settings page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试马甲包设置页面背景图片(目前使用相同图片)
|
||
expect(strategy.getSettingsPageBackgroundImage(),
|
||
"sc_images/person/at_icon_edit_userinfo_bg.png");
|
||
|
||
// 测试马甲包设置页面次要文本颜色(使用次要文本颜色)
|
||
expect(strategy.getSettingsPageSecondaryTextColor(),
|
||
const Color(0xff757575)); // SocialChatTheme.textSecondary
|
||
|
||
// 测试马甲包设置页面主要容器背景颜色(使用表面颜色)
|
||
expect(strategy.getSettingsPageMainContainerBackgroundColor(),
|
||
const Color(0xffffffff)); // SocialChatTheme.surfaceColor
|
||
|
||
// 测试马甲包设置页面主要容器边框颜色(使用边框颜色)
|
||
expect(strategy.getSettingsPageMainContainerBorderColor(),
|
||
const Color(0xffE0E0E0)); // SocialChatTheme.borderColor
|
||
|
||
// 测试马甲包设置页面主要文本颜色(使用主要文本颜色)
|
||
expect(strategy.getSettingsPagePrimaryTextColor(),
|
||
const Color(0xff212121)); // SocialChatTheme.textPrimary
|
||
|
||
// 测试马甲包设置页面图标颜色(使用次要文本颜色)
|
||
expect(strategy.getSettingsPageIconColor(),
|
||
const Color(0xff757575)); // SocialChatTheme.textSecondary
|
||
});
|
||
|
||
test('Variant1 language page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试马甲包语言页面背景图片(目前使用相同图片)
|
||
expect(strategy.getLanguagePageBackgroundImage(),
|
||
"sc_images/person/at_icon_edit_userinfo_bg.png");
|
||
|
||
// 测试马甲包语言页面主要文本颜色(使用主要文本颜色)
|
||
expect(strategy.getLanguagePagePrimaryTextColor(),
|
||
const Color(0xff212121)); // SocialChatTheme.textPrimary
|
||
|
||
// 测试马甲包语言页面复选框活动颜色(使用马甲包主题色)
|
||
expect(strategy.getLanguagePageCheckboxActiveColor(),
|
||
const Color(0xffFF5722)); // 马甲包主题色
|
||
|
||
// 测试马甲包语言页面复选框边框颜色(使用马甲包边框色)
|
||
expect(strategy.getLanguagePageCheckboxBorderColor(),
|
||
SocialChatTheme.borderColor); // 马甲包边框色
|
||
|
||
// 测试马甲包语言页面复选框对勾颜色(使用透明色)
|
||
expect(strategy.getLanguagePageCheckColor(), Colors.transparent);
|
||
|
||
// 测试马甲包语言页面复选框边框圆角(使用相同圆角值15)
|
||
expect(strategy.getLanguagePageCheckboxBorderRadius(), 15);
|
||
|
||
// 测试马甲包语言页面复选框边框宽度(使用相同边框宽度2)
|
||
expect(strategy.getLanguagePageCheckboxBorderWidth(), 2);
|
||
|
||
// 测试马甲包语言页面Scaffold背景颜色(使用透明色)
|
||
expect(strategy.getLanguagePageScaffoldBackgroundColor(), Colors.transparent);
|
||
});
|
||
|
||
test('Variant1 account page test', () {
|
||
final strategy = Variant1BusinessLogicStrategy();
|
||
|
||
// 测试马甲包账户页面背景图片(目前使用相同图片)
|
||
expect(strategy.getAccountPageBackgroundImage(),
|
||
"sc_images/person/at_icon_edit_userinfo_bg.png");
|
||
|
||
// 测试马甲包账户页面次要文本颜色(使用次要文本颜色)
|
||
expect(strategy.getAccountPageSecondaryTextColor(),
|
||
SocialChatTheme.textSecondary); // 马甲包次要文本颜色
|
||
|
||
// 测试马甲包账户页面主容器背景颜色(使用表面颜色)
|
||
expect(strategy.getAccountPageMainContainerBackgroundColor(),
|
||
const Color(0xffffffff)); // SocialChatTheme.surfaceColor
|
||
|
||
// 测试马甲包账户页面主容器边框颜色(使用边框颜色)
|
||
expect(strategy.getAccountPageMainContainerBorderColor(),
|
||
const Color(0xffE0E0E0)); // SocialChatTheme.borderColor
|
||
|
||
// 测试马甲包账户页面主要文本颜色(使用主要文本颜色)
|
||
expect(strategy.getAccountPagePrimaryTextColor(),
|
||
const Color(0xff212121)); // SocialChatTheme.textPrimary
|
||
|
||
// 测试马甲包账户页面图标颜色(使用次要文本颜色)
|
||
expect(strategy.getAccountPageIconColor(),
|
||
const Color(0xff757575)); // SocialChatTheme.textSecondary
|
||
|
||
// 测试马甲包账户页面分隔线颜色(使用分隔线颜色)
|
||
expect(strategy.getAccountPageDividerColor(),
|
||
const Color(0xffE0E0E0)); // SocialChatTheme.dividerColor
|
||
});
|
||
});
|
||
|
||
} |