Skip to content

Commit

Permalink
tests: Use Ruffle approximations in perspective_projection test
Browse files Browse the repository at this point in the history
Move approximation logic from ActionScript to Ruffle test framework
  • Loading branch information
cookie-s committed Mar 8, 2025
1 parent 8ad1104 commit 5daa9d6
Show file tree
Hide file tree
Showing 4 changed files with 1,014 additions and 1,013 deletions.
12 changes: 3 additions & 9 deletions tests/tests/swfs/avm2/perspective_projection/Test.as
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@ package {
for (var i: int = 1; i < 180; i++) {
var pp: PerspectiveProjection = new PerspectiveProjection();
pp.fieldOfView = i;
var fl: Number = pp.focalLength;
trace("FOV to FL", i, fl);
trace("FOV to FL", i, pp.focalLength);
}
}

private function TestFLtoFOV(): void {
for (var i: int = 1; i < 1000; i++) {
var pp: PerspectiveProjection = new PerspectiveProjection();
pp.focalLength = i;
var fl: Number = pp.fieldOfView;
trace("FL to FOV", i, roundN(fl, 100000000000));
trace("FL to FOV", i, pp.fieldOfView);
}
}

Expand Down Expand Up @@ -178,14 +176,10 @@ package {
private function printProps(pp: PerspectiveProjection): void {
trace(" perspectiveProjection = " + pp);
if (pp) {
trace(" perspectiveProjection.fieldOfView = " + roundN(pp.fieldOfView, 100000000000));
trace(" perspectiveProjection.fieldOfView = " + pp.fieldOfView);
trace(" perspectiveProjection.focalLength = " + pp.focalLength);
trace(" perspectiveProjection.projectionCenter = " + pp.projectionCenter);
}
}

private function roundN(n: Number, precision: Number): Number {
return Math.round(n * precision) / precision;
}
}
}
Loading

0 comments on commit 5daa9d6

Please sign in to comment.