Add restart koreader function and ensure FlushSettings event can be delivered to all widgets (#2772)

This commit is contained in:
Hzj_jie
2017-05-16 02:11:11 -07:00
committed by Qingping Hou
parent 3492b8b117
commit 30378eb2a8
25 changed files with 279 additions and 104 deletions

View File

@@ -43,6 +43,7 @@ describe("Readerfooter module", function()
book_time_to_read = true,
chapter_time_to_read = true,
})
UIManager:run()
end)
it("should setup footer as visible in all_at_once mode", function()

View File

@@ -18,6 +18,7 @@ describe("Readerhighlight module", function()
UIManager:scheduleIn(1, function()
UIManager:close(readerui.dictionary.dict_window)
UIManager:close(readerui)
UIManager:quit()
end)
UIManager:run()
end
@@ -57,6 +58,7 @@ describe("Readerhighlight module", function()
UIManager:nextTick(function()
UIManager:close(readerui.highlight.edit_highlight_dialog)
UIManager:close(readerui)
UIManager:quit()
end)
UIManager:run()
end
@@ -169,6 +171,7 @@ describe("Readerhighlight module", function()
after_each(function()
readerui.highlight:clear()
readerui.document.configurable.text_wrap = 0
UIManager:close(readerui) -- close to flush settings
end)
it("should highlight single word", function()
highlight_single_word(readerui, Geom:new{ x = 260, y = 70 })
@@ -253,6 +256,7 @@ describe("Readerhighlight module", function()
after_each(function()
readerui.highlight:clear()
readerui.document.configurable.text_wrap = 0
UIManager:close(readerui) -- close to flush settings
end)
it("should highlight single word", function()
highlight_single_word(readerui, Geom:new{ x = 260, y = 70 })

View File

@@ -22,7 +22,7 @@ describe("Readerpaging module", function()
it("should emit EndOfBook event at the end", function()
UIManager:quit()
UIManager:show(readerui)
UIManager:scheduleIn(1, function() UIManager:close(readerui) end)
UIManager:nextTick(function() UIManager:close(readerui) end)
UIManager:run()
readerui:handleEvent(Event:new("SetScrollMode", false))
readerui.zooming:setZoomMode("pageheight")
@@ -54,7 +54,7 @@ describe("Readerpaging module", function()
it("should emit EndOfBook event at the end", function()
UIManager:quit()
UIManager:show(readerui)
UIManager:scheduleIn(1, function() UIManager:close(readerui) end)
UIManager:nextTick(function() UIManager:close(readerui) end)
UIManager:run()
paging.page_positions = {}
readerui:handleEvent(Event:new("SetScrollMode", true))
@@ -71,7 +71,7 @@ describe("Readerpaging module", function()
UIManager:quit()
end)
it("should scroll withtout crash backward on the first page", function()
it("should scroll backward on the first page without crash", function()
local sample_djvu = "spec/front/unit/data/djvu3spec.djvu"
local tmp_readerui = ReaderUI:new{
document = DocumentRegistry:openDocument(sample_djvu),
@@ -79,7 +79,7 @@ describe("Readerpaging module", function()
tmp_readerui.paging:onScrollPanRel(-100)
end)
it("should scroll withtout crash forward on the last page", function()
it("should scroll forward on the last page without crash", function()
local sample_djvu = "spec/front/unit/data/djvu3spec.djvu"
local tmp_readerui = ReaderUI:new{
document = DocumentRegistry:openDocument(sample_djvu),

View File

@@ -12,6 +12,8 @@ describe("Readertoc module", function()
readerui = ReaderUI:new{
document = DocumentRegistry:openDocument(sample_epub),
}
-- reset book to first page
readerui.rolling:onGotoPage(0)
toc = readerui.toc
end)

View File

@@ -172,6 +172,7 @@ describe("UIManager spec", function()
assert.truthy(old_reset_timer)
G_reader_settings:saveSetting("auto_suspend_timeout_seconds", 3600)
UIManager:run()
UIManager:quit()
-- should skip on non-kobo devices
UIManager:_initAutoSuspend()