Files
koreader/spec/unit/imagewidget_spec.lua

30 lines
915 B
Lua
Raw Normal View History

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