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

30 lines
915 B
Lua
Raw Normal View History

2014-12-18 08:32:18 +00:00
describe("ImageWidget module", function()
2016-04-19 06:50:36 +00:00
local ImageWidget
setup(function()
require("commonrequire")
ImageWidget = require("ui/widget/imagewidget")
end)
2014-12-18 08:32:18 +00:00
it("should render without error", function()
local imgw = ImageWidget:new{
file = "resources/koreader.png"
2014-12-18 08:32:18 +00:00
}
imgw:_render()
assert(imgw._bb)
end)
2022-06-12 21:43:03 +00:00
--[[
-- 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()
2014-12-18 08:32:18 +00:00
local imgw = ImageWidget:new{
file = "wtf.png"
}
assert.has_error(function()
imgw:_render()
end)
end)
2022-06-12 21:43:03 +00:00
--]]
2014-12-18 08:32:18 +00:00
end)