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) <noreply@anthropic.com>
This commit is contained in:
39
init.lua
39
init.lua
@@ -1630,6 +1630,45 @@ local function self_test()
|
|||||||
actions.erase_cell_material_at(5, 5)
|
actions.erase_cell_material_at(5, 5)
|
||||||
engine.test.equals(maps.get_cell_material(layer, 5, 5), false,
|
engine.test.equals(maps.get_cell_material(layer, 5, 5), false,
|
||||||
"t10: erase_cell_material_at clears the flag")
|
"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
|
end
|
||||||
|
|
||||||
-- =====================================================================
|
-- =====================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user