mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 19:15:41 +00:00
Add integration test for core.getGMST
This commit is contained in:
parent
256db78c6c
commit
69f6ab2882
3 changed files with 17 additions and 1 deletions
6
scripts/data/integration_tests/test_lua_api/openmw.cfg
Normal file
6
scripts/data/integration_tests/test_lua_api/openmw.cfg
Normal file
|
@ -0,0 +1,6 @@
|
|||
content=test.omwscripts
|
||||
|
||||
# Needed to test `core.getGMST`
|
||||
fallback=Water_RippleFrameCount,4
|
||||
fallback=Inventory_DirectionalDiffuseR,0.5
|
||||
fallback=Level_Up_Level2,something
|
|
@ -51,6 +51,13 @@ local function testTeleport()
|
|||
testing.expectEqualWithDelta(player.rotation.z, math.rad(-90), 0.05, 'teleporting changes rotation')
|
||||
end
|
||||
|
||||
local function testGetGMST()
|
||||
testing.expectEqual(core.getGMST('non-existed gmst'), nil)
|
||||
testing.expectEqual(core.getGMST('Water_RippleFrameCount'), 4)
|
||||
testing.expectEqual(core.getGMST('Inventory_DirectionalDiffuseR'), 0.5)
|
||||
testing.expectEqual(core.getGMST('Level_Up_Level2'), 'something')
|
||||
end
|
||||
|
||||
local function initPlayer()
|
||||
player:teleport('', util.vector3(4096, 4096, 867.237), util.vector3(0, 0, 0))
|
||||
coroutine.yield()
|
||||
|
@ -83,6 +90,7 @@ tests = {
|
|||
testing.runLocalTest(player, 'castNavigationRay')
|
||||
end},
|
||||
{'teleport', testTeleport},
|
||||
{'getGMST', testGetGMST},
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -51,7 +51,9 @@ def runTest(name):
|
|||
"content=template.omwgame\n",
|
||||
)
|
||||
)
|
||||
if (test_dir / "test.omwscripts").exists():
|
||||
if (test_dir / "openmw.cfg").exists():
|
||||
omw_cfg.write(open(test_dir / "openmw.cfg").read())
|
||||
elif (test_dir / "test.omwscripts").exists():
|
||||
omw_cfg.write("content=test.omwscripts\n")
|
||||
with open(config_dir / "settings.cfg", "a", encoding="utf-8") as settings_cfg:
|
||||
settings_cfg.write(
|
||||
|
|
Loading…
Reference in a new issue