diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/color.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/core/src/color.rs b/core/src/color.rs index 88115f25..1392f28b 100644 --- a/core/src/color.rs +++ b/core/src/color.rs @@ -231,6 +231,8 @@ mod tests { #[test] fn color_manipulation() { + use approx::assert_relative_eq; + let c1 = Color::from_rgb(0.5, 0.4, 0.3); let c2 = Color::from_rgb(0.2, 0.5, 0.3); @@ -242,16 +244,11 @@ mod tests { let lighter = l1.lighten(l2); // Convert back to our Color - let r: Color = Srgba::from_linear(lighter).into(); - - assert_eq!( - r, - Color { - r: 0.5, - g: 0.5, - b: 0.3, - a: 1.0 - } - ); + let result: Color = Srgba::from_linear(lighter).into(); + + assert_relative_eq!(result.r, 0.5); + assert_relative_eq!(result.g, 0.5); + assert_relative_eq!(result.b, 0.3); + assert_relative_eq!(result.a, 1.0); } } |