1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-16 16:20:53 +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:
Evil Eye 2023-12-27 11:40:28 +00:00
commit 8064a81569
2 changed files with 8 additions and 6 deletions

View File

@ -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)

View File

@ -13,6 +13,7 @@ parser.add_argument("--omw", type=str, default="openmw", help="path to openmw bi
parser.add_argument(
"--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()
example_suite_dir = Path(args.example_suite).resolve()
@ -78,7 +79,10 @@ def runTest(name):
) as process:
quit_requested = False
for line in process.stdout:
stdout_lines.append(line)
if args.verbose:
sys.stdout.write(line)
else:
stdout_lines.append(line)
words = line.split(" ")
if len(words) > 1 and words[1] == "E]":
print(line, end="")
@ -102,7 +106,7 @@ def runTest(name):
exit_ok = False
if os.path.exists(config_dir / "openmw.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)
if test_success and exit_ok:
print(f"{name} succeeded")