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 Instance construction
21 // compile this test case with Ming makeswf, and then
22 // execute it like this gnash -1 -r 0 -v out.swf
31 check_equals
(o
, undefined);
41 check_equals
(o
, undefined);
44 check_equals
(typeof(o
), "object");
45 check_equals
(typeof(o
.__proto__
), "undefined");
46 ASSetPropFlags
(o
, null, 6, 1);
47 #if OUTPUT_VERSION
< 7
48 check_equals
(typeof(o
.constructor
), "function");
50 check_equals
(typeof(o
.constructor
), "undefined");
52 #if OUTPUT_VERSION
> 5
53 check_equals
(typeof(o
.__constructor__
), "function");
55 check_equals
(typeof(o
.__constructor__
), "undefined");
57 check_equals
(o
.toString
(), undefined);
58 check_equals
(o
.valueOf
(), undefined);
59 check
(!o instanceOf
Object);
60 check
(!o instanceOf
Number);
61 check
(!o instanceOf
String);
64 check_equals
(typeof(o
), "object");
65 check_equals
(typeof(o
.__proto__
), "undefined");
66 #if OUTPUT_VERSION
< 7
67 check_equals
(typeof(o
.constructor
), "function");
69 check_equals
(typeof(o
.constructor
), "undefined");
71 check_equals
(o
.toString
(), undefined);
72 check_equals
(o
.valueOf
(), undefined);
73 check
(!o instanceOf
Object);
74 check
(!o instanceOf
Number);
75 check
(!o instanceOf
String);
78 check_equals
(typeof(o
), "object");
79 check_equals
(typeof(o
.__proto__
), "undefined");
80 #if OUTPUT_VERSION
< 7
81 check_equals
(typeof(o
.constructor
), "function");
83 check_equals
(typeof(o
.constructor
), "undefined");
85 check_equals
(o
.toString
(), undefined);
86 check_equals
(o
.valueOf
(), undefined);
87 check
(!o instanceOf
Object);
88 check
(!o instanceOf
Number);
89 check
(!o instanceOf
String);
91 o
= new Stage.align
();
92 check_equals
(typeof(o
), "undefined");
95 check_equals
(typeof(o
), "object");
96 check_equals
(o
.toString
(), undefined);
97 check_equals
(o
.valueOf
(), undefined);
98 check
(!o instanceOf
Object);
100 // This should be undefined in SWF7 and below because BitmapData doesn't exist.
101 // It should be undefined in SWF8 because the object isn't constructed when the
102 // given values are incorrect.
103 o
= new flash
.display
.BitmapData();
104 check_equals
(typeof(o
), "undefined");
105 check_equals
(o
, undefined);
107 // Check object.prototype
108 // It seems this can't be changed under any circumstances.
109 delete Object.prototype
;
110 check_equals
(typeof(Object.prototype
), "object");
111 Object.prototype
= 6;
112 check_equals
(typeof(Object.prototype
), "object");
113 check_equals
(Object.prototype
.toString
(), "[object Object]");
114 ASSetPropFlags
(Object, null, 0);
115 delete Object.prototype
;
116 check_equals
(typeof(Object.prototype
), "object");
118 // String.prototype can be changed.
119 String.prototype
= 8;
120 check_equals
(typeof(String.prototype
), "number");
121 check_equals
(String.prototype
, 8);
122 s
= new String("hello");
123 #if OUTPUT_VERSION
== 5
124 check_equals
(s
, undefined);
126 check_equals
(s
, undefined);
128 check_equals
(s
.__proto__
, 8);
129 check_equals
(typeof(s
), "object");
130 check
(!s instanceOf
String);
132 s
= new Object("hello");
133 #if OUTPUT_VERSION
== 5
134 check_equals
(s
, undefined);
136 check_equals
(s
, undefined);
142 check_equals
(c
.__proto__
, 8);