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

@@ -24,14 +24,17 @@ describe("ReaderBookmark module", function()
UIManager:nextTick(function()
UIManager:close(readerui.highlight.highlight_dialog)
UIManager:close(readerui)
-- We haven't torn it down yet
ReaderUI.instance = readerui
end)
UIManager:run()
end
local function toggler_dogear(readerui)
readerui.bookmark:onToggleBookmark()
--- @todo Replace scheduleIn with nextTick
UIManager:scheduleIn(1, function()
UIManager:nextTick(function()
UIManager:close(readerui)
-- We haven't torn it down yet
ReaderUI.instance = readerui
end)
UIManager:run()
end
@@ -39,6 +42,8 @@ describe("ReaderBookmark module", function()
UIManager:nextTick(function()
UIManager:close(readerui.bookmark.bookmark_menu)
UIManager:close(readerui)
-- We haven't torn it down yet
ReaderUI.instance = readerui
end)
UIManager:run()
end