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:
NiLuJe
2021-05-18 20:54:54 +02:00
parent a665901c51
commit d56a944b79
10 changed files with 69 additions and 14 deletions

View File

@@ -443,7 +443,7 @@ function ReaderUI:init()
if ReaderUI.instance == nil then
logger.dbg("Spinning up new ReaderUI instance", tostring(self))
else
-- Should never happen, given what we did above...
-- Should never happen, given what we did in (do)showReader...
logger.err("ReaderUI instance mismatch! Opened", tostring(self), "while we still have an existing instance:", tostring(ReaderUI.instance), debug.traceback())
end
ReaderUI.instance = self
@@ -504,6 +504,8 @@ function ReaderUI:onSetupShowReader()
end
--- @note: Will sanely close existing FileManager/ReaderUI instance for you!
--- This is the *only* safe way to instantiate a new ReaderUI instance!
--- (i.e., don't look at the testsuite, which resorts to all kinds of nasty hacks).
function ReaderUI:showReader(file, provider)
logger.dbg("show reader ui")