mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 12:09:53 +00:00
Add lua global var test back
This commit is contained in:
parent
b8c8e30431
commit
b51891cbcd
1 changed files with 25 additions and 1 deletions
|
@ -2,6 +2,7 @@ local testing = require('testing_util')
|
|||
local core = require('openmw.core')
|
||||
local async = require('openmw.async')
|
||||
local util = require('openmw.util')
|
||||
local world = require('openmw.world')
|
||||
|
||||
local function testTimers()
|
||||
testing.expectAlmostEqual(core.getGameTimeScale(), 30, 'incorrect getGameTimeScale() result')
|
||||
|
@ -64,6 +65,28 @@ local function testGetGMST()
|
|||
testing.expectEqual(core.getGMST('Level_Up_Level2'), 'something')
|
||||
end
|
||||
|
||||
local function testMWScript()
|
||||
local variableStoreCount = 18
|
||||
local variableStore = world.mwscript.getGlobalVariables(player)
|
||||
testing.expectEqual(variableStoreCount,#variableStore)
|
||||
|
||||
variableStore.year = variableStoreCount
|
||||
testing.expectEqual(variableStoreCount,variableStore.year)
|
||||
variableStore.year = 1
|
||||
local indexCheck = 0
|
||||
for index, value in ipairs(variableStore) do
|
||||
testing.expectEqual(variableStore[index],value)
|
||||
indexCheck = indexCheck + 1
|
||||
end
|
||||
testing.expectEqual(variableStoreCount,indexCheck)
|
||||
indexCheck = 0
|
||||
for index, value in pairs(variableStore) do
|
||||
testing.expectEqual(variableStore[index],value)
|
||||
indexCheck = indexCheck + 1
|
||||
end
|
||||
testing.expectEqual(variableStoreCount,indexCheck)
|
||||
end
|
||||
|
||||
local function initPlayer()
|
||||
player:teleport('', util.vector3(4096, 4096, 867.237), util.transform.identity)
|
||||
coroutine.yield()
|
||||
|
@ -101,6 +124,7 @@ tests = {
|
|||
end},
|
||||
{'teleport', testTeleport},
|
||||
{'getGMST', testGetGMST},
|
||||
{'mwscript', testMWScript},
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -109,4 +133,4 @@ return {
|
|||
onPlayerAdded = function(p) player = p end,
|
||||
},
|
||||
eventHandlers = testing.eventHandlers,
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue