Run Lua integration tests starting with menu script

This allows writing tests for menu scripts.

Keep global script as entry point to morrowind tests.

Fix menu.newGame and menu.loadGame to hide main menu.
This commit is contained in:
elsid 2025-02-26 00:55:22 +01:00
parent 7a9c2d5e88
commit 0e19b1dd75
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
8 changed files with 167 additions and 51 deletions

View file

@ -40,7 +40,7 @@ local function rotateByPitch(object, target)
rotate(object, target, nil)
end
testing.registerLocalTest('playerYawRotation',
testing.registerLocalTest('player yaw rotation',
function()
local initialAlphaXZ, initialGammaXZ = self.rotation:getAnglesXZ()
local initialAlphaZYX, initialBetaZYX, initialGammaZYX = self.rotation:getAnglesZYX()
@ -60,7 +60,7 @@ testing.registerLocalTest('playerYawRotation',
testing.expectEqualWithDelta(gamma2, initialGammaZYX, 0.05, 'Gamma rotation in ZYX convention should not change')
end)
testing.registerLocalTest('playerPitchRotation',
testing.registerLocalTest('player pitch rotation',
function()
local initialAlphaXZ, initialGammaXZ = self.rotation:getAnglesXZ()
local initialAlphaZYX, initialBetaZYX, initialGammaZYX = self.rotation:getAnglesZYX()
@ -80,7 +80,7 @@ testing.registerLocalTest('playerPitchRotation',
testing.expectEqualWithDelta(gamma2, targetPitch, 0.05, 'Incorrect gamma rotation in ZYX convention')
end)
testing.registerLocalTest('playerPitchAndYawRotation',
testing.registerLocalTest('player pitch and yaw rotation',
function()
local targetPitch = math.rad(-30)
local targetYaw = math.rad(-60)
@ -99,7 +99,7 @@ testing.registerLocalTest('playerPitchAndYawRotation',
testing.expectEqualWithDelta(gamma2, math.rad(-16), 0.05, 'Incorrect gamma rotation in ZYX convention')
end)
testing.registerLocalTest('playerRotation',
testing.registerLocalTest('player rotation',
function()
local rotation = math.sqrt(2)
local endTime = core.getSimulationTime() + 3
@ -123,7 +123,7 @@ testing.registerLocalTest('playerRotation',
end
end)
testing.registerLocalTest('playerForwardRunning',
testing.registerLocalTest('player forward running',
function()
local startPos = self.position
local endTime = core.getSimulationTime() + 1
@ -141,7 +141,7 @@ testing.registerLocalTest('playerForwardRunning',
testing.expectEqualWithDelta(direction.y, 1, 0.1, 'Run forward, Y coord')
end)
testing.registerLocalTest('playerDiagonalWalking',
testing.registerLocalTest('player diagonal walking',
function()
local startPos = self.position
local endTime = core.getSimulationTime() + 1
@ -220,7 +220,7 @@ testing.registerLocalTest('findNearestNavMeshPosition',
'Navigation mesh position ' .. testing.formatActualExpected(result, expected))
end)
testing.registerLocalTest('playerMemoryLimit',
testing.registerLocalTest('player memory limit',
function()
local ok, err = pcall(function()
local str = 'a'
@ -232,7 +232,7 @@ testing.registerLocalTest('playerMemoryLimit',
testing.expectEqual(err, 'not enough memory')
end)
testing.registerLocalTest('playerWeaponAttack',
testing.registerLocalTest('player weapon attack',
function()
camera.setMode(camera.MODE.ThirdPerson)