Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions common/testing/infologtest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

local maxErrors = 10

function skip()
local function skip()
-- TODO: re-enable. disabled 2025-10-01 in order to get CICD working
return true
end
Expand Down Expand Up @@ -48,9 +48,11 @@ local function infologTest()
return errors
end

function test()
local function test()
local errors = infologTest()
if #errors > 0 then
error(table.concat(errors, "\n"), 0)
end
end

return { skip = skip, test = test }
10 changes: 6 additions & 4 deletions luaui/Tests/cmd_blueprint/test_cmd_blueprint_filter.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
local widgetName = "Blueprint"

function skip()
local function skip()
-- TODO re-enable and debug. Disabled 2025-09-30 to unblock CICD
-- return Spring.GetGameFrame() <= 0
return true
end

function setup()
local function setup()
assert(widgetHandler.knownWidgets[widgetName] ~= nil)

Test.clearMap()
Expand All @@ -20,14 +20,14 @@ function setup()
})
end

function cleanup()
local function cleanup()
Test.clearMap()

Spring.SetCameraState(initialCameraState)
end

local delay = 5
function test()
local function test()
assert(widget)

mock_saveBlueprintsToFile = Test.mock(widget, "saveBlueprintsToFile")
Expand Down Expand Up @@ -81,3 +81,5 @@ function test()
widget.handleBlueprintDeleteAction()
assert(widget.selectedBlueprintIndex == nil, widget.selectedBlueprintIndex)
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/cmd_blueprint/test_cmd_blueprint_line.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
local widgetName = "Blueprint"

function skip()
local function skip()
return not Platform.gl
end

function setup()
local function setup()
assert(widgetHandler.knownWidgets[widgetName] ~= nil)

Test.clearMap()
Expand All @@ -21,14 +21,14 @@ function setup()
})
end

function cleanup()
local function cleanup()
Test.clearMap()

Spring.SetCameraState(initialCameraState)
end

local delay = 5
function test()
local function test()
widget = widgetHandler:FindWidget(widgetName)
assert(widget)

Expand Down Expand Up @@ -105,3 +105,5 @@ function test()
assert(#builderQueue == bpCount, #builderQueue)
assertEqual(builderQueue[1].id, -blueprintUnitDefID)
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
8 changes: 5 additions & 3 deletions luaui/Tests/cmd_blueprint/test_cmd_blueprint_single.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local widgetName = "Blueprint"

function setup()
local function setup()
assert(widgetHandler.knownWidgets[widgetName] ~= nil)

Test.clearMap()
Expand All @@ -16,14 +16,14 @@ function setup()
})
end

function cleanup()
local function cleanup()
Test.clearMap()

Spring.SetCameraState(initialCameraState)
end

local delay = 5
function test()
local function test()
widget = widgetHandler:FindWidget(widgetName)
assert(widget)

Expand Down Expand Up @@ -82,3 +82,5 @@ function test()
assertEqual(#builderQueue, 1)
assertEqual(builderQueue[1].id, -blueprintUnitDefID)
end

return { setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/cmd_stop_selfd/test_cmd_stop_selfd.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
function skip()
local function skip()
return Spring.GetGameFrame() <= 0
end

function setup()
local function setup()
Test.clearMap()
-- Enable UnitCommand callin for tests
Test.expectCallin("UnitCommand")
end

function cleanup()
local function cleanup()
Test.clearMap()
end

function test()
local function test()
widget = widgetHandler:FindWidget("Stop means Stop")
assert(widget, "Stop means Stop widget not found via FindWidget")

Expand Down Expand Up @@ -45,3 +45,5 @@ function test()
assertEqual(Spring.GetUnitSelfDTime(unitID), 0, string.format("GetUnitSelfDTime after stop of queued selfd: expected 0, got %d", Spring.GetUnitSelfDTime(unitID)))
assertEqual(Spring.GetUnitCommandCount(unitID), 0, string.format("GetUnitCommandCount after stop of queued selfd: expected 0, got %d", Spring.GetUnitCommandCount(unitID)))
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
12 changes: 7 additions & 5 deletions luaui/Tests/critters/test_critters.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
function skip()
local function skip()
-- TODO re-enable and debug. Disabled 2025-12-22 to unblock CICD
return true
end

function setup()
local function setup()
Test.clearMap()
Test.levelHeightMap()

Spring.SendCommands("globallos")
Spring.SendCommands("setspeed 5")
end

function cleanup()
local function cleanup()
Spring.SendCommands("globallos")
Spring.SendCommands("setspeed 1")

Test.clearMap()
end

function runCritterTest()
local function runCritterTest()
local WAIT_FRAMES = 204 -- enough to trigger critter cleanup/restoring by gaia_critters
local unitName = "armpw"
local critterName = "critter_crab"
Expand Down Expand Up @@ -188,6 +188,8 @@ function runCritterTest()
assert(countAliveCritters() == 36)
end

function test()
local function test()
runCritterTest()
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/gui_selfd_icons/test_gui_selfd_icons_armpw.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
local widgetName = "Self-Destruct Icons"

function skip()
local function skip()
return Spring.GetGameFrame() <= 0
end

function setup()
local function setup()
Test.clearMap()

Test.prepareWidget(widgetName)
Test.expectCallin("UnitCommand")
end

function cleanup()
local function cleanup()
Test.clearMap()
end

function test()
local function test()
widget = widgetHandler:FindWidget(widgetName)
assert(widget)

Expand Down Expand Up @@ -54,3 +54,5 @@ function test()
return table.count(widget.activeSelfD) == 1 and table.count(widget.queuedSelfD) == 0
end, 10)
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/gui_selfd_icons/test_gui_selfd_icons_armvp.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
local widgetName = "Self-Destruct Icons"

function skip()
local function skip()
return Spring.GetGameFrame() <= 0
end

function setup()
local function setup()
Test.clearMap()

Test.prepareWidget(widgetName)
Test.expectCallin("UnitCommand")
end

function cleanup()
local function cleanup()
Test.clearMap()
end

function test()
local function test()
widget = widgetHandler:FindWidget(widgetName)
assert(widget)

Expand Down Expand Up @@ -49,3 +49,5 @@ function test()
--assert(table.count(widget.activeSelfD) == 0)
--assert(table.count(widget.queuedSelfD) == 0)
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/mex-building/pregame_mex_queue.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function skip()
local function skip()
return Spring.GetGameFrame() > 0
end

-- Test whether mexes are able to clear queued buildings by shift-clicking
function setup()
local function setup()
Test.clearMap()

local widget_cmd_extractor_snap = widgetHandler:FindWidget("Extractor Snap (mex/geo)")
Expand All @@ -25,7 +25,7 @@ function setup()
Test.waitTime(10)
end

function cleanup()
local function cleanup()
Test.clearMap()

WG["pregame-build"].setBuildQueue({})
Expand All @@ -35,7 +35,7 @@ function cleanup()
end

-- tests both pregame mex snap behavior, as well as basic queue and blueprint handling
function test()
local function test()
local mexUnitDefId = UnitDefNames["armmex"].id
local metalSpots = WG["resource_spot_finder"].metalSpotsList

Expand Down Expand Up @@ -104,3 +104,5 @@ function test()
local buildQueue = WG["pregame-build"].getBuildQueue()
assert(#buildQueue == 0, "Build queue should be empty")
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/mex-building/pregame_mex_snap.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function skip()
local function skip()
return Spring.GetGameFrame() > 0
end

function setup()
local function setup()
Test.clearMap()

widget_cmd_extractor_snap = widgetHandler:FindWidget("Extractor Snap (mex/geo)")
Expand All @@ -24,7 +24,7 @@ function setup()
Test.waitTime(10)
end

function cleanup()
local function cleanup()
Test.clearMap()

WG["pregame-build"].setBuildQueue({})
Expand All @@ -33,7 +33,7 @@ function cleanup()
Spring.SetCameraState(initialCameraState)
end

function test()
local function test()
mexUnitDefId = UnitDefNames["armmex"].id
metalSpots = WG["resource_spot_finder"].metalSpotsList

Expand Down Expand Up @@ -81,3 +81,5 @@ function test()
0,
}, 0.1)
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/select_api/compare_to_spring.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ local selectApi = VFS.Include("luaui/Include/select_api.lua")
local nameLookup = {}
local passed = true

function skip()
local function skip()
return Spring.GetGameFrame() <= 0 or not Platform.gl
end

function setup()
local function setup()
Test.clearMap()
end

function cleanup()
local function cleanup()
Spring.SendCommands("setspeed " .. 1)
end

Expand Down Expand Up @@ -227,7 +227,7 @@ end
-- for each filter, the sum of {{filter}} and Not_{{filter}} always equals 537.
-- this means 6 units are being created but then not included in the tests
-- could be 'dbg_sphere' 'dbg_sphere_fullmetal' 'pbr_cube'
function test()
local function test()
passed = true
local uids = createUnits()
local halfSize = math.floor(#uids / 2)
Expand Down Expand Up @@ -342,3 +342,5 @@ function test()
end
assert(passed, "read errors above")
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
Loading
Loading