2023-08-04 10:59:08 -06:00
|
|
|
config.target = 'core'
|
2023-08-04 00:54:14 -06:00
|
|
|
|
2018-07-18 12:29:13 -06:00
|
|
|
function test.getCurViewscreen()
|
|
|
|
local scr = dfhack.gui.getCurViewscreen()
|
|
|
|
local scr2 = df.global.gview.view
|
|
|
|
for i = 1, 100 do
|
|
|
|
if scr2.child then
|
|
|
|
scr2 = scr2.child
|
|
|
|
else
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
expect.eq(scr, scr2)
|
|
|
|
end
|
|
|
|
|
|
|
|
function test.getViewscreenByType()
|
|
|
|
local scr = dfhack.gui.getCurViewscreen()
|
|
|
|
local scr2 = dfhack.gui.getViewscreenByType(scr._type)
|
|
|
|
expect.eq(scr, scr2)
|
|
|
|
|
|
|
|
local bad_type = df.viewscreen_titlest
|
|
|
|
if scr._type == bad_type then
|
2023-08-04 00:54:14 -06:00
|
|
|
bad_type = df.viewscreen_dwarfmodest
|
2018-07-18 12:29:13 -06:00
|
|
|
end
|
|
|
|
local scr_bad = dfhack.gui.getViewscreenByType(bad_type)
|
|
|
|
expect.eq(scr_bad, nil)
|
|
|
|
end
|