Skip to content

Commit

Permalink
tests: add schemes_eq test
Browse files Browse the repository at this point in the history
  • Loading branch information
InioX committed Aug 22, 2024
1 parent 5d2beb0 commit f18a8d2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/color/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub fn generate_dynamic_scheme(
is_dark: bool,
contrast_level: Option<f64>,
) -> DynamicScheme {
match scheme_type.unwrap() {
match scheme_type.unwrap_or(SchemeTypes::SchemeContent) {
SchemeTypes::SchemeContent => {
SchemeContent::new(Hct::new(source_color), is_dark, contrast_level).scheme
}
Expand Down
26 changes: 26 additions & 0 deletions src/scheme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,29 @@ pub fn get_schemes(
));
(scheme_dark, scheme_light)
}


#[cfg(test)]
mod tests {
use super::*;
use material_colors::color::Argb;

#[test]
fn schemes_eq() {
let source_color = material_colors::color::Argb::new(255, 255, 0, 0);
assert_eq!(
Scheme::from(generate_dynamic_scheme(
&None,
source_color,
true,
None,
)).primary,
Argb {
alpha: 255,
red: 255,
green: 180,
blue: 168,
}
);
}
}

0 comments on commit f18a8d2

Please sign in to comment.