2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
koreader/spec/unit/size_spec.lua
2017-09-23 20:24:45 +02:00

32 lines
1.3 KiB
Lua

describe("Size module", function()
local Size
setup(function()
require("commonrequire")
Size = require("ui/size")
end)
describe("should get size", function()
it("for window border", function()
assert.is_true(Size.border.window >= 1)
end)
end)
it("should be nil for non-existent property", function()
assert.is_nil(Size.supercalifragilisticexpialidocious)
assert.is_nil(Size.border.supercalifragilisticexpialidocious)
end)
it("should fail for non-existent property when debug is activated", function()
local dbg = require("dbg")
dbg:turnOn()
Size = package.reload("ui/size")
local supercalifragilisticexpialidocious1 = function()
return Size.supercalifragilisticexpialidocious
end
local supercalifragilisticexpialidocious2 = function()
return Size.border.supercalifragilisticexpialidocious
end
assert.has_error(supercalifragilisticexpialidocious1, "Size: this property does not exist: Size.supercalifragilisticexpialidocious")
assert.has_error(supercalifragilisticexpialidocious2, "Size: this property does not exist: Size.border.supercalifragilisticexpialidocious")
dbg:turnOff()
end)
end)