From 0e3d8377d8d4541db4d51fd2ee9c117f48dd44df Mon Sep 17 00:00:00 2001 From: Alistair-Afton Date: Thu, 17 Sep 2026 19:59:00 +0200 Subject: [PATCH 1/2] notes test: pause the game while the overlay is installed The notes overlay only draws map pins when the game is paused (in text mode). Pausing during test setup instead of relying on ambient pause state makes the tests robust against earlier tests leaving the game unpaused. --- test/overlay/notes.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/overlay/notes.lua b/test/overlay/notes.lua index 401e02af94..ef44b70253 100644 --- a/test/overlay/notes.lua +++ b/test/overlay/notes.lua @@ -14,10 +14,16 @@ config = { local map_points_backup = nil local was_overlay_enabled = overlay.isEnabled() +local was_paused = nil local function install_notes_overlay(options) options = options or {} + -- the overlay does not draw note pins in text mode unless the game is + -- paused, so don't depend on whatever pause state the test harness left + was_paused = df.global.pause_state + df.global.pause_state = true + map_points_backup = utils.clone(map_points) map_points:resize(0) @@ -51,6 +57,11 @@ local function cleanup(notes_overlay) end map_points_backup = nil + if was_paused ~= nil then + df.global.pause_state = was_paused + was_paused = nil + end + reload_notes() overlay.setEnabled(was_overlay_enabled) From cfdefba3623118e281a9c5f2ecfa77f95ba06ac6 Mon Sep 17 00:00:00 2001 From: Alistair-Afton Date: Thu, 17 Sep 2026 20:58:00 +0200 Subject: [PATCH 2/2] notes test: use dfhack.world pause API instead of raw pause_state --- test/overlay/notes.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/overlay/notes.lua b/test/overlay/notes.lua index ef44b70253..506a8caccd 100644 --- a/test/overlay/notes.lua +++ b/test/overlay/notes.lua @@ -21,8 +21,8 @@ local function install_notes_overlay(options) -- the overlay does not draw note pins in text mode unless the game is -- paused, so don't depend on whatever pause state the test harness left - was_paused = df.global.pause_state - df.global.pause_state = true + was_paused = dfhack.world.ReadPauseState() + dfhack.world.SetPauseState(true) map_points_backup = utils.clone(map_points) map_points:resize(0) @@ -58,7 +58,7 @@ local function cleanup(notes_overlay) map_points_backup = nil if was_paused ~= nil then - df.global.pause_state = was_paused + dfhack.world.SetPauseState(was_paused) was_paused = nil end