test: fix readerui instance reset test

pull/1825/head
Qingping Hou 8 years ago
parent 72e7cd5cf4
commit 03e81cfa4d

@ -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)

Loading…
Cancel
Save