import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:rasadyar_core/presentation/utils/color_utils.dart';

void main() {
  group('ColorUtils extension', () {
    const baseColor = Color(0xFF42A5F5);

    test('disabledColor returns color with alpha 38', () {
      Color disabled = baseColor.disabledColor;
      expect(disabled.a, 0.14901960784313725);
      expect(disabled.r, baseColor.r);
      expect(disabled.g, baseColor.g);
      expect(disabled.b, baseColor.b);
    });

    test('hoverColor returns color darkened by 0.5', () {
      Color hover = baseColor.hoverColor;
      final expected =
          HSLColor.fromColor(
            baseColor,
          ).withLightness((HSLColor.fromColor(baseColor).lightness - 0.5).clamp(0.0, 1.0)).toColor();
      expect(hover.g, expected.g);
    });

    test('pressedColor returns color darkened by 0.1', () {
      Color pressed = baseColor.pressedColor;
      final expected =
          HSLColor.fromColor(
            baseColor,
          ).withLightness((HSLColor.fromColor(baseColor).lightness - 0.1).clamp(0.0, 1.0)).toColor();
      expect(pressed.r, expected.r);
    });
  });
}
