fix: only show reader status at the end of the book

This commit is contained in:
Qingping Hou
2016-02-21 17:46:19 -08:00
parent 69f9ebd528
commit 8c01835458
7 changed files with 118 additions and 46 deletions

View File

@@ -45,6 +45,17 @@ describe("Readerrolling module", function()
assert.are.same(toc:getPreviousChapter(i, 0), rolling.current_page)
end
end)
it("should emit EndOfBook event at the end", function()
rolling:gotoPage(readerui.document:getPageCount())
local called = false
readerui.onEndOfBook = function()
called = true
end
rolling:onGotoViewRel(1)
rolling:onGotoViewRel(1)
assert.is.truthy(called)
readerui.onEndOfBook = nil
end)
end)
describe("test in landscape screen mode", function()
it("should go to landscape screen mode", function()
@@ -81,6 +92,17 @@ describe("Readerrolling module", function()
assert.are.same(toc:getPreviousChapter(i, 0), rolling.current_page)
end
end)
it("should emit EndOfBook event at the end", function()
rolling:gotoPage(readerui.document:getPageCount())
local called = false
readerui.onEndOfBook = function()
called = true
end
rolling:onGotoViewRel(1)
rolling:onGotoViewRel(1)
assert.is.truthy(called)
readerui.onEndOfBook = nil
end)
end)
describe("switching screen mode should not change current page number", function()
it("for portrait-landscape-portrait switching", function()