mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-08-03 15:27:13 -04:00
Add integration tests for mwscript-magic interactions
This commit is contained in:
parent
675146bd8b
commit
dca8c7c163
@ -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
|
||||||
|
@ -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,
|
||||||
|
@ -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(),
|
||||||
|
@ -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',
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user