Merge pull request #100659 from clayjohn/color-srgb-precision

Increase precision in `linear_to_srgb()` and `srgb_to_linear()`
This commit is contained in:
Rémi Verschelde
2024-12-20 23:57:35 +01:00
2 changed files with 12 additions and 6 deletions

View File

@ -160,6 +160,12 @@ TEST_CASE("[Color] Linear <-> sRGB conversion") {
CHECK_MESSAGE(
color_srgb.srgb_to_linear().is_equal_approx(Color(0.35, 0.5, 0.6, 0.7)),
"The sRGB color converted back to linear color space should match the expected value.");
CHECK_MESSAGE(
Color(1.0, 1.0, 1.0, 1.0).srgb_to_linear() == (Color(1.0, 1.0, 1.0, 1.0)),
"White converted from sRGB to linear should remain white.");
CHECK_MESSAGE(
Color(1.0, 1.0, 1.0, 1.0).linear_to_srgb() == (Color(1.0, 1.0, 1.0, 1.0)),
"White converted from linear to sRGB should remain white.");
}
TEST_CASE("[Color] Named colors") {