3
0
mirror of https://github.com/britzl/monarch.git synced 2025-09-28 02:22:20 +02:00

Added helpers for common sets of transitions

This commit is contained in:
Björn Ritzl
2018-06-16 22:43:25 +02:00
parent 091fab0c7f
commit d1cf8281c9
11 changed files with 367 additions and 18 deletions

View File

@@ -7,6 +7,7 @@ local SCREEN2 = hash("screen2")
local POPUP1 = hash("popup1")
local POPUP2 = hash("popup2")
local FOOBAR = hash("foobar")
local TRANSITION1 = hash("transition1")
return function()
@@ -35,6 +36,9 @@ return function()
local function wait_until_hidden(screen_id)
return wait_timeout(is_hidden, screen_id)
end
local function wait_until_not_busy()
return wait_timeout(function() return not monarch.is_busy() end)
end
local function assert_stack(expected_screens)
local actual_screens = monarch.get_stack()
@@ -155,7 +159,7 @@ return function()
assert_stack({ SCREEN1 })
assert(monarch.show(SCREEN2) == true)
assert(wait_until_shown(SCREEN2), "Screen1 was never shown")
assert(wait_until_shown(SCREEN2), "Screen2 was never shown")
assert_stack({ SCREEN1, SCREEN2 })
assert(monarch.back() == true)
@@ -218,5 +222,12 @@ return function()
assert(monarch.bottom(0) == SCREEN1)
assert(monarch.bottom(1) == SCREEN2)
end)
it("should be busy while transition is running", function()
monarch.show(TRANSITION1)
assert(wait_until_shown(TRANSITION1), "Transition1 was never shown")
assert(monarch.is_busy())
assert(wait_until_not_busy())
end)
end)
end