gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r9799: MovieClip binding tests.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9799: MovieClip binding tests.
Date: Sat, 20 Sep 2008 12:52:55 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9799
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Sat 2008-09-20 12:52:55 +0200
message:
  MovieClip binding tests.
modified:
  testsuite/actionscript.all/Transform.as
=== modified file 'testsuite/actionscript.all/Transform.as'
--- a/testsuite/actionscript.all/Transform.as   2008-09-20 08:32:09 +0000
+++ b/testsuite/actionscript.all/Transform.as   2008-09-20 10:52:55 +0000
@@ -89,6 +89,84 @@
 flash.geom.Rectangle = Rectangle;
 xcheck(t.pixelBounds instanceOf Rectangle);
 
-
-totals(28);
+mc = _root.createEmptyMovieClip("mc", getNextHighestDepth());
+check(mc.transform instanceOf Transform);
+check(mc.transform.matrix instanceOf Matrix);
+check_equals(mc.transform.matrix.toString(), "(a=1, b=0, c=0, d=1, tx=0, 
ty=0)");
+
+// Store Matrix (copy)
+mat = mc.transform.matrix;
+
+// Store Transform (reference)
+trans = mc.transform;
+
+mc._x = "4";
+check_equals(mc.transform.matrix.toString(), "(a=1, b=0, c=0, d=1, tx=4, 
ty=0)");
+check_equals(trans.matrix.toString(), "(a=1, b=0, c=0, d=1, tx=4, ty=0)");
+check_equals(mat.toString(), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
+
+
+mc._rotation = 1.5;
+check_equals(mc.transform.matrix.toString(), trans.matrix.toString());
+check_equals(Math.round(trans.matrix.b * 10000), 262);
+check_equals(mat.toString(), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
+
+mc2 = mc;
+delete mc;
+
+check_equals(mc.transform.matrix.toString(), trans.matrix.toString());
+check_equals(Math.round(trans.matrix.a * 1000), 1000);
+check_equals(mat.toString(), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
+
+
+_root.removeMovieClip(mc);
+check_equals(Math.round(mc.transform.matrix.b * 10000), 262);
+
+mc = undefined;
+
+check_equals(Math.round(mc2.transform.matrix.b * 10000), 262);
+check_equals(mc.transform.matrix.toString(), undefined);
+check_equals(mc2.transform.matrix.toString(), trans.matrix.toString());
+check_equals(mat.toString(), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
+
+trans.matrix = new Matrix(2, 0, 0, 2, 10, 11);
+
+check_equals(trans.matrix.toString(), "(a=2, b=0, c=0, d=2, tx=10, ty=11)");
+check_equals(mc2.transform.matrix.toString(), "(a=2, b=0, c=0, d=2, tx=10, 
ty=11)");
+
+delete mc2;
+
+check_equals(mc2.transform.matrix.toString(), undefined);
+check_equals(trans.matrix.toString(), "(a=2, b=0, c=0, d=2, tx=10, ty=11)");
+check_equals(mat.toString(), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
+
+mc2 = undefined;
+
+check_equals(trans.matrix.toString(), "(a=2, b=0, c=0, d=2, tx=10, ty=11)");
+
+// Identity;
+trans.matrix = new Matrix;
+check_equals(trans.matrix.toString(), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
+
+
+mc = _root.createEmptyMovieClip("mc", getNextHighestDepth());
+trans = mc.transform;
+
+mcOld = mc;
+trans.matrix = new Matrix(3, 0.5, 0.5, 2, 0, 1);
+check_equals(mc.transform.matrix.toString(), "(a=3, b=0.5, c=0.5, d=2, tx=0, 
ty=1)");
+check_equals(mcOld.transform.matrix.toString(), "(a=3, b=0.5, c=0.5, d=2, 
tx=0, ty=1)");
+
+
+mcOld = mc;
+mc = _root.createEmptyMovieClip("mc", getNextHighestDepth());
+
+trans.matrix = new Matrix(4, 0.3, 0.3, 1, 1, 0);
+check_equals(mc.transform.matrix.toString(), "(a=1, b=0, c=0, d=1, tx=0, 
ty=0)");
+
+// Can we be this accurate? I think the AS matrix class is accurate enough.
+xcheck_equals(mcOld.transform.matrix.toString(), "(a=4, b=0.300000011920929, 
c=0.300000011920929, d=1, tx=1, ty=0)");
+
+
+totals(56);
 #endif


reply via email to

[Prev in Thread] Current Thread [Next in Thread]