2
0
mirror of https://github.com/koreader/koreader synced 2024-11-04 12:00:25 +00:00
koreader/spec/unit/imagewidget_spec.lua
2022-06-13 02:37:01 +02:00

30 lines
915 B
Lua

describe("ImageWidget module", function()
local ImageWidget
setup(function()
require("commonrequire")
ImageWidget = require("ui/widget/imagewidget")
end)
it("should render without error", function()
local imgw = ImageWidget:new{
file = "resources/koreader.png"
}
imgw:_render()
assert(imgw._bb)
end)
--[[
-- NOTE: There was never actually sane error handling in there,
-- it would just crash later because of a lack of BB object.
-- We now return a checkerboard pattern on image decoding failure,
-- which also happens to make the caller's life easier.
it("should error out on missing or invalid images", function()
local imgw = ImageWidget:new{
file = "wtf.png"
}
assert.has_error(function()
imgw:_render()
end)
end)
--]]
end)