1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 13:45:34 +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 {
engineHandlers = {
onUpdate = testing.updateLocal,
onFrame = testing.updateLocal,
},
eventHandlers = testing.eventHandlers
}

View file

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

View file

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