Merge branch 'magicalintegrationtests' into 'master'

Add integration tests for mwscript-magic interactions

See merge request OpenMW/openmw!4511
This commit is contained in:
psi29a 2025-07-03 13:04:46 +00:00
commit 0aca34c02b
4 changed files with 20 additions and 2 deletions

View File

@ -467,7 +467,7 @@ Ubuntu_Clang_tests_Debug:
stage: test stage: test
variables: variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
EXAMPLE_SUITE_REVISION: f51b832e033429a7cdc520e0e48d7dfdb9141caa EXAMPLE_SUITE_REVISION: 599987b52bd2d064e26299d3317b11049499f32b
cache: cache:
paths: paths:
- .cache/pip - .cache/pip

View File

@ -82,7 +82,7 @@ testing.registerGlobalTest('getGMST', function()
end) end)
testing.registerGlobalTest('MWScript', function() testing.registerGlobalTest('MWScript', function()
local variableStoreCount = 18 local variableStoreCount = 19
local variableStore = world.mwscript.getGlobalVariables(player) local variableStore = world.mwscript.getGlobalVariables(player)
testing.expectEqual(variableStoreCount, #variableStore) testing.expectEqual(variableStoreCount, #variableStore)
@ -351,6 +351,20 @@ testing.registerGlobalTest('nan', function()
testing.expectEqual(err, 'Value must be a finite number') testing.expectEqual(err, 'Value must be a finite number')
end) end)
testing.registerGlobalTest('mwscript magic interactions', function()
local player = world.players[1]
local script = world.mwscript.getGlobalScript('OpenMW_Tests', player)
testing.expectEqual(script == nil, false, 'Expected mwscript OpenMW_Tests to be active')
script.variables.state = 1
local globals = world.mwscript.getGlobalVariables(player);
globals.OpenMW_Tests_Failed = 0
while script.variables.state ~= 0 and globals.OpenMW_Tests_Failed == 0 and script.isRunning do
coroutine.yield()
end
testing.expectEqual(script.isRunning, true, 'OpenMW_Tests should not crash')
testing.expectEqual(globals.OpenMW_Tests_Failed, 0, 'OpenMW_Tests should run without issue')
end)
return { return {
engineHandlers = { engineHandlers = {
onUpdate = testing.updateGlobal, onUpdate = testing.updateGlobal,

View File

@ -19,6 +19,7 @@ testing.registerMenuTest('save and load', function()
'template.omwgame', 'template.omwgame',
'landracer.omwaddon', 'landracer.omwaddon',
'the_hub.omwaddon', 'the_hub.omwaddon',
'mwscript.omwaddon',
'test_lua_api.omwscripts', 'test_lua_api.omwscripts',
}, },
creationTime = matchers.isAny(), creationTime = matchers.isAny(),
@ -86,6 +87,7 @@ registerGlobalTest('castNavigationRay')
registerGlobalTest('findNearestNavMeshPosition') registerGlobalTest('findNearestNavMeshPosition')
registerGlobalTest('player memory limit') registerGlobalTest('player memory limit')
registerGlobalTest('player weapon attack', 'player with equipped weapon on attack should damage health of other actors') registerGlobalTest('player weapon attack', 'player with equipped weapon on attack should damage health of other actors')
registerGlobalTest('mwscript magic interactions')
return { return {
engineHandlers = { engineHandlers = {

View File

@ -29,6 +29,7 @@ content_paths = (
example_suite_dir / "game_template" / "data" / "template.omwgame", example_suite_dir / "game_template" / "data" / "template.omwgame",
example_suite_dir / "example_animated_creature" / "data" / "landracer.omwaddon", example_suite_dir / "example_animated_creature" / "data" / "landracer.omwaddon",
example_suite_dir / "the_hub" / "data" / "the_hub.omwaddon", example_suite_dir / "the_hub" / "data" / "the_hub.omwaddon",
example_suite_dir / "integration_tests" / "data" / "mwscript.omwaddon",
) )
for path in content_paths: for path in content_paths:
if not path.is_file(): if not path.is_file():
@ -60,6 +61,7 @@ def run_test(test_name):
omw_cfg.writelines( omw_cfg.writelines(
( (
f'data="{testing_util_dir}"\n', f'data="{testing_util_dir}"\n',
f'data="{example_suite_dir / "example_static_props" / "data"}"\n',
f'data-local="{test_dir}"\n', f'data-local="{test_dir}"\n',
f'user-data="{userdata_dir}"\n', f'user-data="{userdata_dir}"\n',
) )