gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9788: More matrix tests using Movie


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9788: More matrix tests using MovieClip.prototype.transform getter
Date: Fri, 19 Sep 2008 13:45:14 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9788
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Fri 2008-09-19 13:45:14 +0200
message:
  More matrix tests using MovieClip.prototype.transform getter
modified:
  testsuite/actionscript.all/MovieClip.as
  testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9786.2.1
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Fri 2008-09-19 13:08:30 +0200
    message:
      Add test for MovieClip.transform.matrix. Shows a known gnash bug on
      updating the matrix, but that part was commented out for now until
      fixed (better focus for that in misc-ming.all/matrix_test.swf for now)
    modified:
      testsuite/actionscript.all/MovieClip.as
    ------------------------------------------------------------
    revno: 9786.2.2
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Fri 2008-09-19 13:36:47 +0200
    message:
      test ActionScript inspectable matrix right after reading it from SWF
    modified:
      testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9786.2.3
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Fri 2008-09-19 13:40:44 +0200
    message:
      Check that MovieClip.prototype.transform returns a new object everytime 
it's called
    modified:
      testsuite/actionscript.all/MovieClip.as
=== modified file 'testsuite/actionscript.all/MovieClip.as'
--- a/testsuite/actionscript.all/MovieClip.as   2008-09-18 18:10:08 +0000
+++ b/testsuite/actionscript.all/MovieClip.as   2008-09-19 11:40:44 +0000
@@ -29,7 +29,7 @@
 #endif
 
 xcheck(MovieClip.prototype.hasOwnProperty("blendMode"));
-xcheck(MovieClip.prototype.hasOwnProperty("attachBitmap"));
+check(MovieClip.prototype.hasOwnProperty("attachBitmap"));
 xcheck(MovieClip.prototype.hasOwnProperty("cacheAsBitmap"));
 check(MovieClip.prototype.hasOwnProperty("enabled"));
 xcheck(MovieClip.prototype.hasOwnProperty("filters"));
@@ -76,19 +76,19 @@
 endOfTest = function() 
 {
 #if OUTPUT_VERSION <= 5
-       check_totals(275); // SWF5
+       check_totals(276); // SWF5
 #endif
 
 #if OUTPUT_VERSION == 6
-       check_totals(705); // SWF6
+       check_totals(706); // SWF6
 #endif
 
 #if OUTPUT_VERSION == 7
-       check_totals(722); // SWF7
+       check_totals(723); // SWF7
 #endif
 
 #if OUTPUT_VERSION >= 8
-       check_totals(723); // SWF8+
+       check_totals(748); // SWF8+
 #endif
 
        play();
@@ -1335,6 +1335,71 @@
 _alpha = 100;
 
 //----------------------------------------------
+// Test transform
+//----------------------------------------------
+
+#if OUTPUT_VERSION < 8
+check_equals(typeof(_root.transform), 'undefined'); 
+#else
+
+// TODO: test these !!
+xcheck_equals(typeof(_root.transform), 'object'); 
+
+oldTransform = _root.transform;
+check(oldTransform === oldTransform); 
+check(oldTransform != _root.transform); // everytime transform is accessed, 
it's a new object!
+
+Matrix = flash.geom.Matrix;
+xcheck(_root.transform instanceOf Object);
+check(!_root.transform instanceOf Matrix);
+props = []; for (var i in _root.transform) props.push(i); props.sort();
+xcheck_equals(props.toString(), 
"colorTransform,concatenatedColorTransform,concatenatedMatrix,matrix,pixelBounds");
+
+xcheck_equals(typeof(_root.transform.colorTransform), 'object');
+// TODO: test colorTransform
+
+xcheck_equals(typeof(_root.transform.concatenatedColorTransform), 'object');
+// TODO: test concatenatedColorTransform
+
+xcheck_equals(typeof(_root.transform.concatenatedMatrix), 'object');
+xcheck(_root.transform.concatenatedMatrix instanceOf Matrix);
+
+xcheck_equals(typeof(_root.transform.matrix), 'object');
+xcheck(_root.transform.matrix instanceOf Matrix);
+
+note('x:'+_root._x+' y:'+_root._y+' rot:'+_root._rotation+' 
xs:'+_root._xscale+' yx:'+_root._yscale);
+
+xcheck_equals(_root.transform.matrix.a, 1);
+xcheck_equals(_root.transform.matrix.b, 0);
+xcheck_equals(_root.transform.matrix.c, 0);
+xcheck_equals(_root.transform.matrix.d, 1);
+xcheck_equals(_root.transform.matrix.tx, 0);
+xcheck_equals(_root.transform.matrix.ty, 0);
+// TODO: test concatenatedMatrix
+
+_root._x = 30;
+_root._y = 20;
+//_root._xscale = -300; // NOTE: gnash breaks the _root's matrix if we set 
_xscale here ! you can tell by failing localToGLobal/globalToLocal tests
+_root._yscale = -200;
+_root._rotation = -90;
+
+xcheck_equals(_root.transform.matrix.a, 0);
+xcheck_equals(_root.transform.matrix.b, -1); // would be 3 if we did set 
_xscale=-300 above
+xcheck_equals(_root.transform.matrix.c, -2);
+xcheck_equals(_root.transform.matrix.d, 0);
+xcheck_equals(_root.transform.matrix.tx, 30);
+xcheck_equals(_root.transform.matrix.ty, 20);
+// TODO: test concatenatedMatrix
+
+_root.transform.matrix.ty = 300;
+check_equals(_root._y, 20); // changing the AS matrix doesn't change the 
actual matrix
+
+_root._x = _root._y = _root._rotation = 0;
+_root._xscale = _root._yscale = 100;
+
+#endif
+
+//----------------------------------------------
 // Test localToGlobal and globalToLocal
 //----------------------------------------------
 

=== modified file 'testsuite/misc-ming.all/matrix_test.c'
--- a/testsuite/misc-ming.all/matrix_test.c     2008-09-18 16:06:36 +0000
+++ b/testsuite/misc-ming.all/matrix_test.c     2008-09-19 11:36:47 +0000
@@ -31,7 +31,7 @@
 #include <stdio.h>
 #include <ming.h>
 
-#define OUTPUT_VERSION 6
+#define OUTPUT_VERSION 8
 #define OUTPUT_FILENAME "matrix_test.swf"
 
 SWFDisplayItem add_static_mc(SWFMovie mo, const char* name, int depth, int x, 
int y, int width, int height);
@@ -340,6 +340,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, 1, 0, 0, 1, 50, 300); // reset to 
near-identity
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=1, b=0, c=0, 
d=1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -366,6 +367,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -1, 0, 0, 1, 50, 300); // negative x scale 
gets interpreted as 180 degrees rotation
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-1, b=0, 
c=0, d=1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -392,6 +394,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, 1, 0, 0, -1, 50, 300); // negative y scale 
(discarded ?)
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=1, b=0, c=0, 
d=-1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -418,6 +421,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -1, 0, 0, -1, 50, 300); // negative x and 
y scales
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-1, b=0, 
c=0, d=-1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -444,6 +448,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -1, -45, 0, 1, 50, 300); // negative x 
scale and some negative skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-1, b=-45, 
c=0, d=1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -470,6 +475,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -1, 45, 0, 1, 50, 300); // negative x 
scale and some positive skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-1, b=45, 
c=0, d=1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -496,6 +502,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, 1, -45, 0, -1, 50, 300); // negative x 
scale and some negative skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=1, b=-45, 
c=0, d=-1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -522,6 +529,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, 1, 45, 0, -1, 50, 300); // negative x 
scale and some positive skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=1, b=45, 
c=0, d=-1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -548,6 +556,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -1, 45, 0, -1, 50, 300); // negative x 
scale and some positive skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-1, b=45, 
c=0, d=-1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -574,6 +583,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -1, -45, 0, -1, 50, 300); // negative x 
scale and some positive skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-1, b=-45, 
c=0, d=-1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -601,6 +611,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -1, 0, -45, 1, 50, 300); // negative x 
scale and some negative skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-1, b=0, 
c=-45, d=1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -628,6 +639,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -1, 0, 45, 1, 50, 300); // negative x 
scale and some positive skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-1, b=0, 
c=45, d=1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -655,6 +667,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, 1, 0, -45, -1, 50, 300); // negative x 
scale and some negative skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=1, b=0, 
c=-45, d=-1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -682,6 +695,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, 1, 0, 45, -1, 50, 300); // negative x 
scale and some positive skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=1, b=0, 
c=45, d=-1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -709,6 +723,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -1, 0, 45, -1, 50, 300); // negative x 
scale and some positive skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-1, b=0, 
c=45, d=-1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -736,6 +751,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -1, 0, -45, -1, 50, 300); // negative x 
scale and some positive skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-1, b=0, 
c=-45, d=-1, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -762,6 +778,7 @@
 
        SWFMovie_nextFrame(mo);        
        SWFDisplayItem_setMatrix(it, -2, 0, -45, -0.5, 50, 300); // negative x 
scale and some positive skew
+    check_equals(mo, "staticmc.transform.matrix.toString()", "'(a=-2, b=0, 
c=-45, d=-0.5, tx=50, ty=300)'");
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -769,9 +786,9 @@
        check_equals(mo, "Math.round(staticmc._yscale)", "4500"); // let's 
tollerate precision for now
        check_equals(mo, "staticmc._rotation", "180");  
        check_equals(mo, "printBounds(staticmc.getBounds())", "'-30.05,-30.05 
30.05,30.05'");
-       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'-1362.35,285 1462.35,315.05'");
+       check_equals(mo, "printBounds(staticmc.getBounds(_root),0)", 
"'-1362,285 1462,315'"); // when not rounded, gives different results in SWF6 
and SWF8
        check_equals(mo, "Math.round(staticmc._width*10)", "28247");
-       check_equals(mo, "staticmc._height", "30.05");
+       check_equals(mo, "Math.round(staticmc._height)", "30"); // when not 
rounded, gives different results in SWF6 and SWF8
 
        // X: -1362.35  1462.35
        // Y:   285.00  315.05
@@ -1574,7 +1591,7 @@
 
        SWFMovie_nextFrame(mo);
 
-       add_actions(mo, "_root.totals(862); stop();");
+       add_actions(mo, "_root.totals(879); stop();");
        SWFMovie_nextFrame(mo);        
 
        //Output movie


reply via email to

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