tests: add a test to make sure the front face is correct

This commit is contained in:
Sasha Szpakowski
2024-03-21 18:12:44 -03:00
parent 681d694f9d
commit 6002a03761
2 changed files with 17 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

+17
View File
@@ -2123,6 +2123,23 @@ love.test.graphics.setFrontFaceWinding = function(test)
test:assertEquals('ccw', love.graphics.getFrontFaceWinding(), 'check ffw ccw set')
love.graphics.setFrontFaceWinding(original)
-- @TODO better graphics drawing specific test
local shader = love.graphics.newShader[[
vec4 effect(vec4 c, Image tex, vec2 tc, vec2 pc) {
return gl_FrontFacing ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
}
]]
local dummyimg = love.graphics.newImage(love.image.newImageData(1, 1))
local canvas = love.graphics.newCanvas(16, 16)
love.graphics.push("all")
love.graphics.setCanvas(canvas)
love.graphics.setShader(shader)
love.graphics.draw(dummyimg, 0, 0, 0, 16, 16)
love.graphics.pop()
local imgdata = love.graphics.readbackTexture(canvas)
test:compareImg(imgdata)
end