#[test]
fn test_palette<'a>() {
use euma::palette::{
AQUA_DARK, AQUA_EXTRA_DARK, AQUA_EXTRA_LIGHT, AQUA_LIGHT, AQUA_MEDIUM, BLUE_DARK, BLUE_EXTRA_DARK,
BLUE_EXTRA_LIGHT, BLUE_LIGHT, BLUE_MEDIUM, CYAN_DARK, CYAN_EXTRA_DARK, CYAN_EXTRA_LIGHT, CYAN_LIGHT, CYAN_MEDIUM,
Color, ColorSpace, DARK_1, DARK_2, DARK_3, DARK_4, DARK_5, DARK_6, DARK_7, DARK_8, DARK_9, DARK_10, GRAY_NEUTRAL,
GREEN_DARK, GREEN_EXTRA_DARK, GREEN_EXTRA_LIGHT, GREEN_LIGHT, GREEN_MEDIUM, LIGHT_1, LIGHT_2, LIGHT_3, LIGHT_4,
LIGHT_5, LIGHT_6, LIGHT_7, LIGHT_8, LIGHT_9, LIGHT_10, MAGENTA_DARK, MAGENTA_EXTRA_DARK, MAGENTA_EXTRA_LIGHT,
MAGENTA_LIGHT, MAGENTA_MEDIUM, ORANGE_DARK, ORANGE_EXTRA_DARK, ORANGE_EXTRA_LIGHT, ORANGE_LIGHT, ORANGE_MEDIUM,
PALETTE, PURPLE_DARK, PURPLE_EXTRA_DARK, PURPLE_EXTRA_LIGHT, PURPLE_LIGHT, PURPLE_MEDIUM, RED_DARK,
RED_EXTRA_DARK, RED_EXTRA_LIGHT, RED_LIGHT, RED_MEDIUM, YELLOW_DARK, YELLOW_EXTRA_DARK, YELLOW_EXTRA_LIGHT,
YELLOW_LIGHT, YELLOW_MEDIUM,
};
assert_eq!(
RED_EXTRA_DARK, PALETTE.red_extra_dark,
"Palette color and individual color for red_extra_dark are not the same"
);
assert_eq!(
RED_DARK, PALETTE.red_dark,
"Palette color and individual color for red_dark are not the same"
);
assert_eq!(
RED_MEDIUM, PALETTE.red_medium,
"Palette color and individual color for red_medium are not the same"
);
assert_eq!(
RED_LIGHT, PALETTE.red_light,
"Palette color and individual color for red_light are not the same"
);
assert_eq!(
RED_EXTRA_LIGHT, PALETTE.red_extra_light,
"Palette color and individual color for red_extra_light are not the same"
);
assert_eq!(
GREEN_EXTRA_DARK, PALETTE.green_extra_dark,
"Palette color and individual color for green_extra_dark are not the same"
);
assert_eq!(
GREEN_DARK, PALETTE.green_dark,
"Palette color and individual color for green_dark are not the same"
);
assert_eq!(
GREEN_MEDIUM, PALETTE.green_medium,
"Palette color and individual color for green_medium are not the same"
);
assert_eq!(
GREEN_LIGHT, PALETTE.green_light,
"Palette color and individual color for green_light are not the same"
);
assert_eq!(
GREEN_EXTRA_LIGHT, PALETTE.green_extra_light,
"Palette color and individual color for green_extra_light are not the same"
);
assert_eq!(
BLUE_EXTRA_DARK, PALETTE.blue_extra_dark,
"Palette color and individual color for blue_extra_dark are not the same"
);
assert_eq!(
BLUE_DARK, PALETTE.blue_dark,
"Palette color and individual color for blue_dark are not the same"
);
assert_eq!(
BLUE_MEDIUM, PALETTE.blue_medium,
"Palette color and individual color for blue_medium are not the same"
);
assert_eq!(
BLUE_LIGHT, PALETTE.blue_light,
"Palette color and individual color for blue_light are not the same"
);
assert_eq!(
BLUE_EXTRA_LIGHT, PALETTE.blue_extra_light,
"Palette color and individual color for blue_extra_light are not the same"
);
assert_eq!(
CYAN_EXTRA_DARK, PALETTE.cyan_extra_dark,
"Palette color and individual color for cyan_extra_dark are not the same"
);
assert_eq!(
CYAN_DARK, PALETTE.cyan_dark,
"Palette color and individual color for cyan_dark are not the same"
);
assert_eq!(
CYAN_MEDIUM, PALETTE.cyan_medium,
"Palette color and individual color for cyan_medium are not the same"
);
assert_eq!(
CYAN_LIGHT, PALETTE.cyan_light,
"Palette color and individual color for cyan_light are not the same"
);
assert_eq!(
CYAN_EXTRA_LIGHT, PALETTE.cyan_extra_light,
"Palette color and individual color for cyan_extra_light are not the same"
);
assert_eq!(
MAGENTA_EXTRA_DARK, PALETTE.magenta_extra_dark,
"Palette color and individual color for magenta_extra_dark are not the same"
);
assert_eq!(
MAGENTA_DARK, PALETTE.magenta_dark,
"Palette color and individual color for magenta_dark are not the same"
);
assert_eq!(
MAGENTA_MEDIUM, PALETTE.magenta_medium,
"Palette color and individual color for magenta_medium are not the same"
);
assert_eq!(
MAGENTA_LIGHT, PALETTE.magenta_light,
"Palette color and individual color for magenta_light are not the same"
);
assert_eq!(
MAGENTA_EXTRA_LIGHT, PALETTE.magenta_extra_light,
"Palette color and individual color for magenta_extra_light are not the same"
);
assert_eq!(
YELLOW_EXTRA_DARK, PALETTE.yellow_extra_dark,
"Palette color and individual color for yellow_extra_dark are not the same"
);
assert_eq!(
YELLOW_DARK, PALETTE.yellow_dark,
"Palette color and individual color for yellow_dark are not the same"
);
assert_eq!(
YELLOW_MEDIUM, PALETTE.yellow_medium,
"Palette color and individual color for yellow_medium are not the same"
);
assert_eq!(
YELLOW_LIGHT, PALETTE.yellow_light,
"Palette color and individual color for yellow_light are not the same"
);
assert_eq!(
YELLOW_EXTRA_LIGHT, PALETTE.yellow_extra_light,
"Palette color and individual color for yellow_extra_light are not the same"
);
assert_eq!(
PURPLE_EXTRA_DARK, PALETTE.purple_extra_dark,
"Palette color and individual color for purple_extra_dark are not the same"
);
assert_eq!(
PURPLE_DARK, PALETTE.purple_dark,
"Palette color and individual color for purple_dark are not the same"
);
assert_eq!(
PURPLE_MEDIUM, PALETTE.purple_medium,
"Palette color and individual color for purple_medium are not the same"
);
assert_eq!(
PURPLE_LIGHT, PALETTE.purple_light,
"Palette color and individual color for purple_light are not the same"
);
assert_eq!(
PURPLE_EXTRA_LIGHT, PALETTE.purple_extra_light,
"Palette color and individual color for purple_extra_light are not the same"
);
assert_eq!(
ORANGE_EXTRA_DARK, PALETTE.orange_extra_dark,
"Palette color and individual color for orange_extra_dark are not the same"
);
assert_eq!(
ORANGE_DARK, PALETTE.orange_dark,
"Palette color and individual color for orange_dark are not the same"
);
assert_eq!(
ORANGE_MEDIUM, PALETTE.orange_medium,
"Palette color and individual color for orange_medium are not the same"
);
assert_eq!(
ORANGE_LIGHT, PALETTE.orange_light,
"Palette color and individual color for orange_light are not the same"
);
assert_eq!(
ORANGE_EXTRA_LIGHT, PALETTE.orange_extra_light,
"Palette color and individual color for orange_extra_light are not the same"
);
assert_eq!(
AQUA_EXTRA_DARK, PALETTE.aqua_extra_dark,
"Palette color and individual color for aqua_extra_dark are not the same"
);
assert_eq!(
AQUA_DARK, PALETTE.aqua_dark,
"Palette color and individual color for aqua_dark are not the same"
);
assert_eq!(
AQUA_MEDIUM, PALETTE.aqua_medium,
"Palette color and individual color for aqua_medium are not the same"
);
assert_eq!(
AQUA_LIGHT, PALETTE.aqua_light,
"Palette color and individual color for aqua_light are not the same"
);
assert_eq!(
AQUA_EXTRA_LIGHT, PALETTE.aqua_extra_light,
"Palette color and individual color for aqua_extra_light are not the same"
);
assert_eq!(
DARK_1, PALETTE.dark_1,
"Palette color and individual color for dark_1 are not the same"
);
assert_eq!(
DARK_2, PALETTE.dark_2,
"Palette color and individual color for dark_2 are not the same"
);
assert_eq!(
DARK_3, PALETTE.dark_3,
"Palette color and individual color for dark_3 are not the same"
);
assert_eq!(
DARK_4, PALETTE.dark_4,
"Palette color and individual color for dark_4 are not the same"
);
assert_eq!(
DARK_5, PALETTE.dark_5,
"Palette color and individual color for dark_5 are not the same"
);
assert_eq!(
DARK_6, PALETTE.dark_6,
"Palette color and individual color for dark_6 are not the same"
);
assert_eq!(
DARK_7, PALETTE.dark_7,
"Palette color and individual color for dark_7 are not the same"
);
assert_eq!(
DARK_8, PALETTE.dark_8,
"Palette color and individual color for dark_8 are not the same"
);
assert_eq!(
DARK_9, PALETTE.dark_9,
"Palette color and individual color for dark_9 are not the same"
);
assert_eq!(
DARK_10, PALETTE.dark_10,
"Palette color and individual color for dark_10 are not the same"
);
assert_eq!(
GRAY_NEUTRAL, PALETTE.gray_neutral,
"Palette color and individual color for gray_neutral are not the same"
);
assert_eq!(
LIGHT_10, PALETTE.light_10,
"Palette color and individual color for light_10 are not the same"
);
assert_eq!(
LIGHT_9, PALETTE.light_9,
"Palette color and individual color for light_9 are not the same"
);
assert_eq!(
LIGHT_8, PALETTE.light_8,
"Palette color and individual color for light_8 are not the same"
);
assert_eq!(
LIGHT_7, PALETTE.light_7,
"Palette color and individual color for light_7 are not the same"
);
assert_eq!(
LIGHT_6, PALETTE.light_6,
"Palette color and individual color for light_6 are not the same"
);
assert_eq!(
LIGHT_5, PALETTE.light_5,
"Palette color and individual color for light_5 are not the same"
);
assert_eq!(
LIGHT_4, PALETTE.light_4,
"Palette color and individual color for light_4 are not the same"
);
assert_eq!(
LIGHT_3, PALETTE.light_3,
"Palette color and individual color for light_3 are not the same"
);
assert_eq!(
LIGHT_2, PALETTE.light_2,
"Palette color and individual color for light_2 are not the same"
);
assert_eq!(
LIGHT_1, PALETTE.light_1,
"Palette color and individual color for light_1 are not the same"
);
let test_color_1: Color = Color::from(
ColorSpace::A98Rgb,
[1.1_f64, -0.1_f64, 1_f64],
Some(100_f64),
Some("#123456"),
);
assert_eq!(
test_color_1.alpha.unwrap(),
1_f64,
"Color alpha was not clamped between 0 and 1"
);
assert_eq!(
test_color_1.hex.unwrap(),
"#123456",
"Color hex string is not what it should be"
);
assert_eq!(
test_color_1.components.to_vec().get(0).unwrap(),
&1_f64,
"Color components were not adjusted to color space"
);
assert_eq!(
test_color_1.components.to_vec().get(1).unwrap(),
&0_f64,
"Color components were not adjusted to color space"
);
assert_eq!(
test_color_1.components.to_vec().get(2).unwrap(),
&1_f64,
"Color components is not what is should be"
);
let test_color_2: Color = Color::from(ColorSpace::Hsl, [400_f64, -0.1_f64, 200_f64], None, None);
assert_eq!(
test_color_2.alpha, None,
"Color alpha present, when there should be none"
);
assert_eq!(
test_color_2.hex, None,
"Color hex sting present, when there should be none"
);
assert_eq!(
test_color_2.components.to_vec().get(0).unwrap(),
&359.999_999_999_999_f64,
"Color components were not adjusted to color space"
);
assert_eq!(
test_color_2.components.to_vec().get(1).unwrap(),
&0_f64,
"Color components were not adjusted to color space"
);
assert_eq!(
test_color_2.components.to_vec().get(2).unwrap(),
&100_f64,
"Color components were not adjusted to color space"
);
let test_color_3: Color<'a> = Color::<'a>::from(ColorSpace::Lab, [200_f64, -200_f64, 200_f64], None, None);
assert_eq!(
test_color_3.components.to_vec().get(0).unwrap(),
&100_f64,
"Color components were not adjusted to color space"
);
assert_eq!(
test_color_3.components.to_vec().get(1).unwrap(),
&-160_f64,
"Color components were not adjusted to color space"
);
assert_eq!(
test_color_3.components.to_vec().get(2).unwrap(),
&160_f64,
"Color components were not adjusted to color space"
);
let test_color_4: Color<'a> = Color::<'a>::from(ColorSpace::Lch, [200_f64, 250_f64, 400_f64], None, Some("#123456"));
assert_eq!(
test_color_4.components.to_vec().get(0).unwrap(),
&100_f64,
"Color components were not adjusted to color space"
);
assert_eq!(
test_color_4.components.to_vec().get(1).unwrap(),
&230_f64,
"Color components were not adjusted to color space"
);
assert_eq!(
test_color_4.components.to_vec().get(2).unwrap(),
&359.999_999_999_999_f64,
"Color components were not adjusted to color space"
);
}