CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/09/14 16:32:38
Modified files: . : ChangeLog testsuite/misc-ming.all: DrawingApiTest.as Log message: * testsuite/misc-ming.all/DrawingApiTest.as: add bounds tests. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4320&r2=1.4321 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DrawingApiTest.as?cvsroot=gnash&r1=1.13&r2=1.14 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4320 retrieving revision 1.4321 diff -u -b -r1.4320 -r1.4321 --- ChangeLog 14 Sep 2007 16:02:50 -0000 1.4320 +++ ChangeLog 14 Sep 2007 16:32:38 -0000 1.4321 @@ -1,5 +1,6 @@ 2007-09-14 Sandro Santilli <[EMAIL PROTECTED]> + * testsuite/misc-ming.all/DrawingApiTest.as: add bounds tests. * server/shape.{cpp,h}: add path::expandBounds to compute bounds of a path locally. * server/parser/shape_character_def.cpp (compute_bound): delegate Index: testsuite/misc-ming.all/DrawingApiTest.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/DrawingApiTest.as,v retrieving revision 1.13 retrieving revision 1.14 diff -u -b -r1.13 -r1.14 --- testsuite/misc-ming.all/DrawingApiTest.as 4 May 2007 09:22:51 -0000 1.13 +++ testsuite/misc-ming.all/DrawingApiTest.as 14 Sep 2007 16:32:38 -0000 1.14 @@ -8,6 +8,15 @@ // gnash DrawingApi.swf // +rcsid="$Id: DrawingApiTest.as,v 1.14 2007/09/14 16:32:38 strk Exp $"; + +#include "../actionscript.all/check.as" + +printBounds = function(b) +{ + return ''+Math.round(b.xMin*100)/100+','+Math.round(b.yMin*100)/100+' '+Math.round(b.xMax*100)/100+','+Math.round(b.yMax*100)/100; +}; + // Can draw both on a dynamically-created movie... createEmptyMovieClip("a", 10); // ... or on a statically-created one @@ -49,29 +58,63 @@ { clear(); + bnd = printBounds(a.getBounds()); + if ( bnd == "6710886.35,6710886.35 6710886.35,6710886.35" ) { + trace("PASSED: getBounds() returns "+bnd+" after clear"); + } else { + trace("FAILED: getBounds() returns "+bnd+" after clear"); + } + // The thick red line lineStyle(thick, red, 100); moveTo(100, 100); + + bnd = printBounds(a.getBounds()); + check_equals(bnd, "6710886.35,6710886.35 6710886.35,6710886.35"); + lineTo(200, 200); + bnd = printBounds(a.getBounds()); + check_equals(bnd, "80,80 220,220"); // line is 20 pixels thick.. + // The hairlined horizontal black line lineStyle(0, 0x000000, 100); moveTo(220, 180); + + bnd = printBounds(a.getBounds()); + check_equals(bnd, "80,80 220,220"); // neither line style change nore moveTo change the bounds + lineTo(280, 180); + bnd = printBounds(a.getBounds()); + check_equals(bnd, "80,80 280,220"); // now hairlined line from 220,180 to 280,180 was added + // The violet line moveTo(100, 200); lineStyle(5, 0xFF00FF, halftransparent); + + bnd = printBounds(a.getBounds()); + check_equals(bnd, "80,80 280,220"); // line style change and moveTo don't change anything + lineTo(200, 250); + bnd = printBounds(a.getBounds()); + check_equals(bnd, "80,80 280,255"); // line thinkness is now 5, so 250 gets to 255 + // The yellow line lineStyle(10, 0xFFFF00, 100); lineTo(400, 200); + bnd = printBounds(a.getBounds()); + check_equals(bnd, "80,80 410,260"); // line thinkness of 10 adds to x (now 410) and to starting point y (was 250) + // The green curve lineStyle(8, 0x00FF00, 100); curveTo(400, 120, 300, 100); + bnd = printBounds(a.getBounds()); + check_equals(bnd, "80,80 410,260"); // the curve is all inside the current bounds + // Transparent line lineStyle(); lineTo(80, 100); @@ -80,12 +123,23 @@ lineStyle(20); lineTo(80, 150); + bnd = printBounds(a.getBounds()); + check_equals(bnd, "60,80 410,260"); // new thinkness of 20 moves our left margin + // The ugly blue-fill red-stroke thingy moveTo(80, 180); lineStyle(2, 0xFF0000); beginFill(0x0000FF, 100); lineTo(50, 180); + + bnd = printBounds(a.getBounds()); + check_equals(bnd, "48,80 410,260"); // we get left to 50-thickness(2) now + curveTo(20, 200, 50, 250); + + bnd = printBounds(a.getBounds()); + check_equals(bnd, "18,80 410,260"); // we get left to 20-thickness(2) now + lineTo(100, 250); lineTo(80, 180); endFill(); @@ -101,6 +155,9 @@ lineTo(200, 100); endFill(); + bnd = printBounds(a.getBounds()); + check_equals(bnd, "18,80 410,260"); // nothing new.. + // The counter-clockwise cyan-stroke, green-fill square moveTo(230, 100); lineStyle(1, 0x00FFFF); @@ -126,6 +183,9 @@ beginFill(0x00FF00, 100); drawCircle(a, 330, 160, 35); endFill(); + + bnd = printBounds(a.getBounds()); + check_equals(bnd, "18,80 410,260"); // nothing new.. } // Make the MovieClip "active" (grabbing mouse events) _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit