21
21
// compile this test case with Ming makeswf, and then
22
22
// execute it like this gnash -1 -r 0 -v out.swf
24
rcsid="$Id: Color.as,v 1.12 2007/11/02 17:50:50 strk Exp $";
25
rcsid="$Id: Color.as,v 1.20 2008/05/23 02:30:21 zoulunkai Exp $";
26
26
#include "check.as"
28
28
//--------------------------------
218
218
check_equals ( trans2.rb, 0 );
219
219
check_equals ( trans2.ga, -50 );
220
220
check_equals ( trans2.gb, 255 );
221
xcheck_equals ( Math.round(trans2.ba*100)/100, 31.64 ); // gnash returns 32, who's right ?
221
// pp uses 1/256 accuracy, 31.640625 == int(0.32*256)*100/256.0f
222
check( trans2.ba - 31.640625 < 0.000001 ); // Don't use check_equals or Math.round here.
222
223
check_equals ( trans2.bb, 2 );
223
224
check_equals ( trans2.aa, 100 );
224
225
check_equals ( trans2.ab, 0 );
240
241
check_equals ( trans.aa, 100 );
241
242
check_equals ( trans.ab, 0 );
249
colorObj.setTransform(trans);
250
trans2 = colorObj.getTransform();
251
// 99.609375 == int(0.999*256)*100/256.0
252
check(trans2.ra - 99.609375 < 0.0000001); // Don't use check_equals or Math.round here.
253
check_equals(trans2.rb, 99);
255
#if OUTPUT_VERSION >= 6
256
trans.aa = 12800; // 0x80 * 100
258
_root.createEmptyMovieClip("mc1", 10);
259
check_equals(mc1._alpha, 100);
260
colorObj = new Color(mc1);
261
colorObj.setTransform(trans);
262
trans2 = colorObj.getTransform();
263
// (int16)(12800 / 100.0 * 256) == -12800
264
// Gnash failed, but not due to accuracy problem,
265
// _alpha is not calculated correctly.
266
xcheck_equals(mc1._alpha, -12800);
269
// _alpha is not calculated correctly. Not sure about the algorithm at the moment.
270
xcheck_equals(mc1._alpha, -12800);
273
trans2 = colorObj.getTransform();
274
// 59.765625: value retrieved from AS
275
// int(60 / 100.0 * 256): value stored in cxform.
276
// 59.765625 == int(60 / 100.0 * 256) / 2.56
277
check(trans2.aa - 59.765625 < 0.0000001);
278
check_equals(trans.ab, 10);
282
// Some tests for same-named (case-insensitive) variables in SWF6
284
#if OUTPUT_VERSION == 6
288
check_equals(c, undefined);
290
check_equals(c, undefined);
294
check_equals (typeof(c), 'object');
296
check_equals (typeof(c), 'object');
299
check_equals (typeof(c), 'object');
300
check_equals (typeof(c), 'object');
304
check_equals (typeof(c), 'undefined');
306
check_equals (typeof(c), 'undefined');
308
delete color; // variable
309
delete color; // class
311
check_equals (typeof(c), 'undefined');
313
check_equals (typeof(c), 'undefined');
315
// Do not add any tests after here (color deleted).
243
318
//-----------------------------------------------------------
245
320
//-----------------------------------------------------------