On Tue, Dec 25, 2007 at 07:59:23PM +0100, Asger Ottar Alstrup wrote:
> Hi,
> 
> I've made a small example demonstrating  the use of
> MovieClip.beginGradientFill. Compile it with mtasc -version 8 - resulting
> .swf attached.

Thanks for the test Asger. Attached is a modified version in case you want
to work some more on it.

The changes add tests for the flash.geom.Matrix class for which we have *no*
tests. The usual way to test classes properties is in actionscript.all, but I
understand you don't intend to install Ming...

I found a good beginGradientFill-focused testcase in swfdec testsuite.
What makes it better then yours is it doesn't require SWF8 and the Matrix
class at all, and tests different kind of gradients. 
Take a look here:

http://gitweb.freedesktop.org/?p=swfdec/swfdec.git;a=blob_plain;h=a30717e4584c8a50182e66fd285e4bd632ca2c84;f=test/image/gradient-beginGradientFill.as

> I don't know how to turn that into a test-case, but I attach the source
> code, and a picture of how it is supposed to look.

What we usually do is using MovieTester to check the average color of pixels
inside a circle given a center, radius and tolerance.
Swfdec way is to compare a full picture.

> Gnash does not show anything.

Yes, beginGradientFill is unsupported, and so is the whole 'flash.*'
namespace btw...

--strk;
// GradientFillTest.as - Tests for gradient fill
//
//   Copyright (C) 2007 Free Software Foundation, Inc.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//
//
// Original author: Asger Ottar Alstrup - [EMAIL PROTECTED]
//

#include "check.as"

class GradientFill
{
        static function main(mc)
        {
                var colors = [ 0x01611c, 0xece400, 0xb90116 ];
                var ratios = [0, 128, 255];
                var alphas = [ 100.0, 50, 100.0 ];
                xcheck_equals(typeof(_global['flash']), 'object'); // we're 
building SWF8 now
                xcheck_equals(typeof(_global['flash'].geom), 'object'); 
                xcheck_equals(typeof(flash.geom.Matrix), 'function');
                var matrix = new flash.geom.Matrix(); // is this an SWF8 thing ?
                xcheck_equals(typeof(matrix), 'object');
                xcheck(matrix instanceof flash.geom.Matrix);
#ifdef DEBUG_MATRIX_CLASS
// TODO: provide an actionscript.all/Matrix.as testcase! 
                for (var i in matrix)
                {
                        note(i+": "+matrix[i]+" ("+typeof(matrix[i])+")");
                }
#endif // DEBUG_MATRIX_CLASS
                matrix.createGradientBox(100, 100, 2, 200, 0);
                mc.createEmptyMovieClip('drawing', 1);
                mc.drawing.clear();
                mc.drawing.beginGradientFill("linear", colors, alphas, ratios, 
matrix);
                mc.drawing.moveTo(200, 0);
                mc.drawing.lineTo(300, 0);
                mc.drawing.lineTo(300, 100);
                mc.drawing.lineTo(200, 100);
                mc.drawing.lineTo(200, 0);
                mc.drawing.endFill();
                check_equals(mc.drawing._height, 100);
                check_equals(mc.drawing._width, 100);
                check_totals(7);
                Dejagnu.done();
        }
}

_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev

Reply via email to