big merge from master, fix rpm creation, drop fetching swfdec
[gnash.git] / testsuite / misc-ming.all / PrototypeEventListeners.as
blobf2ed5762b97b9b61ee201ef4ef18bd065937a717
1 // Build with:
2 // makeswf -o PrototypeEventListeners.swf ../Dejagnu.swf PrototypeEventListeners.as
3 //
5 #include "../actionscript.all/check.as"
6 #include "../actionscript.all/utils.as"
8 #define info _root.note
9 #define note _root.note
10 #define fail_check _root.fail
11 #define pass_check _root.pass
12 #define xfail_check _root.xfail
13 #define xpass_check _root.xpass
17 var countMC;
19 // Should remain 0;
20 var countTF = 0;
22 MovieClip.prototype.onMouseDown = function() {
23 note(this+".onMouseDown");
24 check_equals(typeof(this), "movieclip");
25 countMC++;
28 MovieClip.prototype.onKeyUp = function() {
29 note(this+".onKeyDown");
30 note(typeof(this));
31 countMC++;
34 TextField.prototype.onMouseDown = function() {
35 note(this+".onMouseDown");
36 note(typeof(this));
37 countTF++;
40 createEmptyMovieClip("clip1", 1);
42 with (clip1)
44 lineStyle(4, 0);
45 lineTo(50,50);
48 createEmptyMovieClip("clip2", 2);
49 with (clip2)
51 lineStyle(4, 0);
52 lineTo(50,25);
55 Dejagnu._y = 100;
57 // Tests
59 test1 = function()
61 countMC = 0;
62 note("1. Click the mouse anywhere!");
63 _root.onMouseDown = function()
65 // clip1, clip2, and 2 Dejagnu clips.
66 check_equals(countMC, 4);
67 test2();
71 test2 = function()
73 countMC = 0;
74 clip1.removeMovieClip();
75 note("2. Click the mouse anywhere!");
77 _root.onMouseDown = function()
79 // clip2 and 2 Dejagnu clips.
80 check_equals(countMC, 3);
81 test3();
85 test3 = function()
88 advancer = new Object;
89 Key.addListener(advancer);
91 countMC = 0;
92 countOtherFunctions = 0;
94 clip1.removeMovieClip();
95 note("3. Press a key!");
97 _root.onKeyDown = function()
99 // clip2 and 2 Dejagnu clips.
100 countOtherFunctions++;
103 clip2.onKeyDown = function()
105 // clip2 and 2 Dejagnu clips.
106 countOtherFunctions++;
109 advancer.onKeyDown = function()
111 check_equals(countMC, 0);
112 check_equals(countOtherFunctions, 0);
113 endofTest();
118 endOfTest = function()
120 check_totals(11);
121 _root.ENDOFTEST = true;
122 note("END OF TEST");
125 test1();
127 stop();