tests: Add test for `EventDispatcher.toString`
This commit is contained in:
parent
67e7526517
commit
c4b680fef9
|
@ -722,6 +722,7 @@ swf_tests! {
|
|||
(as3_proxy_hasproperty, "avm2/proxy_hasproperty", 1),
|
||||
(as3_proxy_enumeration, "avm2/proxy_enumeration", 1),
|
||||
(as3_nonconflicting_declarations, "avm2/nonconflicting_declarations", 1),
|
||||
(as3_eventdispatcher_tostring, "avm2/eventdispatcher_tostring", 1),
|
||||
}
|
||||
|
||||
// TODO: These tests have some inaccuracies currently, so we use approx_eq to test that numeric values are close enough.
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package {
|
||||
public class Test {
|
||||
}
|
||||
}
|
||||
|
||||
import flash.events.EventDispatcher;
|
||||
|
||||
trace("///Object.prototype.toString = function() { /* ... */ };");
|
||||
Object.prototype.toString = (function (old_ts) {
|
||||
return function () {
|
||||
trace("///(Object.prototype.toString called)");
|
||||
return old_ts.apply(this, arguments);
|
||||
}
|
||||
}(Object.prototype.toString));
|
||||
|
||||
trace("///var ed = new EventDispatcher();");
|
||||
var ed = new EventDispatcher();
|
||||
|
||||
trace("///ed.toString();");
|
||||
trace(ed.toString());
|
||||
|
||||
class CustomDispatch extends EventDispatcher {
|
||||
public override function toString() : String {
|
||||
trace("///(CustomDispatch.prototype.toString called);");
|
||||
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
|
||||
trace("///var cust = new CustomDispatch();");
|
||||
var cust = new CustomDispatch();
|
||||
|
||||
trace("///cust.toString();");
|
||||
trace(cust.toString());
|
|
@ -0,0 +1,10 @@
|
|||
///Object.prototype.toString = function() { /* ... */ };
|
||||
///var ed = new EventDispatcher();
|
||||
///ed.toString();
|
||||
///(Object.prototype.toString called)
|
||||
[object EventDispatcher]
|
||||
///var cust = new CustomDispatch();
|
||||
///cust.toString();
|
||||
///(CustomDispatch.prototype.toString called);
|
||||
///(Object.prototype.toString called)
|
||||
[object CustomDispatch]
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue