[spec] _task_queue has to be sorted! (#9694)

This commit is contained in:
zwim
2022-10-27 21:14:25 +02:00
committed by GitHub
parent d37803a8e7
commit 88add4ed6f

View File

@@ -188,16 +188,17 @@ describe("UIManager spec", function()
end end
UIManager:quit() UIManager:quit()
UIManager._task_queue = { UIManager._task_queue = {
{ time = now - time.us(5), action = task_to_remove, args = {} }, { time = now - time.s(15), action = task_to_remove, args = {} }, -- this will be called
{ {
time = now - time.s(10), time = now - time.s(10),
action = function() action = function() -- this will be called, too
run_count = run_count + 1 run_count = run_count + 1
UIManager:unschedule(task_to_remove) UIManager:unschedule(task_to_remove)
end, end,
args = {}, args = {},
}, },
{ time = now, action = task_to_remove, args = {} }, { time = now - time.us(5), action = task_to_remove, args = {} }, -- this will be removed
{ time = now, action = task_to_remove, args = {} }, -- this will be removed
} }
UIManager:_checkTasks() UIManager:_checkTasks()
assert.are.same(2, run_count) assert.are.same(2, run_count)