mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
test: fix readerui instance reset test
This commit is contained in:
@@ -390,6 +390,10 @@ function ReaderUI:doShowReader(file)
|
||||
running_instance = reader
|
||||
end
|
||||
|
||||
function ReaderUI:_getRunningInstance()
|
||||
return running_instance
|
||||
end
|
||||
|
||||
function ReaderUI:unlockDocumentWithPassword(document, try_again)
|
||||
DEBUG("show input password dialog")
|
||||
self.password_dialog = InputDialog:new{
|
||||
|
||||
@@ -35,10 +35,13 @@ describe("Readerui module", function()
|
||||
assert(readerui.document == nil)
|
||||
end)
|
||||
it("should not reset running_instance by mistake", function()
|
||||
assert.is.truthy(readerui.document)
|
||||
ReaderUI:doShowReader(sample_epub)
|
||||
local new_readerui = ReaderUI:_getRunningInstance()
|
||||
assert.is.truthy(new_readerui.document)
|
||||
ReaderUI:new{
|
||||
document = DocumentRegistry:openDocument(sample_epub)
|
||||
}:onClose()
|
||||
assert.is.truthy(readerui.document)
|
||||
assert.is.truthy(new_readerui.document)
|
||||
new_readerui:onClose()
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user