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 System ActionScript class
21 // compile this test case with Ming makeswf, and then
22 // execute it like this gnash -1 -r 0 -v out.swf
28 check_equals
(typeof(System), 'object');
30 #if OUTPUT_VERSION
> 5
31 check
(System.capabilities
.hasOwnProperty
("version"));
32 check
(System.capabilities
.hasOwnProperty
("os"));
33 check
(System.capabilities
.hasOwnProperty
("manufacturer"));
34 check
(System.capabilities
.hasOwnProperty
("playerType"));
35 check
(System.capabilities
.hasOwnProperty
("serverString"));
36 check
(System.capabilities
.hasOwnProperty
("screenResolutionX"));
37 check
(System.capabilities
.hasOwnProperty
("screenResolutionY"));
38 check
(System.capabilities
.hasOwnProperty
("screenDPI"));
39 check
(System.capabilities
.hasOwnProperty
("screenColor"));
40 check
(System.capabilities
.hasOwnProperty
("pixelAspectRatio"));
41 check
(System.capabilities
.hasOwnProperty
("localFileReadDisable"));
42 check
(System.capabilities
.hasOwnProperty
("language"));
43 check
(System.capabilities
.hasOwnProperty
("isDebugger"));
44 check
(System.capabilities
.hasOwnProperty
("hasVideoEncoder"));
45 check
(System.capabilities
.hasOwnProperty
("hasStreamingVideo"));
46 check
(System.capabilities
.hasOwnProperty
("hasStreamingAudio"));
47 check
(System.capabilities
.hasOwnProperty
("hasScreenPlayback"));
48 check
(System.capabilities
.hasOwnProperty
("hasScreenBroadcast"));
49 check
(System.capabilities
.hasOwnProperty
("hasPrinting"));
50 check
(System.capabilities
.hasOwnProperty
("hasMP3"));
51 check
(System.capabilities
.hasOwnProperty
("hasEmbeddedVideo"));
52 check
(System.capabilities
.hasOwnProperty
("hasAudioEncoder"));
53 check
(System.capabilities
.hasOwnProperty
("hasAudio"));
54 check
(System.capabilities
.hasOwnProperty
("hasAccessibility"));
55 check
(System.capabilities
.hasOwnProperty
("avHardwareDisable"));
56 check
(System.capabilities
.hasOwnProperty
("windowlessDisable"));
58 check
(System.hasOwnProperty
("exactSettings"));
62 // _global.System is NOT a class, just an object
63 var systemObj
= new System;
64 check_equals
( typeof(systemObj
), 'undefined' );
66 check_equals
(typeof(System.__proto__
), 'object');
67 check_equals
(System.__proto__
, Object.prototype
)
69 // test the System.setClipboard method
70 check_equals
( typeof(System.setClipboard
), 'function');
72 // test the System.showSettings method
73 check_equals
( typeof(System.showSettings
), 'function');
75 // test the System::security.allowDomain method
76 check_equals
( typeof(System.security
.allowDomain
), 'function' );
78 // test the System.security.loadPolicyFile method
79 check_equals
( typeof(System.security
.loadPolicyFile
), 'function');
81 #if OUTPUT_VERSION
>= 7
83 // test the System.security.allowInsecureDomain method
85 check_equals
( typeof(System.security
.allowInsecureDomain
), 'function' );
87 #endif
// OUTPUT_VERSION >= 7
89 // test System.capabilities
90 check_equals
(typeof(System.capabilities
), 'object');
92 // test System.version (should also match the global $version)
93 check_equals
(typeof(System.capabilities
.version
), 'string');
94 check_equals
(typeof($version
), 'string');
95 check_equals
(System.capabilities
.version
, $version
);
96 check_equals
(typeof(_global
.$version
), 'undefined');
97 check_equals
(typeof(this.$version
), 'string');
98 check_equals
(this.$version
, System.capabilities
.version
);
99 check_equals
(typeof(System.capabilities
.os
), 'string');
100 check_equals
(typeof(System.capabilities
.manufacturer
), 'string');
101 check_equals
(typeof(System.capabilities
.playerType
), 'string');
102 check_equals
(typeof(System.capabilities
.serverString
), 'string');
103 check_equals
(typeof(System.capabilities
.screenResolutionX
), 'number');
104 check_equals
(typeof(System.capabilities
.screenResolutionY
), 'number');
105 check_equals
(typeof(System.capabilities
.screenDPI
), 'number');
106 check_equals
(typeof(System.capabilities
.screenColor
), 'string');
107 check_equals
(typeof(System.capabilities
.pixelAspectRatio
), 'string');
108 check_equals
(typeof(System.capabilities
.localFileReadDisable
), 'boolean');
109 check_equals
(typeof(System.capabilities
.language
), 'string');
110 check_equals
(typeof(System.capabilities
.isDebugger
), 'boolean');
111 check_equals
(typeof(System.capabilities
.hasVideoEncoder
), 'boolean');
112 check_equals
(typeof(System.capabilities
.hasStreamingVideo
), 'boolean');
113 check_equals
(typeof(System.capabilities
.hasStreamingAudio
), 'boolean');
114 check_equals
(typeof(System.capabilities
.hasScreenPlayback
), 'boolean');
115 check_equals
(typeof(System.capabilities
.hasScreenBroadcast
), 'boolean');
116 check_equals
(typeof(System.capabilities
.hasPrinting
), 'boolean');
117 check_equals
(typeof(System.capabilities
.hasMP3
), 'boolean');
118 check_equals
(typeof(System.capabilities
.hasEmbeddedVideo
), 'boolean');
119 check_equals
(typeof(System.capabilities
.hasAudioEncoder
), 'boolean');
120 check_equals
(typeof(System.capabilities
.hasAudio
), 'boolean');
121 check_equals
(typeof(System.capabilities
.hasAccessibility
), 'boolean');
122 check_equals
(typeof(System.capabilities
.avHardwareDisable
), 'boolean');
123 check_equals
(typeof(System.capabilities
.windowlessDisable
), 'boolean');
125 // Not present on any known Linux player versions.
126 check_equals
(typeof(System.capabilities
.hasIME
), 'undefined');
127 note
(" System.capabilities.hasIME certainly fails on the pp on\n\
128 some platforms. There's no verification that it exists at all so far.");
130 // Added in Player version 9.
131 check_equals
(typeof(System.capabilities
.hasTLS
), 'boolean');
134 // System.exactSettings
135 #if OUTPUT_VERSION
> 5
136 check_equals
(typeof(System.exactSettings
), 'boolean');
137 System.exactSettings
= true;
138 check_equals
(System.exactSettings
, true);
139 System.exactSettings
= false;
140 xcheck_equals
(System.exactSettings
, false);
142 check_equals
(typeof(System.exactSettings
), 'undefined');
145 #if OUTPUT_VERSION
>= 6
146 check
(this.hasOwnProperty
("$version"));
147 check
(! MovieClip.prototype
.hasOwnProperty
("$version") );
151 // Undocumented System methods
154 // Directs the player to use Latin1 instead of unicode.
155 check_equals
(typeof(System.useCodepage
), 'boolean');
156 System.useCodepage
= false;
157 check_equals
(System.useCodepage
, false);
158 System.useCodepage
= true;
159 xcheck_equals
(System.useCodepage
, true);
161 // Pops up settings dialogue box with variable settings.
162 // System.showSettings(0): camera / microphone access;
163 // 1: shared object settings.
166 check_equals
(typeof(System.showSettings
), 'function');
168 xcheck_equals
(typeof(System.Product
), 'function');
170 #if OUTPUT_VERSION
> 5
171 xcheck
(System.Product
.prototype
.hasOwnProperty
('launch'));
172 xcheck
(System.Product
.prototype
.hasOwnProperty
('download'));
175 p
= new System.Product
("whatisthis");
176 xcheck_equals
(typeof(p
), 'object');
178 // Tries to do something with 'whatisthis'
179 xcheck_equals
(typeof(p
.download
), 'function');
180 // Tries to exec whatisthis from a particular location?
181 xcheck_equals
(typeof(p
.launch
), 'function');
183 ret
= System.security
.allowDomain
(1);
184 check_equals
(typeof(ret
), "boolean");
185 check_equals
(ret
, true);
186 ret
= System.security
.allowDomain
(false);
187 check_equals
(ret
, true);
188 ret
= System.security
.allowDomain
("string");
189 check_equals
(ret
, true);
190 ret
= System.security
.allowDomain
("http://www.gnashdev.org");
191 check_equals
(ret
, true);
192 ret
= System.security
.allowDomain
();
193 check_equals
(ret
, false);
194 ret
= System.security
.allowDomain
("string again");
195 check_equals
(ret
, true);
196 ret
= System.security
.allowDomain
(undefined);
197 check_equals
(ret
, true);
199 #if OUTPUT_VERSION
> 6
202 # if OUTPUT_VERSION
== 6