gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9765: Add tests for effects of sett


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9765: Add tests for effects of setting _xscale and _yscale on characters
Date: Wed, 17 Sep 2008 18:42:05 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9765
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2008-09-17 18:42:05 +0200
message:
  Add tests for effects of setting _xscale and _yscale on characters
  with weird matrices read from SWF. Changed character::set_x_scale
  to use matrix::set_x_scale as that seems to give better results.
  (overall results are still frustrating though)
modified:
  libcore/character.cpp
  testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9763.1.1
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-17 16:39:23 +0200
    message:
      Few tests about setting _xscale after reading predefined matrix.
      Gnash fails but 0.8.3 also failed !
    modified:
      testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9763.1.2
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-17 16:53:34 +0200
    message:
      more tests for boundaries after changing _xscale
    modified:
      testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9763.1.3
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-17 17:24:52 +0200
    message:
      Fix test, support rounding of bounds
    modified:
      testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9763.1.4
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-17 17:26:26 +0200
    message:
      don't expect failure gnash doesn't have anymore
    modified:
      testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9763.1.5
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-17 17:30:44 +0200
    message:
      Don't recompute the matrix from the caches on _xscale setting.
      Fixes new tests in matrix_test.c
    modified:
      libcore/character.cpp
      testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9763.1.6
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-17 17:59:14 +0200
    message:
      Add test for setting _yscale, gnash fails
    modified:
      testsuite/misc-ming.all/matrix_test.c
=== modified file 'libcore/character.cpp'
--- a/libcore/character.cpp     2008-08-26 13:02:17 +0000
+++ b/libcore/character.cpp     2008-09-17 15:30:44 +0000
@@ -762,12 +762,17 @@
 {
        _xscale = scale_percent;
 
+    // As per misc-ming.all/matrix_test.{c,swf}
+    // we don't need to recompute the matrix from the 
+    // caches.
+
        double xscale = _xscale / 100.0;
-       double yscale = _yscale / 100.0;
-       double rotation = _rotation * PI / 180.0;
+       //double yscale = _yscale / 100.0;
+       //double rotation = _rotation * PI / 180.0;
 
        matrix m = get_matrix();
-       m.set_scale_rotation(xscale, yscale, rotation);
+       //m.set_scale_rotation(xscale, yscale, rotation);
+       m.set_x_scale(xscale);
        set_matrix(m); // we updated the cache ourselves
 
        transformedByScript(); 

=== modified file 'testsuite/misc-ming.all/matrix_test.c'
--- a/testsuite/misc-ming.all/matrix_test.c     2008-09-17 11:20:40 +0000
+++ b/testsuite/misc-ming.all/matrix_test.c     2008-09-17 15:59:14 +0000
@@ -91,7 +91,17 @@
        dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 
0, 0, 800, 600);
        SWFMovie_add(mo, (SWFBlock)dejagnuclip);
 
-       add_actions(mo, "printBounds = function(b) { return '' + b.xMin + ','+ 
b.yMin + ' '+ b.xMax + ',' + b.yMax; };");
+       add_actions(mo, "printBounds = function(b, roundToDecimal) "
+            "{ "
+            "   if ( roundToDecimal != undefined ) {"
+            "       var round = Math.pow(10, roundToDecimal);"
+            //"       trace('rounding to '+round);"
+            "       return '' + Math.round(b.xMin*round)/round + ','+ 
Math.round(b.yMin*round)/round + ' '+ Math.round(b.xMax*round)/round + ',' + 
Math.round(b.yMax*round)/round; "
+            "   } else {"
+            "       return '' + b.xMin + ','+ b.yMin + ' '+ b.xMax + ',' + 
b.yMax; "
+            "   }"
+            "};"
+            );
 
        SWFMovie_nextFrame(mo); 
 
@@ -739,6 +749,231 @@
        check(mo, "!staticmc.hitTest(0, 331, false)");  // overdown
 
 
+       //
+       // Now test setting parameters after reading matrix
+       //
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, 1, 0, 2, 1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,169.95 290.15,230.05'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,170 
290,230'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'110,170 290,230'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, 1, 0, -2, 1, 200, 200); 
+    check_equals(mo, "staticmc._xscale", "100");
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,169.95 290.15,230.05'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+    check_equals(mo, "staticmc._xscale", "-100"); // xscale changed, 
boundaries don't (not much at least)
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,170 
290,230'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'110,170 290,230'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, 1, 0, -2, -1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,169.95 290.15,230.05'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,170 
290,230'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'110,170 290,230'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, 0, 2, 1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,169.95 290.15,230.05'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,170 
290,230'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'110,170 290,230'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, 0, -2, 1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,169.95 290.15,230.05'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,170 
290,230'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'110,170 290,230'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, 0, -2, -1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,169.95 290.15,230.05'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,170 
290,230'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'110,170 290,230'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, 1, 2, 0, 1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'169.95,109.85 230.05,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'170,110 
230,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'170,110 230,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, 1, -2, 0, 1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'169.95,109.85 230.05,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'170,110 
230,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'170,110 230,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, 1, -2, 0, -1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'169.95,109.85 230.05,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'170,110 
230,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'170,110 230,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, 2, 0, 1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'169.95,109.85 230.05,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'170,110 
230,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'170,110 230,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, -2, 0, 1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'169.95,109.85 230.05,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'170,110 
230,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'170,110 230,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, -2, 0, -1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'169.95,109.85 230.05,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'170,110 
230,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       xcheck_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", 
"'170,110 230,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, -2, 2, -1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,109.85 290.15,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, -2, -2, -1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,109.85 290.15,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, 2, -2, -1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,109.85 290.15,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, 2, -2, 1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,109.85 290.15,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, 1, 2, -2, -1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,109.85 290.15,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, -2, 2, -1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,109.85 290.15,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, -1, -2, 2, 1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,109.85 290.15,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+
+       SWFMovie_nextFrame(mo);
+
+       SWFDisplayItem_remove(it);
+       it = add_static_mc(mo, "staticmc", 4, 0, 0, 60, 60);
+       SWFDisplayItem_setMatrix(it, 1, -2, 2, -1, 200, 200); 
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'109.85,109.85 290.15,290.15'");
+       add_actions(mo, "staticmc._xscale = 0 - staticmc._xscale;"); // swap 
_xscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
+       add_actions(mo, "staticmc._yscale = 0 - staticmc._yscale;"); // swap 
_yscale sign using ActionScript
+       check_equals(mo, "printBounds(staticmc.getBounds(_root), 0)", "'110,110 
290,290'");
 
        // TODO:
        // - test more rotations and scales (corner cases too!)
@@ -746,7 +981,7 @@
 
        SWFMovie_nextFrame(mo);
 
-       add_actions(mo, "_root.totals(408); stop();");
+       add_actions(mo, "_root.totals(470); stop();");
        SWFMovie_nextFrame(mo);        
 
        //Output movie


reply via email to

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