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

Make sure focus_lost messages is received

Fixes #42
This commit is contained in:
Björn Ritzl
2019-03-17 21:50:01 +01:00
parent b57609f061
commit 05f91dd763
8 changed files with 278 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ local SCREEN1_STR = hash("screen1")
local SCREEN1 = hash(SCREEN1_STR)
local SCREEN2 = hash("screen2")
local SCREEN_PRELOAD = hash("screen_preload")
local FOCUS1 = hash("focus1")
local BACKGROUND = hash("background")
local POPUP1 = hash("popup1")
local POPUP2 = hash("popup2")
@@ -405,5 +406,21 @@ return function()
-- second time the screen gets shown it will be reloaded and increment the count
assert(monarch.data(SCREEN_PRELOAD).count == 2)
end)
it("should send focus messages", function()
_G.focus1_gained = nil
_G.focus1_lost = nil
monarch.show(SCREEN1)
assert(wait_until_shown(SCREEN1), "Screen1 was never shown")
monarch.show(FOCUS1)
assert(wait_until_shown(FOCUS1), "Screen1 was never shown")
assert(_G.focus1_gained)
monarch.show(SCREEN1)
assert(wait_until_shown(SCREEN1), "Screen1 was never shown")
assert(wait_until_hidden(FOCUS1), "Focus1 was never hidden")
assert(_G.focus1_lost)
end)
end)
end