2 // Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 // These are already checked in Global.as, and it would be
20 // clear if things don't work as expected
21 check_equals
(typeof(setInterval
), 'function');
22 check_equals
(typeof(clearInterval
), 'function');
24 do_this
= function() {
27 var int = now
-this_timer
;
29 check
(int >= this_ms
, this_ms
+" interval (this) called after " + int + " milliseconds [" + __FILE__
+ ":" + __LINE__
+ "]");
30 note
("Doing this "+this_counter
+" after " + int + " milliseconds");
31 if ( this_counter
> 3 )
33 clearInterval
(this_interval
);
34 note
("This interval cleared ");
35 if ( this_counter
> 4 )
37 note
('Setting another interval');
39 A
.prototype
.name
= 'A';
40 A
.prototype
.test
= function() { return 'Atest'; };
41 B
= function() {}; B
.prototype
= new A
;
42 B
.prototype
.test
= function() {
43 check_equals
(super.test
(), 'Atest');
44 check_equals
(super.name
, 'A');
45 totals
(18, __FILE__
+ ":" + __LINE__
);
47 clearInterval
(method_interval
);
48 loadMovie
("fscommand:quit", _level0
);
53 method_interval
= setInterval
(o
, 'test', 1);
58 do_that
= function() {
61 var int = now
-that_timer
;
63 check
(int >= that_ms
, that_ms
+" interval (that) called after " + int + " milliseconds [" + __FILE__
+ ":" + __LINE__
+ "]");
64 //note("Doing that "+that_counter+" after " + int + " milliseconds");
65 if ( that_counter
> 3 )
67 clearInterval
(that_interval
);
68 note
("That interval cleared ");
69 this_time
= getTimer
();
71 this_interval
= setInterval
(do_this
, 1);
72 // interval 1 is NOT reused
73 check_equals
(this_interval
, 4); // interval 3 is set from within do_that
77 push_args
= function() {
78 check_equals
(arguments.length
, 3);
79 clearInterval
(push_interval
);
80 note
("Pushing "+arguments.length
+" args");
81 for (var i
=0; i
<arguments.length
; i
++)
83 pushed_args
[i
] = arguments[i
];
88 this_timer
= getTimer
();
89 this_ms
= 1; // 0.0001;
90 this_interval
= setInterval
(do_this
, 1); // 0.0001);
91 check_equals
(this_interval
, 1);
95 that_timer
= getTimer
();
96 that_interval
= setInterval
(do_that
, 1000);
97 check_equals
(that_interval
, 2);
99 pushed_args
= new Array;
100 push_interval
= setInterval
(push_args
, 200, 8, 9, 10);
101 check_equals
(push_interval
, 3);