Test that the 8-bit sRGB table keeps the same steps as decoding each one

This commit is contained in:
Rebornim committed 2026-11-27 08:09:08 +00:00
1 parent 92a9d88d4f
commit f28be5bd22
1 file changed
+9
+9
View File
@@ -54,6 +54,15 @@ mod tests {
assert!((srgb - dark).abs() < (linear - dark).abs());
}
#[test]
fn srgb8_keeps_the_same_steps_as_decoding_each_one() {
for value in (0..=1000).map(|step| step as f32 / 1000.0) {
let decoded = srgb_to_linear((linear_to_srgb(value) * 255.0).round() / 255.0);
assert_eq!(stored(ChannelFormat::Srgb8, false, [value; 3], 3)[0], decoded, "at {value}");
}
}
#[test]
fn grey_formats_turn_colours_grey_and_signed_values_keep_their_sign() {
let grey = stored(ChannelFormat::L16, false, [1.0, 0.0, 0.0], 3);