mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Tests: Handle FM/ReaderUI instances slightly more sanely
* Tear down FM instances properly * Don't manhandle ReaderUI too much, and document when the tests do actively broken shit, like bypassing safeties to open two // ReaderUI instances.
This commit is contained in:
@@ -80,6 +80,7 @@ describe("Readerrolling module", function()
|
||||
|
||||
it("should emit EndOfBook event at the end sample txt", function()
|
||||
local sample_txt = "spec/front/unit/data/sample.txt"
|
||||
-- Unsafe second // ReaderUI instance!
|
||||
local txt_readerui = ReaderUI:new{
|
||||
dimen = Screen:getSize(),
|
||||
document = DocumentRegistry:openDocument(sample_txt),
|
||||
@@ -108,6 +109,8 @@ describe("Readerrolling module", function()
|
||||
readerui.onEndOfBook = nil
|
||||
txt_readerui:closeDocument()
|
||||
txt_readerui:onClose()
|
||||
-- Restore the ref to the original ReaderUI instance
|
||||
ReaderUI.instance = readerui
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -207,14 +210,14 @@ describe("Readerrolling module", function()
|
||||
end
|
||||
local test_book = "spec/front/unit/data/sample.txt"
|
||||
require("docsettings"):open(test_book):purge()
|
||||
readerui:closeDocument()
|
||||
readerui:onClose()
|
||||
local tmp_readerui = ReaderUI:new{
|
||||
document = DocumentRegistry:openDocument(test_book),
|
||||
}
|
||||
ReaderView.onPageUpdate = saved_handler
|
||||
tmp_readerui:closeDocument()
|
||||
tmp_readerui:onClose()
|
||||
readerui:closeDocument()
|
||||
readerui:onClose()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user