From e62e6d9a7ab43b0fc4ab430e28b6f16654a2b79a Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 12 Apr 2025 14:33:31 -0700 Subject: [PATCH] fix overlay interactions in gui/notes unit tests --- gui/notes.lua | 3 +-- test/gui/notes.lua | 18 +++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/gui/notes.lua b/gui/notes.lua index 4d8eee7d4..9ad4d8f82 100644 --- a/gui/notes.lua +++ b/gui/notes.lua @@ -361,8 +361,7 @@ function main() qerror('notes requires a fortress map to be loaded') end - view = view and view:raise() or NotesScreen{ - }:show() + view = view and view:raise() or NotesScreen{}:show() end if not dfhack_flags.module then diff --git a/test/gui/notes.lua b/test/gui/notes.lua index 9bb1c7ac7..815ba7bfa 100644 --- a/test/gui/notes.lua +++ b/test/gui/notes.lua @@ -39,21 +39,21 @@ end local function arrange_gui_notes(options) options = options or {} + -- running tests removes all overlays because of IN_TEST reloading. + -- rescan so we can load the gui/notes widget for these tests + overlay.rescan() + arrange_notes(options.notes) gui_notes.main() - local gui_notes = gui_notes.view - gui_notes.enable_selector_blink = false + local view = gui_notes.view + view.enable_selector_blink = false - gui_notes:updateLayout() - gui_notes:onRender() - - -- for some reasons running tests remove all overlays, - -- but there are need for gui/notes tests - overlay.rescan() + view:updateLayout() + view:onRender() - return gui_notes, gui_notes.subviews.notes_window + return view, view.subviews.notes_window end local function cleanup(gui_notes)