tests: factorize UI related helpers

This commit is contained in:
Benoit Pierre
2024-12-25 15:46:06 +01:00
committed by Frans de Jonge
parent 480eb7e142
commit f1b522acb9
6 changed files with 51 additions and 57 deletions

View File

@@ -75,3 +75,17 @@ function load_plugin(name)
end
assert(false)
end
function fastforward_ui_events()
local UIManager = require("ui/uimanager")
-- Fast forward all scheduled tasks.
UIManager:shiftScheduledTasksBy(-1e9)
-- Fix hang when running tests with our docker base image SDL.
UIManager:setInputTimeout(0)
-- And run the UI manager's input loop once.
UIManager:handleInput()
end
function screenshot(screen, filename)
screen:shot(DataStorage:getDataDir() .. "/screenshots/" .. filename)
end