2014-11-21 10:32:43 +00:00
|
|
|
describe("Readerdictionary module", function()
|
2016-04-19 06:50:36 +00:00
|
|
|
local DocumentRegistry, ReaderUI, lfs, UIManager, Screen, Event, DEBUG
|
|
|
|
|
|
|
|
setup(function()
|
|
|
|
require("commonrequire")
|
|
|
|
DocumentRegistry = require("document/documentregistry")
|
|
|
|
ReaderUI = require("apps/reader/readerui")
|
|
|
|
lfs = require("libs/libkoreader-lfs")
|
|
|
|
UIManager = require("ui/uimanager")
|
|
|
|
Screen = require("device").screen
|
|
|
|
Event = require("ui/event")
|
|
|
|
DEBUG = require("dbg")
|
|
|
|
end)
|
|
|
|
|
2014-11-21 10:32:43 +00:00
|
|
|
local readerui, rolling, dictionary
|
|
|
|
setup(function()
|
2016-04-19 06:50:36 +00:00
|
|
|
local sample_epub = "spec/front/unit/data/leaves.epub"
|
2014-11-21 10:32:43 +00:00
|
|
|
readerui = ReaderUI:new{
|
|
|
|
document = DocumentRegistry:openDocument(sample_epub),
|
|
|
|
}
|
|
|
|
rolling = readerui.rolling
|
|
|
|
dictionary = readerui.dictionary
|
|
|
|
end)
|
|
|
|
it("should show quick lookup window", function()
|
|
|
|
local name = "screenshots/reader_dictionary.png"
|
|
|
|
UIManager:quit()
|
|
|
|
UIManager:show(readerui)
|
2016-03-27 22:39:47 +00:00
|
|
|
rolling:onGotoPage(100)
|
2014-11-21 10:32:43 +00:00
|
|
|
dictionary:onLookupWord("test")
|
|
|
|
UIManager:scheduleIn(1, function()
|
2014-11-21 10:45:07 +00:00
|
|
|
UIManager:close(dictionary.dict_window)
|
2014-11-21 10:32:43 +00:00
|
|
|
UIManager:close(readerui)
|
|
|
|
end)
|
|
|
|
UIManager:run()
|
|
|
|
Screen:shot(name)
|
|
|
|
end)
|
|
|
|
end)
|