avm2: Add domain memory tests
This commit is contained in:
parent
89c01dca18
commit
c2969895b2
|
@ -555,6 +555,7 @@ swf_tests! {
|
||||||
(as3_nan_scale, "avm2/nan_scale", 1),
|
(as3_nan_scale, "avm2/nan_scale", 1),
|
||||||
(as3_documentclass, "avm2/documentclass", 1),
|
(as3_documentclass, "avm2/documentclass", 1),
|
||||||
(timer_run_actions, "avm1/timer_run_actions", 1),
|
(timer_run_actions, "avm1/timer_run_actions", 1),
|
||||||
|
(as3_domain_memory, "avm2/domain_memory", 1),
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: These tests have some inaccuracies currently, so we use approx_eq to test that numeric values are close enough.
|
// TODO: These tests have some inaccuracies currently, so we use approx_eq to test that numeric values are close enough.
|
||||||
|
|
|
@ -3,208 +3,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
import flash.geom.Point;
|
import avm2.intrinsics.memory.si8;
|
||||||
|
|
||||||
trace("/// Constructors");
|
trace("// Li8(1) after Si8(1, 10)");
|
||||||
trace("// new Point()");
|
si8(1, 10);
|
||||||
trace(new Point());
|
trace(li8(1));
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// new Point(1)");
|
|
||||||
trace(new Point(1));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// new Point(1, 2)");
|
|
||||||
trace(new Point(1, 2));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// new Point({}, 2)");
|
|
||||||
var temp = {};
|
|
||||||
trace(new Point(temp, 2));
|
|
||||||
trace("");
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("/// Add");
|
|
||||||
|
|
||||||
var point2 = new Point();
|
|
||||||
trace("// point.add(new Point(1, 2))");
|
|
||||||
trace(point2.add(new Point(1, 2)));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// point");
|
|
||||||
trace(point2);
|
|
||||||
trace("");
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("/// Subtract");
|
|
||||||
|
|
||||||
var point3 = new Point();
|
|
||||||
trace("// point.subtract(new Point(1, 2))");
|
|
||||||
trace(point3.subtract(new Point(1, 2)));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// point");
|
|
||||||
trace(point3);
|
|
||||||
trace("");
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("/// Distance");
|
|
||||||
|
|
||||||
trace("// Point.distance(new Point(), new Point())");
|
|
||||||
trace(Point.distance(new Point(), new Point()));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// Point.distance(new Point(-100, 200), new Point(100, 200))");
|
|
||||||
trace(Point.distance(new Point(-100, 200), new Point(100, 200)));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("/// Equals");
|
|
||||||
|
|
||||||
var point4 = new Point();
|
|
||||||
trace("// point.equals(new Point(1, 2))");
|
|
||||||
trace(point4.equals(new Point(1, 2)));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
|
|
||||||
trace("// point.equals(point)");
|
|
||||||
trace(point4.equals(point4));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// point");
|
|
||||||
trace(point4);
|
|
||||||
trace("");
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
|
|
||||||
trace("/// Clone");
|
|
||||||
|
|
||||||
var point5 = new Point(1, 2);
|
|
||||||
var clone = point5.clone();
|
|
||||||
trace("// point");
|
|
||||||
trace(point5);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// clone");
|
|
||||||
trace(clone);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// point === clone");
|
|
||||||
trace(point5 === clone);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// point.equals(clone)");
|
|
||||||
trace(point5.equals(clone));
|
|
||||||
trace("");
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("/// Interpolate");
|
|
||||||
trace("// Point.interpolate(new Point(-100, -200), new Point(100, 200), -1)");
|
|
||||||
trace(Point.interpolate(new Point(-100, -200), new Point(100, 200), -1));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// Point.interpolate(new Point(-100, -200), new Point(100, 200), 0)");
|
|
||||||
trace(Point.interpolate(new Point(-100, -200), new Point(100, 200), 0));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// Point.interpolate(new Point(-100, -200), new Point(100, 200), 0.5)");
|
|
||||||
trace(Point.interpolate(new Point(-100, -200), new Point(100, 200), 0.5));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// Point.interpolate(new Point(-100, -200), new Point(100, 200), 1)");
|
|
||||||
trace(Point.interpolate(new Point(-100, -200), new Point(100, 200), 1));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// Point.interpolate(new Point(-100, -200), new Point(100, 200), 2)");
|
|
||||||
trace(Point.interpolate(new Point(-100, -200), new Point(100, 200), 2));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("/// length");
|
|
||||||
trace("new Point().length");
|
|
||||||
trace(new Point().length);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("new Point(100, 0).length");
|
|
||||||
trace(new Point(100, 0).length);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("new Point(0, -200).length");
|
|
||||||
trace(new Point(0, -200).length);
|
|
||||||
trace("");
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("/// Normalize");
|
|
||||||
trace("// new Point() normalize(10)");
|
|
||||||
var point6 = new Point();
|
|
||||||
point6.normalize(10);
|
|
||||||
trace(point6);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// new Point() normalize(-5)");
|
|
||||||
var point7 = new Point();
|
|
||||||
point7.normalize(-5);
|
|
||||||
trace(point7);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// new Point(100, 200) normalize(10)");
|
|
||||||
var point8 = new Point(100, 200);
|
|
||||||
point8.normalize(10);
|
|
||||||
trace(point8);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// new Point(100, 200) normalize(-5)");
|
|
||||||
var point9 = new Point(100, 200);
|
|
||||||
point9.normalize(-5);
|
|
||||||
trace(point9);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// new Point(-200, 100) normalize(10)");
|
|
||||||
var point10 = new Point(-200, 100);
|
|
||||||
point10.normalize(10);
|
|
||||||
trace(point10);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// new Point(-200, 100) normalize(-5)");
|
|
||||||
var point11 = new Point(-200, 100);
|
|
||||||
point11.normalize(-5);
|
|
||||||
trace(point11);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// new Point(undefined, 100) normalize(1)");
|
|
||||||
var point14 = new Point(undefined, 100);
|
|
||||||
point14.normalize(1);
|
|
||||||
trace(point14);
|
|
||||||
trace("");
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// new Point(100, null) normalize(1)");
|
|
||||||
var point15 = new Point(100, null);
|
|
||||||
point15.normalize(1);
|
|
||||||
trace(point15);
|
|
||||||
trace("");
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("/// Offset");
|
|
||||||
var point16 = new Point();
|
|
||||||
trace("// point = new Point()");
|
|
||||||
trace(point16);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
point16.offset(100, 200);
|
|
||||||
trace("// point.offset(100, 200)");
|
|
||||||
trace(point16);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
point16.offset(-1000, -2000);
|
|
||||||
trace("// point.offset(-1000, -2000)");
|
|
||||||
trace(point16);
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
|
|
||||||
trace("/// polar");
|
|
||||||
trace("// Point.polar(5, Math.atan(3/4))");
|
|
||||||
trace(Point.polar(5, Math.atan(3/4)));
|
|
||||||
trace("");
|
|
||||||
|
|
||||||
trace("// Point.polar(0, Math.atan(3/4))");
|
|
||||||
trace(Point.polar(0, Math.atan(3/4)));
|
|
||||||
trace("");
|
|
|
@ -1,133 +0,0 @@
|
||||||
/// Constructors
|
|
||||||
// new Point()
|
|
||||||
(x=0, y=0)
|
|
||||||
|
|
||||||
// new Point(1)
|
|
||||||
(x=1, y=0)
|
|
||||||
|
|
||||||
// new Point(1, 2)
|
|
||||||
(x=1, y=2)
|
|
||||||
|
|
||||||
// new Point({}, 2)
|
|
||||||
(x=NaN, y=2)
|
|
||||||
|
|
||||||
|
|
||||||
/// Add
|
|
||||||
// point.add(new Point(1, 2))
|
|
||||||
(x=1, y=2)
|
|
||||||
|
|
||||||
// point
|
|
||||||
(x=0, y=0)
|
|
||||||
|
|
||||||
|
|
||||||
/// Subtract
|
|
||||||
// point.subtract(new Point(1, 2))
|
|
||||||
(x=-1, y=-2)
|
|
||||||
|
|
||||||
// point
|
|
||||||
(x=0, y=0)
|
|
||||||
|
|
||||||
|
|
||||||
/// Distance
|
|
||||||
// Point.distance(new Point(), new Point())
|
|
||||||
0
|
|
||||||
|
|
||||||
// Point.distance(new Point(-100, 200), new Point(100, 200))
|
|
||||||
200
|
|
||||||
|
|
||||||
/// Equals
|
|
||||||
// point.equals(new Point(1, 2))
|
|
||||||
false
|
|
||||||
|
|
||||||
// point.equals(point)
|
|
||||||
true
|
|
||||||
|
|
||||||
// point
|
|
||||||
(x=0, y=0)
|
|
||||||
|
|
||||||
|
|
||||||
/// Clone
|
|
||||||
// point
|
|
||||||
(x=1, y=2)
|
|
||||||
|
|
||||||
// clone
|
|
||||||
(x=1, y=2)
|
|
||||||
|
|
||||||
// point === clone
|
|
||||||
false
|
|
||||||
|
|
||||||
// point.equals(clone)
|
|
||||||
true
|
|
||||||
|
|
||||||
|
|
||||||
/// Interpolate
|
|
||||||
// Point.interpolate(new Point(-100, -200), new Point(100, 200), -1)
|
|
||||||
(x=300, y=600)
|
|
||||||
|
|
||||||
// Point.interpolate(new Point(-100, -200), new Point(100, 200), 0)
|
|
||||||
(x=100, y=200)
|
|
||||||
|
|
||||||
// Point.interpolate(new Point(-100, -200), new Point(100, 200), 0.5)
|
|
||||||
(x=0, y=0)
|
|
||||||
|
|
||||||
// Point.interpolate(new Point(-100, -200), new Point(100, 200), 1)
|
|
||||||
(x=-100, y=-200)
|
|
||||||
|
|
||||||
// Point.interpolate(new Point(-100, -200), new Point(100, 200), 2)
|
|
||||||
(x=-300, y=-600)
|
|
||||||
|
|
||||||
/// length
|
|
||||||
new Point().length
|
|
||||||
0
|
|
||||||
|
|
||||||
new Point(100, 0).length
|
|
||||||
100
|
|
||||||
|
|
||||||
new Point(0, -200).length
|
|
||||||
200
|
|
||||||
|
|
||||||
|
|
||||||
/// Normalize
|
|
||||||
// new Point() normalize(10)
|
|
||||||
(x=0, y=0)
|
|
||||||
|
|
||||||
// new Point() normalize(-5)
|
|
||||||
(x=0, y=0)
|
|
||||||
|
|
||||||
// new Point(100, 200) normalize(10)
|
|
||||||
(x=4.47213595499958, y=8.94427190999916)
|
|
||||||
|
|
||||||
// new Point(100, 200) normalize(-5)
|
|
||||||
(x=-2.23606797749979, y=-4.47213595499958)
|
|
||||||
|
|
||||||
// new Point(-200, 100) normalize(10)
|
|
||||||
(x=-8.94427190999916, y=4.47213595499958)
|
|
||||||
|
|
||||||
// new Point(-200, 100) normalize(-5)
|
|
||||||
(x=4.47213595499958, y=-2.23606797749979)
|
|
||||||
|
|
||||||
// new Point(undefined, 100) normalize(1)
|
|
||||||
(x=NaN, y=100)
|
|
||||||
|
|
||||||
|
|
||||||
// new Point(100, null) normalize(1)
|
|
||||||
(x=1, y=0)
|
|
||||||
|
|
||||||
|
|
||||||
/// Offset
|
|
||||||
// point = new Point()
|
|
||||||
(x=0, y=0)
|
|
||||||
|
|
||||||
// point.offset(100, 200)
|
|
||||||
(x=100, y=200)
|
|
||||||
|
|
||||||
// point.offset(-1000, -2000)
|
|
||||||
(x=-900, y=-1800)
|
|
||||||
|
|
||||||
/// polar
|
|
||||||
// Point.polar(5, Math.atan(3/4))
|
|
||||||
(x=4, y=3)
|
|
||||||
|
|
||||||
// Point.polar(0, Math.atan(3/4))
|
|
||||||
(x=0, y=0)
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue