Skip to content

Commit

Permalink
Add stricter tests for Oklchy
Browse files Browse the repository at this point in the history
  • Loading branch information
eprovst committed May 15, 2024
1 parent 9ac921c commit 3fe7442
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,15 @@ end

# Selection of Oklch tests from the WPT test suite (https://wpt.fyi/results/css/css-color)
@testset "Oklch <-> RGB" begin
@test convert(Oklch, RGB{Float32}(0.706, 0.024, 0.371)) Oklch{Float32}(0.50, 0.20, 0) atol=1e-1
@test convert(Oklch, RGB{Float32}(0.231, 0.317, 0.826)) Oklch{Float32}(0.50, 0.20, 270) atol=1e-1
@test convert(Oklch, RGB{Float32}(0.320, 0.858, 0.611)) Oklch{Float32}(0.80, 0.15, 160) atol=1e-1
@test convert(Oklch, RGB{Float32}(0.673, 0.278, 0.523)) Oklch{Float32}(0.55, 0.15, 345) atol=1e-1

@test convert(RGB, Oklch{Float32}(0.50, 0.20, 0)) RGB{Float32}(0.706, 0.024, 0.371) atol=1e-1
@test convert(RGB, Oklch{Float32}(0.50, 0.20, 270)) RGB{Float32}(0.231, 0.317, 0.826) atol=1e-1
@test convert(RGB, Oklch{Float32}(0.80, 0.15, 160)) RGB{Float32}(0.320, 0.858, 0.611) atol=1e-1
@test convert(RGB, Oklch{Float32}(0.55, 0.15, 345)) RGB{Float32}(0.673, 0.278, 0.523) atol=1e-1
@test convert(Oklch, RGB{Float32}(0.00000, 0.00000, 0.00000)) Oklch{Float32}(0.00, 0.00, 0) rtol=2e-2
@test convert(Oklch, RGB{Float32}(0.23056, 0.31730, 0.82628)) Oklch{Float32}(0.50, 0.20, 270) rtol=2e-2
@test convert(Oklch, RGB{Float32}(0.32022, 0.85805, 0.61147)) Oklch{Float32}(0.80, 0.15, 160) rtol=2e-2
@test convert(Oklch, RGB{Float32}(0.67293, 0.27791, 0.52280)) Oklch{Float32}(0.55, 0.15, 345) rtol=2e-2

@test convert(RGB, Oklch{Float32}(0.00, 0.00, 0)) RGB{Float32}(0.00000, 0.00000, 0.00000) rtol=2e-2
@test convert(RGB, Oklch{Float32}(0.50, 0.20, 270)) RGB{Float32}(0.23056, 0.31730, 0.82628) rtol=2e-2
@test convert(RGB, Oklch{Float32}(0.80, 0.15, 160)) RGB{Float32}(0.32022, 0.85805, 0.61147) rtol=2e-2
@test convert(RGB, Oklch{Float32}(0.55, 0.15, 345)) RGB{Float32}(0.67293, 0.27791, 0.52280) rtol=2e-2
end

@testset "custom types" begin
Expand Down

0 comments on commit 3fe7442

Please sign in to comment.