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
|
running_instance = reader
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ReaderUI:_getRunningInstance()
|
||||||
|
return running_instance
|
||||||
|
end
|
||||||
|
|
||||||
function ReaderUI:unlockDocumentWithPassword(document, try_again)
|
function ReaderUI:unlockDocumentWithPassword(document, try_again)
|
||||||
DEBUG("show input password dialog")
|
DEBUG("show input password dialog")
|
||||||
self.password_dialog = InputDialog:new{
|
self.password_dialog = InputDialog:new{
|
||||||
|
|||||||
@@ -35,10 +35,13 @@ describe("Readerui module", function()
|
|||||||
assert(readerui.document == nil)
|
assert(readerui.document == nil)
|
||||||
end)
|
end)
|
||||||
it("should not reset running_instance by mistake", function()
|
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{
|
ReaderUI:new{
|
||||||
document = DocumentRegistry:openDocument(sample_epub)
|
document = DocumentRegistry:openDocument(sample_epub)
|
||||||
}:onClose()
|
}:onClose()
|
||||||
assert.is.truthy(readerui.document)
|
assert.is.truthy(new_readerui.document)
|
||||||
|
new_readerui:onClose()
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user