import 'dart:ui';

import 'package:flutter_test/flutter_test.dart';
import 'package:openim/company/brand/app_tokens.dart';
import 'package:openim/company/brand/apply_official_styles.dart';
import 'package:openim/company/rtc/call_session_guard.dart';
import 'package:openim/company/rtc/livekit_call_config.dart';
import 'package:openim_common/openim_common.dart';

void main() {
  setUpAll(applyOfficialStylesFromTokens);

  test('未接超时只有 60s 一个来源，不再出现 30s', () {
    expect(AppDuration.callInviteTimeout, const Duration(seconds: 60));
    expect(LiveKitCallConfig.inviteTimeout, AppDuration.callInviteTimeout);
    expect(Styles.callInviteTimeout, AppDuration.callInviteTimeout);
    expect(CallSessionGuard().inviteTimeout, AppDuration.callInviteTimeout);
  });

  test('通话页底色走 callBg #1D2129，不复用大图遮罩黑', () {
    expect(AppColors.callBg, const Color(0xFF1D2129));
    expect(AppColors.callBg, AppColors.textPrimary);
    expect(Styles.c_callBg, AppColors.callBg);
    expect(Styles.c_callBg, isNot(AppColors.maskBg));
    expect(Styles.c_000000, AppColors.maskBg);
  });

  test('计时器 32px 纯白 tabular figures，状态字 14px 白 60%，姓名 18px', () {
    expect(AppFont.callTimer, 32);
    expect(Styles.ts_callTimer.fontSize, 32);
    expect(Styles.ts_callTimer.color, AppColors.pageBg);
    expect(Styles.ts_callTimer.fontFeatures, contains(FontFeature.tabularFigures()));
    expect(Styles.ts_callStatus.fontSize, AppFont.sub);
    expect(Styles.ts_callStatus.color, AppColors.pageBg.withOpacity(.6));
    expect(Styles.ts_callName.fontSize, AppFont.title);
  });

  test('通话页尺寸与进出场动效来自 Token', () {
    expect(Styles.callAvatar, 96);
    expect(Styles.callPrimaryBtn, 64);
    expect(Styles.callSecondaryBtn, 48);
    expect(Styles.callIncomingGap, 96);
    expect(Styles.callNameTop, 96);
    expect(Styles.callMinimizeHit, 48);
    expect(Styles.callPageMotion, const Duration(milliseconds: 250));
    expect(Styles.callEndHold, const Duration(milliseconds: 1500));
    expect(Styles.callVibrate, const Duration(seconds: 1));
    expect(AppRadius.avatar(96), closeTo(17.28, 0.001));
  });
}
