Files
love/testing/tests/image.lua
T
ell 19df8040df 0.1
Initial commit of a basic test framework, see readme.md for more

Most modules are covered with basic unit tests, and there's an example test for a graphics draw (rectangle) and object (File) - for object tests doing more scenario based so we can check multiple things together
2023-10-04 14:43:44 +01:00

31 lines
1010 B
Lua

-- love.image
-- love.image.isCompressed
-- @NOTE really we need to test each of the files listed here:
-- https://love2d.org/wiki/CompressedImageFormat
love.test.image.isCompressed = function(test)
local compressed = love.image.isCompressed('resources/love.dxt1')
test:assertEquals(true, compressed, 'check dxt1 valid compressed image')
end
-- love.image.newCompressedData
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.image.newCompressedData = function(test)
local imgdata = love.image.newCompressedData('resources/love.dxt1')
test:assertObject(imgdata)
imgdata:release()
end
-- love.image.newImageData
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.image.newImageData = function(test)
local imgdata = love.image.newImageData('resources/love.png')
local rawdata = love.image.newImageData(16, 16, 'rgba8', nil)
test:assertObject(imgdata)
test:assertObject(rawdata)
imgdata:release()
rawdata:release()
end