avm2: Add tests for looking up properties on Class objects
This commit is contained in:
parent
c9ca7e2095
commit
dddc9e954a
|
@ -219,6 +219,7 @@ swf_tests! {
|
|||
(as3_class_enumeration, "avm2/class_enumeration", 1),
|
||||
(as3_class_is, "avm2/class_is", 1),
|
||||
(as3_class_methods, "avm2/class_methods", 1),
|
||||
(as3_class_object_properties, "avm2/class_object_properties", 1),
|
||||
(as3_class_singleton, "avm2/class_singleton", 1),
|
||||
(as3_class_supercalls_mismatched, "avm2/class_supercalls_mismatched", 1),
|
||||
(as3_class_to_locale_string, "avm2/class_to_locale_string", 1),
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package {
|
||||
public class Test {
|
||||
public function Test() {}
|
||||
}
|
||||
}
|
||||
|
||||
class MyClass {
|
||||
public const pubConst:String = "Public const";
|
||||
protected const protectedConst:String = "Protected const";
|
||||
private const privConst:String = "Private const";
|
||||
|
||||
public static var pubVar:String = "Public static variable";
|
||||
protected static var protectedVar:String = "Protected static variable";
|
||||
private static var privVar:Boolean = false;
|
||||
|
||||
public static function pubMethod() {}
|
||||
protected static function protectedMethod() {}
|
||||
private static function privMethod() {}
|
||||
}
|
||||
|
||||
for each (var key in MyClass) {
|
||||
trace("Key: " + key + " Value: " + MyClass[key]);
|
||||
}
|
||||
|
||||
var obj:Class = MyClass;
|
||||
trace("pubConst: " + obj["pubConst"]);
|
||||
trace("protectedConst: " + obj["protectedConst"]);
|
||||
trace("privConst: " + obj["privConst"]);
|
||||
trace("pubVar: " + obj["pubVar"]);
|
||||
trace("protectedVar: " + obj["protectedVar"]);
|
||||
trace("privVar: " + obj["privVar"]);
|
||||
trace("pubMethod: " + obj["pubMethod"]);
|
||||
trace("protectedMethod: " + obj["protectedMethod"]);
|
||||
trace("privMethod: " + obj["privMethod"]);
|
||||
|
||||
trace('obj.prototype["pubVar"]: ' + obj.prototype["pubVar"]);
|
|
@ -0,0 +1,10 @@
|
|||
pubConst: undefined
|
||||
protectedConst: undefined
|
||||
privConst: undefined
|
||||
pubVar: Public static variable
|
||||
protectedVar: undefined
|
||||
privVar: undefined
|
||||
pubMethod: function Function() {}
|
||||
protectedMethod: undefined
|
||||
privMethod: undefined
|
||||
obj.prototype["pubVar"]: undefined
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue