Skip to content

Commit c0ea8aa

Browse files
authored
Merge pull request #1435 from myk002/myk_gui_notes_test
fix overlay interactions in gui/notes unit tests
2 parents bbba0a3 + e62e6d9 commit c0ea8aa

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

gui/notes.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,7 @@ function main()
361361
qerror('notes requires a fortress map to be loaded')
362362
end
363363

364-
view = view and view:raise() or NotesScreen{
365-
}:show()
364+
view = view and view:raise() or NotesScreen{}:show()
366365
end
367366

368367
if not dfhack_flags.module then

test/gui/notes.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,21 @@ end
3939
local function arrange_gui_notes(options)
4040
options = options or {}
4141

42+
-- running tests removes all overlays because of IN_TEST reloading.
43+
-- rescan so we can load the gui/notes widget for these tests
44+
overlay.rescan()
45+
4246
arrange_notes(options.notes)
4347

4448
gui_notes.main()
4549

46-
local gui_notes = gui_notes.view
47-
gui_notes.enable_selector_blink = false
50+
local view = gui_notes.view
51+
view.enable_selector_blink = false
4852

49-
gui_notes:updateLayout()
50-
gui_notes:onRender()
51-
52-
-- for some reasons running tests remove all overlays,
53-
-- but there are need for gui/notes tests
54-
overlay.rescan()
53+
view:updateLayout()
54+
view:onRender()
5555

56-
return gui_notes, gui_notes.subviews.notes_window
56+
return view, view.subviews.notes_window
5757
end
5858

5959
local function cleanup(gui_notes)

0 commit comments

Comments
 (0)