mirror of
https://github.com/koreader/koreader
synced 2024-11-11 19:11:14 +00:00
26 lines
819 B
Lua
26 lines
819 B
Lua
describe("TextBoxWidget module", function()
|
|
local TextBoxWidget, Font
|
|
setup(function()
|
|
require("commonrequire")
|
|
Font = require("ui/font")
|
|
TextBoxWidget = require("ui/widget/textboxwidget")
|
|
end)
|
|
|
|
it("should select the correct word on HoldWord event", function()
|
|
local tw = TextBoxWidget:new{
|
|
dimen = {x = 0, y = 0},
|
|
face = Font:getFace("cfont", 25),
|
|
text = 'YOOOOOOOOOOOOOOOO\nFoo.\nBar.',
|
|
}
|
|
tw:onHoldWord(function(w)
|
|
assert.is.same(w, 'YOOOOOOOOOOOOOOOO')
|
|
end, {pos={x=110,y=4}})
|
|
tw:onHoldWord(function(w)
|
|
assert.is.same(w, 'Foo')
|
|
end, {pos={x=0,y=50}})
|
|
tw:onHoldWord(function(w)
|
|
assert.is.same(w, 'Bar')
|
|
end, {pos={x=20,y=80}})
|
|
end)
|
|
end)
|