assert_same_color

Macro assert_same_color 

Source
macro_rules! assert_same_color {
    ($c1:expr, $c2:expr $(,)?) => { ... };
}
Expand description

Test macro for asserting the equality of colors.

This macro tests the color objects for equality using the Eq trait. The implementation, in turn, normalizes the coordinates of colors with the same color space by zeroing out not-a-numbers, clamping the a/b/c components of Oklab colors, scaling the hue of Oklch/Oklrch, reducing resolution, and dropping the sign of negative zeros before comparing the resulting bit strings.

ยงPanics

This macro panics if the normalized bit strings are not identical. Its message places either color spaces or the coordinates below each other at the beginning of subsequent lines for easy comparability.