2 // Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 // Test case for Stage ActionScript class
21 // compile this test case with Ming makeswf, and then
22 // execute it like this gnash -1 -r 0 -v out.swf
25 rcsid
="$Id: Key.as,v 1.7 2008/03/11 19:31:47 strk Exp $";
28 check_equals
(typeof(Key
), 'object');
31 check_equals
(typeof(keyObj
), 'undefined');
33 check_equals
(Key
.__proto__
, Object.prototype
);
36 #if OUTPUT_VERSION
> 5
38 // Key was implicitly initialized by ASBroadcaster.initialize !
39 // See http://www.senocular.com/flash/tutorials/listenersasbroadcaster/?page=2
40 check_equals
(typeof(Key
.addListener
), 'function');
41 check_equals
(typeof(Key
.removeListener
), 'function');
42 check_equals
(typeof(Key
.broadcastMessage
), 'function');
43 check
(Key
.hasOwnProperty
("_listeners"));
44 check_equals
(typeof(Key
._listeners
), 'object');
45 check
(Key
._listeners
instanceof Array);
47 #else // OUTPUT_VERSION <= 5
49 check_equals
(typeof(Key
.addListener
), 'undefined');
50 check_equals
(typeof(Key
.removeListener
), 'undefined');
52 #endif
// OUTPUT_VERSION <= 5
54 check_equals
(typeof(Key
.getAscii
), 'function');
55 check_equals
(typeof(Key
.getCode
), 'function');
56 check_equals
(typeof(Key
.isDown
), 'function');
57 check_equals
(typeof(Key
.isToggled
), 'function');
60 check_equals
(typeof(Key
.CAPSLOCK
), 'number');
61 check_equals
(Key
.CAPSLOCK
, 20);
62 check_equals
(typeof(Key
.TAB
), 'number');
63 check_equals
(Key
.TAB
, 9);
64 check_equals
(typeof(Key
.CONTROL
), 'number');
65 check_equals
(Key
.CONTROL
, 17);
66 check_equals
(typeof(Key
.SHIFT
), 'number');
67 check_equals
(Key
.SHIFT
, 16);
68 check_equals
(typeof(Key
.DELETEKEY
), 'number');
69 check_equals
(Key
.DELETEKEY
, 46);
70 check_equals
(typeof(Key
.INSERT
), 'number');
71 check_equals
(Key
.INSERT
, 45);
72 check_equals
(typeof(Key
.BACKSPACE
), 'number');
73 check_equals
(Key
.BACKSPACE
, 8);
74 check_equals
(typeof(Key
.LEFT
), 'number');
75 check_equals
(Key
.LEFT
, 37);
76 check_equals
(typeof(Key
.UP
), 'number');
77 check_equals
(Key
.UP
, 38);
78 check_equals
(typeof(Key
.RIGHT
), 'number');
79 check_equals
(Key
.RIGHT
, 39);
80 check_equals
(typeof(Key
.DOWN
), 'number');
81 check_equals
(Key
.DOWN
, 40);
82 check_equals
(typeof(Key
.HOME
), 'number');
83 check_equals
(Key
.HOME
, 36);
84 check_equals
(typeof(Key
.END
), 'number');
85 check_equals
(Key
.END
, 35);
86 check_equals
(typeof(Key
.ENTER
), 'number');
87 check_equals
(Key
.ENTER
, 13);
88 check_equals
(typeof(Key
.ESCAPE
), 'number');
89 check_equals
(Key
.ESCAPE
, 27);
90 check_equals
(typeof(Key
.PGDN
), 'number');
91 check_equals
(Key
.PGDN
, 34);
92 check_equals
(typeof(Key
.PGUP
), 'number');
93 check_equals
(Key
.PGUP
, 33);
94 check_equals
(typeof(Key
.SPACE
), 'number');
95 check_equals
(Key
.SPACE
, 32);
97 // Event handlers are: