1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 21:15:36 +00:00

Merge branch 'integration_tests_built_in' into 'master'

Enable built-in script in the integration tests

See merge request OpenMW/openmw!4289
This commit is contained in:
psi29a 2024-08-02 20:50:25 +00:00
commit 07c89c4f84
4 changed files with 13 additions and 7 deletions

View file

@ -1 +0,0 @@
# It is an empty file that overrides builtin.omwscripts and disables builtin scripts

View file

@ -220,7 +220,7 @@ testing.registerLocalTest('findNearestNavMeshPosition',
return { return {
engineHandlers = { engineHandlers = {
onUpdate = testing.updateLocal, onFrame = testing.updateLocal,
}, },
eventHandlers = testing.eventHandlers eventHandlers = testing.eventHandlers
} }

View file

@ -1,3 +1,2 @@
GLOBAL: test.lua GLOBAL: test.lua
PLAYER: player.lua PLAYER: player.lua

View file

@ -31,8 +31,12 @@ function M.runLocalTest(obj, name)
currentLocalTest = name currentLocalTest = name
currentLocalTestError = nil currentLocalTestError = nil
obj:sendEvent('runLocalTest', name) obj:sendEvent('runLocalTest', name)
while currentLocalTest do coroutine.yield() end while currentLocalTest do
if currentLocalTestError then error(currentLocalTestError, 2) end coroutine.yield()
end
if currentLocalTestError then
error(currentLocalTestError, 2)
end
end end
function M.expect(cond, delta, msg) function M.expect(cond, delta, msg)
@ -181,7 +185,9 @@ end
function M.updateLocal() function M.updateLocal()
if localTestRunner and coroutine.status(localTestRunner) ~= 'dead' then if localTestRunner and coroutine.status(localTestRunner) ~= 'dead' then
coroutine.resume(localTestRunner) if not core.isWorldPaused() then
coroutine.resume(localTestRunner)
end
else else
localTestRunner = nil localTestRunner = nil
end end
@ -196,7 +202,9 @@ M.eventHandlers = {
end end
localTestRunner = coroutine.create(function() localTestRunner = coroutine.create(function()
local status, err = pcall(fn) local status, err = pcall(fn)
if status then err = nil end if status then
err = nil
end
core.sendGlobalEvent('localTestFinished', {name=name, errMsg=err}) core.sendGlobalEvent('localTestFinished', {name=name, errMsg=err})
end) end)
end, end,