Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Mar 23, 2024
1 parent 773dfcd commit 2f33171
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Binary file modified testing/output/expected/love.test.graphics.Canvas-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 6 additions & 10 deletions testing/tests/graphics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,10 @@ love.test.graphics.Canvas = function(test)
]]
local shader2 = love.graphics.newShader[[
vec4 effect(vec4 c, Image tex, vec2 tc, vec2 pc) {
// rounding during quantization from float to unorm8 doesn't seem to be
// totally consistent across devices, lets do it ourselves.
vec2 value = floor(pc) / love_ScreenSize.xy;
vec2 quantized = (floor(255.0 * value + 0.5) + 0.25) / 255.0;
return vec4(quantized, 0.0, 1.0);
return vec4(pc / love_ScreenSize.xy, 0.0, 1.0);
}
]]
local img = love.graphics.newImage(love.image.newImageData(1, 1))
local canvas2 = love.graphics.newCanvas(128, 128)

love.graphics.push("all")
love.graphics.setCanvas(canvas)
Expand All @@ -228,14 +223,15 @@ love.test.graphics.Canvas = function(test)
test:compareImg(imgdata3)

love.graphics.push("all")
love.graphics.setCanvas(canvas2)
love.graphics.setCanvas(canvas)
love.graphics.setShader(shader2)
love.graphics.draw(img, 0, 0, 0, canvas2:getDimensions())
love.graphics.draw(img, 0, 0, 0, canvas:getDimensions())
love.graphics.pop()
local imgdata4 = love.graphics.readbackTexture(canvas2)
local imgdata4 = love.graphics.readbackTexture(canvas)
-- test:exportImg(imgdata4, 4)
test.rgba_tolerance = 1
test:compareImg(imgdata4)

test.rgba_tolerance = 0

-- check depth samples
local dcanvas = love.graphics.newCanvas(100, 100, {
Expand Down

0 comments on commit 2f33171

Please sign in to comment.