mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
readerrolling(fix): do not emit PageUpdate event until document is ready
This commit is contained in:
@@ -182,4 +182,20 @@ describe("Readerrolling module", function()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("test initialization", function()
|
||||
it("should emit PageUpdate event after book is rendered", function()
|
||||
local ReaderView = require("apps/reader/modules/readerview")
|
||||
local saved_handler = ReaderView.onPageUpdate
|
||||
ReaderView.onPageUpdate = function(_self)
|
||||
assert.are.same(7, _self.ui.document:getPageCount())
|
||||
end
|
||||
local test_book = "spec/front/unit/data/sample.txt"
|
||||
require("docsettings"):open(test_book):purge()
|
||||
ReaderUI:new{
|
||||
document = DocumentRegistry:openDocument(test_book),
|
||||
}
|
||||
ReaderView.onPageUpdate = saved_handler
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user