summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpsi29a <psi29a@gmail.com>2024-02-27 17:01:06 +0000
committerpsi29a <psi29a@gmail.com>2024-02-27 17:01:06 +0000
commitb248d700c7c549b5ca9ad895b5bd258c1deb9045 (patch)
tree2903c9e0f720123331b8ca8ceb0012b1527df5d3
parent46f863a32ea8f93f488521d8f836a193a4493e5f (diff)
parent6b07718871a616ec8d73ce882e3c6075571badfd (diff)
Merge branch 'add_test_for_move_into' into 'master'
Add morrowind test for moving object into container (#7663) See merge request OpenMW/openmw!3908
-rw-r--r--scripts/data/morrowind_tests/test.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/data/morrowind_tests/test.lua b/scripts/data/morrowind_tests/test.lua
index 8898420b82..3515002f2d 100644
--- a/scripts/data/morrowind_tests/test.lua
+++ b/scripts/data/morrowind_tests/test.lua
@@ -2,6 +2,7 @@ local testing = require('testing_util')
local util = require('openmw.util')
local world = require('openmw.world')
local core = require('openmw.core')
+local types = require('openmw.types')
if not core.contentFiles.has('Morrowind.esm') then
error('This test requires Morrowind.esm')
@@ -18,6 +19,28 @@ local tests = {
coroutine.yield()
testing.runLocalTest(world.players[1], 'Guard in Imperial Prison Ship should find path (#7241)')
end},
+ {'Should keep reference to an object moved into container (#7663)', function()
+ world.players[1]:teleport('ToddTest', util.vector3(2176, 3648, -191), util.transform.rotateZ(math.rad(0)))
+ coroutine.yield()
+ local barrel = world.createObject('barrel_01', 1)
+ local fargothRing = world.createObject('ring_keley', 1)
+ coroutine.yield()
+ testing.expectEqual(types.Container.inventory(barrel):find('ring_keley'), nil)
+ fargothRing:moveInto(types.Container.inventory(barrel))
+ coroutine.yield()
+ testing.expectEqual(fargothRing.recordId, 'ring_keley')
+ local isFargothRing = function(actual)
+ if actual == nil then
+ return 'ring_keley is not found'
+ end
+ if actual.id ~= fargothRing.id then
+ return 'found ring_keley id does not match expected: actual=' .. tostring(actual.id)
+ .. ', expected=' .. tostring(fargothRing.id)
+ end
+ return ''
+ end
+ testing.expectThat(types.Container.inventory(barrel):find('ring_keley'), isFargothRing)
+ end},
}
return {