From 340dd5f70074ff435b4dbb9b1d87f9fc616b89a8 Mon Sep 17 00:00:00 2001 From: Calic Date: Mon, 1 Jun 2026 23:07:31 +0200 Subject: [PATCH] test(map-editor): t11 confirms Edit-menu disable covers Cell-Tile The existing `disabled = function() return not mode_is("direct") end` predicate already covers Cell-Tile mode (which is also non-direct). Self-test t11 enumerates the three transform items across all three modes and confirms each is disabled in auto-tile AND cell-tile, enabled only in direct. Co-Authored-By: Claude Opus 4.7 (1M context) --- init.lua | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/init.lua b/init.lua index b1b89ab..7a537fd 100644 --- a/init.lua +++ b/init.lua @@ -1630,6 +1630,45 @@ local function self_test() actions.erase_cell_material_at(5, 5) engine.test.equals(maps.get_cell_material(layer, 5, 5), false, "t10: erase_cell_material_at clears the flag") + + -- t11: Cycle Rotation / Toggle Flip / Reset Transform are disabled + -- in both auto-tile AND cell-tile modes; enabled only in direct. + local target_labels = { "Cycle Rotation", "Toggle Flip", "Reset Transform" } + for _, label in ipairs(target_labels) do + state.set_mode("auto-tile") + for _, it in ipairs(ui._EDIT_ITEMS) do + if it.label == label then + local d = it.disabled + local is_disabled = (type(d) == "function") and d() or (d == true) + engine.test.equals(is_disabled, true, + "t11: " .. label .. " disabled in auto-tile mode") + break + end + end + state.set_mode("cell-tile") + for _, it in ipairs(ui._EDIT_ITEMS) do + if it.label == label then + local d = it.disabled + local is_disabled = (type(d) == "function") and d() or (d == true) + engine.test.equals(is_disabled, true, + "t11: " .. label .. " disabled in cell-tile mode") + break + end + end + state.set_mode("direct") + for _, it in ipairs(ui._EDIT_ITEMS) do + if it.label == label then + local d = it.disabled + local is_disabled = (type(d) == "function") and d() or (d == true) + engine.test.equals(is_disabled, false, + "t11: " .. label .. " enabled in direct mode") + break + end + end + end + + -- t11 teardown: restore auto-tile so we don't leave state in direct + state.set_mode("auto-tile") end -- =====================================================================