Add function to get window visibility

Closes #562

Co-authored-by: devomaa <lmao@distruzione.org>
This commit is contained in:
SquidDev 2020-10-31 09:54:38 +00:00
parent 113b560a20
commit c334423d42
2 changed files with 21 additions and 0 deletions

View File

@ -474,6 +474,14 @@ function create(parent, nX, nY, nWidth, nHeight, bStartVisible)
end
end
--- Get whether this window is visible. Invisible windows will not be
-- drawn to the screen until they are made visible again.
--
-- @treturn boolean Whether this window is visible.
-- @see Window:setVisible
function window.isVisible()
return bVisible
end
--- Draw this window. This does nothing if the window is not visible.
--
-- @see Window:setVisible

View File

@ -157,4 +157,17 @@ describe("The window library", function()
expect({ w.getLine(1) }):same { "test ", "aaaa0", "4444f" }
end)
end)
describe("Window.setVisible", function()
it("validates arguments", function()
local w = mk()
expect.error(w.setVisible, nil):eq("bad argument #1 (expected boolean, got nil)")
end)
end)
describe("Window.isVisible", function()
it("gets window visibility", function()
local w = mk()
w.setVisible(false)
expect(w.isVisible()):same(false)
end)
end)
end)