// 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 - address@hidden // #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(); } }