mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-03 17:37:18 +00:00
Replace check for normalized distance =~ value by distance > 0
We just need to make sure player moved, for how long is not important. To avoid failures like: https://gitlab.com/OpenMW/openmw/-/jobs/5815281969: TEST playerForwardRunning FAILED [string "test.lua"]:80: [string "player.lua"]:44: Normalized forward runned distance: 0.782032 ~= 1.000000
This commit is contained in:
parent
e5af4322c7
commit
8fe0832b38
@ -40,8 +40,7 @@ testing.registerLocalTest('playerForwardRunning',
|
||||
coroutine.yield()
|
||||
end
|
||||
local direction, distance = (self.position - startPos):normalize()
|
||||
local normalizedDistance = distance / types.Actor.runSpeed(self)
|
||||
testing.expectEqualWithDelta(normalizedDistance, 1, 0.2, 'Normalized forward runned distance')
|
||||
testing.expectGreaterThan(distance, 0, 'Run forward, distance')
|
||||
testing.expectEqualWithDelta(direction.x, 0, 0.1, 'Run forward, X coord')
|
||||
testing.expectEqualWithDelta(direction.y, 1, 0.1, 'Run forward, Y coord')
|
||||
end)
|
||||
@ -59,8 +58,7 @@ testing.registerLocalTest('playerDiagonalWalking',
|
||||
coroutine.yield()
|
||||
end
|
||||
local direction, distance = (self.position - startPos):normalize()
|
||||
local normalizedDistance = distance / types.Actor.walkSpeed(self)
|
||||
testing.expectEqualWithDelta(normalizedDistance, 1, 0.2, 'Normalized diagonally walked distance')
|
||||
testing.expectGreaterThan(distance, 0, 'Walk diagonally, distance')
|
||||
testing.expectEqualWithDelta(direction.x, -0.707, 0.1, 'Walk diagonally, X coord')
|
||||
testing.expectEqualWithDelta(direction.y, -0.707, 0.1, 'Walk diagonally, Y coord')
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user