mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-02-09 23:50:04 +00:00
Add function to get window visibility
Closes #562 Co-authored-by: devomaa <lmao@distruzione.org>
This commit is contained in:
parent
113b560a20
commit
c334423d42
@ -474,6 +474,14 @@ function create(parent, nX, nY, nWidth, nHeight, bStartVisible)
|
|||||||
end
|
end
|
||||||
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.
|
--- Draw this window. This does nothing if the window is not visible.
|
||||||
--
|
--
|
||||||
-- @see Window:setVisible
|
-- @see Window:setVisible
|
||||||
|
@ -157,4 +157,17 @@ describe("The window library", function()
|
|||||||
expect({ w.getLine(1) }):same { "test ", "aaaa0", "4444f" }
|
expect({ w.getLine(1) }):same { "test ", "aaaa0", "4444f" }
|
||||||
end)
|
end)
|
||||||
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)
|
end)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user