Skip to content

Commit

Permalink
[Tests] Fix tests checking 0.5 value in uint8 texture
Browse files Browse the repository at this point in the history
  • Loading branch information
hyazinthh committed Dec 12, 2023
1 parent f81cac2 commit 80342f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Tests/Aardvark.Rendering.Tests/Tests/Texture/Clear.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module TextureClear =

let rgba8 (runtime : IRuntime) =
let data = createAndClearColor runtime TextureFormat.Rgba8 <| C3f(0.5)
data.AsPixImage<uint8>() |> PixImage.isColor (C4b(127uy).ToArray())
data.AsPixImage<uint8>() |> PixImage.isColorWithDist 1L (C4b(127uy).ToArray())

let rgba32i (runtime : IRuntime) =
let data = createAndClearColor runtime TextureFormat.Rgba32i <| V4i(-1)
Expand Down Expand Up @@ -135,7 +135,7 @@ module TextureClear =
do
let c = C4b(127uy)
let pi = textures.[c3].Download().AsPixImage<uint8>()
pi |> PixImage.isColor (c.ToArray())
pi |> PixImage.isColorWithDist 1L (c.ToArray())

do
let c = C3b.AliceBlue |> V4i
Expand Down
3 changes: 3 additions & 0 deletions src/Tests/Aardvark.Rendering.Tests/Tests/Utilities.fs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ module PixData =
let isColor (color : 'T[]) (pi : PixImage<'T>) =
isColorWithComparer Expect.equal color pi

let inline isColorWithDist (maxDist : int64) (color : 'T[]) (pi : PixImage<'T>) =
isColorWithComparer (fun x y -> Expect.isLessThanOrEqual (abs (int64 x - int64 y)) maxDist) color pi

let isColor32f (accuracy : Accuracy) (color : float32[]) (pi : PixImage<float32>) =
let comp a b = Expect.floatClose accuracy (float a) (float b)
isColorWithComparer comp color pi
Expand Down

0 comments on commit 80342f9

Please sign in to comment.