mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-17 10:21:11 +00:00
Merge branch 'integration_tests' into 'master'
Replace check for normalized distance =~ value by distance > 0 in the integration tests See merge request OpenMW/openmw!3684
This commit is contained in:
commit
8064a81569
@ -40,8 +40,7 @@ testing.registerLocalTest('playerForwardRunning',
|
|||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
local direction, distance = (self.position - startPos):normalize()
|
local direction, distance = (self.position - startPos):normalize()
|
||||||
local normalizedDistance = distance / types.Actor.runSpeed(self)
|
testing.expectGreaterThan(distance, 0, 'Run forward, distance')
|
||||||
testing.expectEqualWithDelta(normalizedDistance, 1, 0.2, 'Normalized forward runned distance')
|
|
||||||
testing.expectEqualWithDelta(direction.x, 0, 0.1, 'Run forward, X coord')
|
testing.expectEqualWithDelta(direction.x, 0, 0.1, 'Run forward, X coord')
|
||||||
testing.expectEqualWithDelta(direction.y, 1, 0.1, 'Run forward, Y coord')
|
testing.expectEqualWithDelta(direction.y, 1, 0.1, 'Run forward, Y coord')
|
||||||
end)
|
end)
|
||||||
@ -59,8 +58,7 @@ testing.registerLocalTest('playerDiagonalWalking',
|
|||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
local direction, distance = (self.position - startPos):normalize()
|
local direction, distance = (self.position - startPos):normalize()
|
||||||
local normalizedDistance = distance / types.Actor.walkSpeed(self)
|
testing.expectGreaterThan(distance, 0, 'Walk diagonally, distance')
|
||||||
testing.expectEqualWithDelta(normalizedDistance, 1, 0.2, 'Normalized diagonally walked distance')
|
|
||||||
testing.expectEqualWithDelta(direction.x, -0.707, 0.1, 'Walk diagonally, X coord')
|
testing.expectEqualWithDelta(direction.x, -0.707, 0.1, 'Walk diagonally, X coord')
|
||||||
testing.expectEqualWithDelta(direction.y, -0.707, 0.1, 'Walk diagonally, Y coord')
|
testing.expectEqualWithDelta(direction.y, -0.707, 0.1, 'Walk diagonally, Y coord')
|
||||||
end)
|
end)
|
||||||
|
@ -13,6 +13,7 @@ parser.add_argument("--omw", type=str, default="openmw", help="path to openmw bi
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--workdir", type=str, default="integration_tests_output", help="directory for temporary files and logs"
|
"--workdir", type=str, default="integration_tests_output", help="directory for temporary files and logs"
|
||||||
)
|
)
|
||||||
|
parser.add_argument("--verbose", action='store_true', help="print all openmw output")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
example_suite_dir = Path(args.example_suite).resolve()
|
example_suite_dir = Path(args.example_suite).resolve()
|
||||||
@ -78,7 +79,10 @@ def runTest(name):
|
|||||||
) as process:
|
) as process:
|
||||||
quit_requested = False
|
quit_requested = False
|
||||||
for line in process.stdout:
|
for line in process.stdout:
|
||||||
stdout_lines.append(line)
|
if args.verbose:
|
||||||
|
sys.stdout.write(line)
|
||||||
|
else:
|
||||||
|
stdout_lines.append(line)
|
||||||
words = line.split(" ")
|
words = line.split(" ")
|
||||||
if len(words) > 1 and words[1] == "E]":
|
if len(words) > 1 and words[1] == "E]":
|
||||||
print(line, end="")
|
print(line, end="")
|
||||||
@ -102,7 +106,7 @@ def runTest(name):
|
|||||||
exit_ok = False
|
exit_ok = False
|
||||||
if os.path.exists(config_dir / "openmw.log"):
|
if os.path.exists(config_dir / "openmw.log"):
|
||||||
shutil.copyfile(config_dir / "openmw.log", work_dir / f"{name}.{time_str}.log")
|
shutil.copyfile(config_dir / "openmw.log", work_dir / f"{name}.{time_str}.log")
|
||||||
if not exit_ok:
|
if not exit_ok and not args.verbose:
|
||||||
sys.stdout.writelines(stdout_lines)
|
sys.stdout.writelines(stdout_lines)
|
||||||
if test_success and exit_ok:
|
if test_success and exit_ok:
|
||||||
print(f"{name} succeeded")
|
print(f"{name} succeeded")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user