[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11122: Fixed more tests
From: |
Bob Naugle |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11122: Fixed more tests |
Date: |
Mon, 15 Jun 2009 14:00:09 -0600 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 11122
committer: Bob Naugle <address@hidden>
branch nick: trunk
timestamp: Mon 2009-06-15 14:00:09 -0600
message:
Fixed more tests
modified:
testsuite/as3/classes.all/display/DisplayObjectContainer_as.hx
testsuite/as3/classes.all/display/DisplayObject_as.hx
testsuite/as3/classes.all/geom/Rectangle_as.hx
------------------------------------------------------------
revno: 11090.1.1
committer: Bob Naugle <address@hidden>
branch nick: development
timestamp: Mon 2009-06-15 11:12:43 -0600
message:
Modified haXe tests. They no longer use Std.is(), which was not behaving
as desired. There are some unexpected failures, I left them unexpected because
they are type mismatches in the gnash code (I think)
modified:
testsuite/as3/classes.all/display/BitmapData_as.hx
testsuite/as3/classes.all/display/Bitmap_as.hx
testsuite/as3/classes.all/display/DisplayObjectContainer_as.hx
testsuite/as3/classes.all/display/DisplayObject_as.hx
testsuite/as3/classes.all/display/InteractiveObject_as.hx
testsuite/as3/classes.all/display/MovieClip_as.hx
testsuite/as3/classes.all/display/SWFVersion_as.hx
testsuite/as3/classes.all/display/Sprite_as.hx
testsuite/as3/classes.all/geom/Matrix_as.hx
testsuite/as3/classes.all/geom/Point_as.hx
testsuite/as3/classes.all/geom/Rectangle_as.hx
testsuite/as3/classes.all/net/FileReference_as.hx
testsuite/as3/classes.all/net/NetStream_as.hx
testsuite/as3/classes.all/net/SharedObject_as.hx
testsuite/as3/classes.all/net/Socket_as.hx
testsuite/as3/classes.all/text/TextFormat_as.hx
testsuite/as3/classes.all/text/TextLineMetrics_as.hx
testsuite/as3/classes.all/text/TextRenderer_as.hx
testsuite/as3/classes.all/text/TextSnapshot_as.hx
testsuite/as3/classes.all/ui/KeyLocation_as.hx
testsuite/as3/classes.all/utils/Timer_as.hx
------------------------------------------------------------
revno: 11090.1.2
committer: Bob Naugle <address@hidden>
branch nick: development
timestamp: Mon 2009-06-15 12:02:16 -0600
message:
Type failures are XFAIL
modified:
testsuite/as3/classes.all/display/MovieClip_as.hx
testsuite/as3/classes.all/geom/Matrix_as.hx
testsuite/as3/classes.all/net/NetStream_as.hx
testsuite/as3/classes.all/text/TextFormat_as.hx
testsuite/as3/classes.all/text/TextRenderer_as.hx
=== modified file
'testsuite/as3/classes.all/display/DisplayObjectContainer_as.hx'
--- a/testsuite/as3/classes.all/display/DisplayObjectContainer_as.hx
2009-06-01 22:01:49 +0000
+++ b/testsuite/as3/classes.all/display/DisplayObjectContainer_as.hx
2009-06-15 17:12:43 +0000
@@ -51,17 +51,17 @@
// Tests to see if all the properties exist. All these do is test for
// existance of a property, and don't test the functionality at all. This
// is primarily useful only to test completeness of the API implementation.
- if (Std.is(x1.mouseChildren, Bool)) {
+ if (Type.typeof(x1.mouseChildren) == ValueType.TBool) {
DejaGnu.pass("DisplayObjectContainer::mouseChildren property
exists");
} else {
DejaGnu.fail("DisplayObjectContainer::mouseChildren property
doesn't exist");
}
- if (Std.is(x1.numChildren, Int)) {
+ if (Type.typeof(x1.numChildren) == ValueType.TInt) {
DejaGnu.pass("DisplayObjectContainer::numChildren property exists");
} else {
DejaGnu.fail("DisplayObjectContainer::numChildren property doesn't
exist");
}
- if (Std.is(x1.tabChildren, Bool)) {
+ if (Type.typeof(x1.tabChildren) == ValueType.TBool) {
DejaGnu.pass("DisplayObjectContainer::tabChildren property exists");
} else {
DejaGnu.fail("DisplayObjectContainer::tabChildren property doesn't
exist");
=== modified file 'testsuite/as3/classes.all/display/DisplayObject_as.hx'
--- a/testsuite/as3/classes.all/display/DisplayObject_as.hx 2009-06-01
17:24:36 +0000
+++ b/testsuite/as3/classes.all/display/DisplayObject_as.hx 2009-06-15
17:12:43 +0000
@@ -71,7 +71,7 @@
} else {
DejaGnu.fail("DisplayObject::accessibilityProperties property
doesn't exist");
}
- if (Std.is(x1.alpha, Float)) {
+ if (Type.typeof(x1.alpha) == ValueType.TFloat) {
DejaGnu.pass("DisplayObject::alpha property exists");
} else {
DejaGnu.fail("DisplayObject::alpha property doesn't exist");
@@ -81,7 +81,7 @@
} else {
DejaGnu.fail("DisplayObject::blendMode property doesn't exist");
}
- if (Std.is(x1.cacheAsBitmap, Bool)) {
+ if (Type.typeof(x1.cacheAsBitmap) == ValueType.TBool) {
DejaGnu.pass("DisplayObject::cacheAsBitmap property exists");
} else {
DejaGnu.fail("DisplayObject::cacheAsBitmap property doesn't exist");
@@ -91,7 +91,7 @@
} else {
DejaGnu.fail("DisplayObject::filters property doesn't exist");
}
- if (Std.is(x1.height, Float)) {
+ if (Type.typeof(x1.height) == ValueType.TFloat) {
DejaGnu.pass("DisplayObject::height property exists");
} else {
DejaGnu.fail("DisplayObject::height property doesn't exist");
@@ -112,12 +112,12 @@
// } else {
// DejaGnu.fail("DisplayObject::loaderInfo property doesn't exist");
// }
- if (Std.is(x1.mouseX, Float)) {
+ if (Type.typeof(x1.mouseX) == ValueType.TFloat) {
DejaGnu.pass("DisplayObject::mouseX property exists");
} else {
DejaGnu.fail("DisplayObject::mouseX property doesn't exist");
}
- if (Std.is(x1.mouseY, Float)) {
+ if (Type.typeof(x1.mouseY) == ValueType.TFloat) {
DejaGnu.pass("DisplayObject::mouseY property exists");
} else {
DejaGnu.fail("DisplayObject::mouseY property doesn't exist");
@@ -153,7 +153,7 @@
DejaGnu.fail("DisplayObject::root property doesn't exist");
}
DejaGnu.note("Type of l1.root is "+Type.typeof(l1.root));
- if (Std.is(x1.rotation, Float)) {
+ if (Type.typeof(x1.rotation) == ValueType.TFloat) {
DejaGnu.pass("DisplayObject::rotation property exists");
} else {
DejaGnu.fail("DisplayObject::rotation property doesn't exist");
@@ -166,12 +166,12 @@
} else {
DejaGnu.fail("DisplayObject::scale9Grid property doesn't exist");
}
- if (Std.is(x1.scaleX, Float)) {
+ if (Type.typeof(x1.scaleX) == ValueType.TFloat) {
DejaGnu.pass("DisplayObject::scaleX property exists");
} else {
DejaGnu.fail("DisplayObject::scaleX property doesn't exist");
}
- if (Std.is(x1.scaleY, Float)) {
+ if (Type.typeof(x1.scaleY) == ValueType.TFloat) {
DejaGnu.pass("DisplayObject::scaleY property exists");
} else {
DejaGnu.fail("DisplayObject::scaleY property doesn't exist");
@@ -188,22 +188,22 @@
} else {
DejaGnu.fail("DisplayObject::transform property doesn't exist");
}
- if (Std.is(x1.visible, Bool)) {
+ if (Type.typeof(x1.visible) == ValueType.TBool) {
DejaGnu.pass("DisplayObject::visible property exists");
} else {
DejaGnu.fail("DisplayObject::visible property doesn't exist");
}
- if (Std.is(x1.width, Float)) {
+ if (Type.typeof(x1.width) == ValueType.TFloat) {
DejaGnu.pass("DisplayObject::width property exists");
} else {
DejaGnu.fail("DisplayObject::width property doesn't exist");
}
- if (Std.is(x1.x, Float)) {
+ if (Type.typeof(x1.x) == ValueType.TFloat) {
DejaGnu.pass("DisplayObject::x property exists");
} else {
DejaGnu.fail("DisplayObject::x property doesn't exist");
}
- if (Std.is(x1.y, Float)) {
+ if (Type.typeof(x1.y) == ValueType.TFloat) {
DejaGnu.pass("DisplayObject::y property exists");
} else {
DejaGnu.fail("DisplayObject::y property doesn't exist");
=== modified file 'testsuite/as3/classes.all/geom/Rectangle_as.hx'
--- a/testsuite/as3/classes.all/geom/Rectangle_as.hx 2009-06-15 18:15:59
+0000
+++ b/testsuite/as3/classes.all/geom/Rectangle_as.hx 2009-06-15 20:00:09
+0000
@@ -36,177 +36,148 @@
import flash.Lib;
import Type;
import Std;
+import Reflect;
-// import our testing API
import DejaGnu;
-// Class must be named with the _as suffix, as that's the same name as the
file.
class Rectangle_as {
static function main() {
#if (flash8 || flash9)
- //check_equals(typeof(Rectangle), 'function');
if(Type.typeof(untyped Rectangle) == ValueType.TFunction) {
DejaGnu.pass("Rectangle is a function");
} else {
DejaGnu.fail("Rectangle is not a function");
}
- //check_equals(typeof(Rectangle.prototype), 'object');
if(Type.typeof(untyped Rectangle.prototype) ==
ValueType.TObject) {
DejaGnu.pass("Rectangle prototype is an object");
} else {
DejaGnu.fail("Rectangle prototype is not an object");
}
- //check(Rectangle.prototype.hasOwnProperty('bottom'));
if(untyped Rectangle.prototype.hasOwnProperty('bottom')) {
DejaGnu.pass("Rectangle prototype has 'bottom'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'bottom' property");
}
- //check(Rectangle.prototype.hasOwnProperty('bottomRight'));
if(untyped Rectangle.prototype.hasOwnProperty('bottomRight')) {
DejaGnu.pass("Rectangle prototype has 'bottomRight'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'bottomRight' property");
}
- //check(Rectangle.prototype.hasOwnProperty('left'));
if(untyped Rectangle.prototype.hasOwnProperty('left')) {
DejaGnu.pass("Rectangle prototype has 'left' property");
} else {
DejaGnu.fail("Rectangle prototype does not have 'left'
property");
}
- //check(Rectangle.prototype.hasOwnProperty('right'));
if(untyped Rectangle.prototype.hasOwnProperty('right')) {
DejaGnu.pass("Rectangle prototype has 'right'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have 'right'
property");
}
- //check(Rectangle.prototype.hasOwnProperty('size'));
if(untyped Rectangle.prototype.hasOwnProperty('size')) {
DejaGnu.pass("Rectangle prototype has 'size' property");
} else {
DejaGnu.fail("Rectangle prototype does not have 'size'
property");
}
- //check(Rectangle.prototype.hasOwnProperty('top'));
if(untyped Rectangle.prototype.hasOwnProperty('top')) {
DejaGnu.pass("Rectangle prototype has 'top' property");
} else {
DejaGnu.fail("Rectangle prototype does not have 'top'
property");
}
- //check(Rectangle.prototype.hasOwnProperty('topLeft'));
if(untyped Rectangle.prototype.hasOwnProperty('topLeft')) {
DejaGnu.pass("Rectangle prototype has 'topLeft'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'topLeft' property");
}
- //check(Rectangle.prototype.hasOwnProperty('clone'));
if(untyped Rectangle.prototype.hasOwnProperty('clone')) {
DejaGnu.pass("Rectangle prototype has 'clone'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have 'clone'
property");
}
- //check(Rectangle.prototype.hasOwnProperty('contains'));
if(untyped Rectangle.prototype.hasOwnProperty('contains')) {
DejaGnu.pass("Rectangle prototype has 'contains'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'contains' property");
}
- //check(Rectangle.prototype.hasOwnProperty('containsPoint'));
if(untyped Rectangle.prototype.hasOwnProperty('containsPoint'))
{
DejaGnu.pass("Rectangle prototype has 'containsPoint'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'containsPoint' property");
}
-
//check(Rectangle.prototype.hasOwnProperty('containsRectangle'));
if(untyped
Rectangle.prototype.hasOwnProperty('containsRectangle')) {
DejaGnu.pass("Rectangle prototype has
'containsRectangle' property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'containsRectangle' property");
}
- //check(Rectangle.prototype.hasOwnProperty('equals'));
if(untyped Rectangle.prototype.hasOwnProperty('equals')) {
DejaGnu.pass("Rectangle prototype has 'equals'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'equals' property");
}
- //check(Rectangle.prototype.hasOwnProperty('inflate'));
if(untyped Rectangle.prototype.hasOwnProperty('inflate')) {
DejaGnu.pass("Rectangle prototype has 'inflate'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'inflate' property");
}
- //check(Rectangle.prototype.hasOwnProperty('inflatePoint'));
if(untyped Rectangle.prototype.hasOwnProperty('inflatePoint')) {
DejaGnu.pass("Rectangle prototype has 'inflatePoint'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'inflatePoint' property");
}
- //check(Rectangle.prototype.hasOwnProperty('intersection'));
if(untyped Rectangle.prototype.hasOwnProperty('intersection')) {
DejaGnu.pass("Rectangle prototype has 'intersection'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'intersection' property");
}
- //check(Rectangle.prototype.hasOwnProperty('intersects'));
if(untyped Rectangle.prototype.hasOwnProperty('intersects')) {
DejaGnu.pass("Rectangle prototype has 'intersects'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'intersects' property");
}
- //check(Rectangle.prototype.hasOwnProperty('isEmpty'));
if(untyped Rectangle.prototype.hasOwnProperty('isEmpty')) {
DejaGnu.pass("Rectangle prototype has 'isEmpty'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'isEmpty' property");
}
- //check(Rectangle.prototype.hasOwnProperty('offset'));
if(untyped Rectangle.prototype.hasOwnProperty('offset')) {
DejaGnu.pass("Rectangle prototype has 'offset'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'offset' property");
}
- //check(Rectangle.prototype.hasOwnProperty('offsetPoint'));
if(untyped Rectangle.prototype.hasOwnProperty('offsetPoint')) {
DejaGnu.pass("Rectangle prototype has 'offsetPoint'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'offsetPoint' property");
}
- //check(Rectangle.prototype.hasOwnProperty('setEmpty'));
if(untyped Rectangle.prototype.hasOwnProperty('setEmpty')) {
DejaGnu.pass("Rectangle prototype has 'setEmpty'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'setEmpty' property");
}
- //check(Rectangle.prototype.hasOwnProperty('toString'));
if(untyped Rectangle.prototype.hasOwnProperty('toString')) {
DejaGnu.pass("Rectangle prototype has 'toString'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'toString' property");
}
- //check(Rectangle.prototype.hasOwnProperty('union'));
if(untyped Rectangle.prototype.hasOwnProperty('union')) {
DejaGnu.pass("Rectangle prototype has 'union'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have 'union'
property");
}
- //check(!Rectangle.prototype.hasOwnProperty('height'));
if(!(untyped Rectangle.prototype.hasOwnProperty('height'))) {
DejaGnu.pass("Rectangle prototype has 'height'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have
'height' property");
}
- //check(!Rectangle.prototype.hasOwnProperty('width'));
if(!(untyped Rectangle.prototype.hasOwnProperty('width'))) {
DejaGnu.pass("Rectangle prototype has 'width'
property");
} else {
DejaGnu.fail("Rectangle prototype does not have 'width'
property");
}
- //check(!Rectangle.prototype.hasOwnProperty('x'));
if(!(untyped Rectangle.prototype.hasOwnProperty('x'))) {
DejaGnu.pass("Rectangle prototype has 'x' property");
} else {
DejaGnu.fail("Rectangle prototype does not have 'x'
property");
}
- //check(!Rectangle.prototype.hasOwnProperty('y'));
if(!(untyped Rectangle.prototype.hasOwnProperty('y'))) {
DejaGnu.pass("Rectangle prototype has 'y' property");
} else {
@@ -224,50 +195,42 @@
var x1:Rectangle<Int> = new Rectangle();
DejaGnu.note("var x1:Rectangle<Int> = new Rectangle();");
#end
- //check_equals(typeof(x1), 'object');
if (Type.typeof(x1) == ValueType.TObject) {
DejaGnu.pass("new Rectangle() returns an object");
} else {
DejaGnu.fail("new Rectangle() does not return an
object");
}
- //check(x1 instanceof Rectangle);
if (Std.is(x1, Rectangle)) {
DejaGnu.pass("new Rectangle() returns a Rectangle object");
} else {
DejaGnu.fail("new Rectangle() does not return a Rectangle object");
}
- //check(x1.hasOwnProperty('height'));
if(untyped x1.hasOwnProperty('height')) {
DejaGnu.pass("Rectangle object has 'height' property");
} else {
DejaGnu.fail("Rectangle object does not have 'height'
property");
}
- //check(x1.hasOwnProperty('width'));
if(untyped x1.hasOwnProperty('width')) {
DejaGnu.pass("Rectangle object has 'width' property");
} else {
DejaGnu.fail("Rectangle object does not have 'width'
property");
}
- //check(x1.hasOwnProperty('x'));
if(untyped x1.hasOwnProperty('x')) {
DejaGnu.pass("Rectangle object has 'x' property");
} else {
DejaGnu.fail("Rectangle object does not have 'x'
property");
}
- //check(x1.hasOwnProperty('y'));
if(untyped x1.hasOwnProperty('y')) {
DejaGnu.pass("Rectangle object has 'y' property");
} else {
DejaGnu.fail("Rectangle object does not have 'y'
property");
}
- //check_equals(''+x1, '(x=0, y=0, w=0, h=0)');
if (x1.toString() == "(x=0, y=0, w=0, h=0)") {
DejaGnu.pass("Rectangle object is correct rectangle
(x=0, y=0, w=0, h=0)");
} else {
DejaGnu.fail(
"Rectangle property is incorrect rectangle (should be
(x=0, y=0, w=0, h=0), is "+x1.toString()+")");
}
- //check(x1.isEmpty());
if (x1.isEmpty()) {
DejaGnu.pass("Rectangle object is empty");
} else {
@@ -326,26 +289,148 @@
} else {
DejaGnu.fail("Rectangle object is not empty");
}
- //x1 = new Rectangle(1, 1, 1, "string");
- //DejaGnu.note("x1 = new Rectangle(1, 1, 1, "string");");
- //check_equals(''+x1, '(x=1, y=1, w=1, h=string)');
- //if (x1.toString() == "(x=1, y=1, w=1, h=string)") {
- // DejaGnu.pass("Rectangle object is correct rectangle
(x=1, y=1, w=1, h=string)");
- //} else {
- // DejaGnu.fail(
- // "Rectangle property is incorrect rectangle (should be
(x=1, y=1, w=1, h=string), is "+x1.toString()+")");
- //}
- //check(x1.isEmpty());
- //if (x1.isEmpty()) {
- // DejaGnu.pass("Rectangle object is empty");
- //} else {
- // DejaGnu.fail("Rectangle object is not empty");
- //}
- //r0 = new Rectangle(['a',3], 1, -30, 'string');
- //check_equals(''+r0, '(x=a,3, y=1, w=-30, h=string)');
- //check(r0.isEmpty());
- //check_equals(typeof(r0.width), 'number');
- //check_equals(typeof(r0.height), 'string');
+ x1 = new Rectangle(1, 1, 1, untyped "string");
+ DejaGnu.note("x1 = new Rectangle(1, 1, 1, untyped
\"string\");");
+ if (x1.toString() == "(x=1, y=1, w=1, h=string)") {
+ DejaGnu.pass("Rectangle object is correct rectangle
(x=1, y=1, w=1, h=string)");
+ } else {
+ DejaGnu.fail(
+ "Rectangle property is incorrect rectangle (should be
(x=1, y=1, w=1, h=string), is "+x1.toString()+")");
+ }
+ if (x1.isEmpty()) {
+ DejaGnu.pass("Rectangle object is empty");
+ } else {
+ DejaGnu.fail("Rectangle object is not empty");
+ }
+ x1 = new Rectangle(untyped ['a',3], 1, -30, untyped 'string');
+ DejaGnu.note("x1 = new Rectangle(['a',3], 1, -30, 'string');");
+ if (x1.toString() == "(x=a,3, y=1, w=-30, h=string)") {
+ DejaGnu.pass("Rectangle object is correct rectangle
(x=a,3, y=1, w=-30, h=string)");
+ } else {
+ DejaGnu.fail(
+ "Rectangle property is incorrect rectangle (should be
(x=a,3, y=1, w=-30, h=string), is "+x1.toString()+")");
+ }
+ if (x1.isEmpty()) {
+ DejaGnu.pass("Rectangle object is empty");
+ } else {
+ DejaGnu.fail("Rectangle object is not empty");
+ }
+ if(Std.is(x1.width, Int)) {
+ DejaGnu.pass("Rectangle object .width is a number");
+ } else {
+ DejaGnu.fail("Rectangle object .width is not a number");
+ }
+ if(Std.is(x1.height, String)) {
+ DejaGnu.pass("Rectangle object .height is a string");
+ } else {
+ DejaGnu.fail("Rectangle object .height is not a
string");
+ }
+ //o1 = {}; o1.toString = function() { return '2'; };
+ var o1 = {};
+ Reflect.setField(o1, 'toString', function() { return '2'; });
+ x1 = new Rectangle(0,0,untyped o1,null);
+ DejaGnu.note("x1 = new Rectangle(0,0,untyped o1,null);");
+ if (x1.toString() == "(x=0, y=0, w=2, h=null)") {
+ DejaGnu.pass("Rectangle object is correct rectangle
(x=0, y=0, w=2, h=null)");
+ } else {
+ DejaGnu.fail(
+ "Rectangle property is incorrect rectangle (should be
(x=0, y=0, w=2, h=null), is "+x1.toString()+")");
+ }
+ if (x1.isEmpty()) {
+ DejaGnu.pass("Rectangle object is empty");
+ } else {
+ DejaGnu.fail("Rectangle object is not empty");
+ }
+ if(Type.typeof(x1.width) == ValueType.TObject) {
+ DejaGnu.pass("Rectangle object .width is an object");
+ } else {
+ DejaGnu.fail("Rectangle object .width is not an
object");
+ }
+ if(Type.typeof(x1.height) == ValueType.TNull) {
+ DejaGnu.pass("Rectangle object .height is null");
+ } else {
+ DejaGnu.fail("Rectangle object .height is not null");
+ }
+
+ x1 = new Rectangle(0, 0, untyped o1, untyped o1);
+ DejaGnu.note("x1 = new Rectangle(0, 0, untyped o1, untyped
o1);");
+ if (x1.toString() == "(x=0, y=0, w=2, h=2)") {
+ DejaGnu.pass("Rectangle object is correct rectangle
(x=0, y=0, w=2, h=2)");
+ } else {
+ DejaGnu.fail(
+ "Rectangle property is incorrect rectangle (should be
(x=0, y=0, w=2, h=2), is "+x1.toString()+")");
+ }
+ if (x1.isEmpty()) {
+ DejaGnu.pass("Rectangle object is empty");
+ } else {
+ DejaGnu.fail("Rectangle object is not empty");
+ }
+ if(Type.typeof(x1.width) == ValueType.TObject) {
+ DejaGnu.pass("Rectangle object .width is an object");
+ } else {
+ DejaGnu.fail("Rectangle object .width is not an
object");
+ }
+ if(Type.typeof(x1.height) == ValueType.TObject) {
+ DejaGnu.pass("Rectangle object .height is an object");
+ } else {
+ DejaGnu.fail("Rectangle object .height is not an
object");
+ }
+
+ x1 = new Rectangle(untyped 'string', 0, 2, 2);
+ DejaGnu.note("x1 = new Rectangle(untyped 'string', 0, 2, 2);");
+ if (x1.toString() == "(x=string, y=0, w=2, h=2)") {
+ DejaGnu.pass("Rectangle object is correct rectangle
(x=string, y=0, w=2, h=2)");
+ } else {
+ DejaGnu.fail(
+ "Rectangle property is incorrect rectangle (should be
(x=string, y=0, w=2, h=2), is "+x1.toString()+")");
+ }
+ if (!x1.isEmpty()) {
+ DejaGnu.pass("Rectangle object is empty");
+ } else {
+ DejaGnu.fail("Rectangle object is not empty");
+ }
+ if(x1.x == untyped 'string') {
+ DejaGnu.pass("x1.x == 'string'");
+ } else {
+ DejaGnu.fail("x1.x != 'string'");
+ }
+ if(x1.y == 0) {
+ DejaGnu.pass("x1.y == 0");
+ } else {
+ DejaGnu.fail("x1.y != 0");
+ }
+ if(x1.width == 2) {
+ DejaGnu.pass("x1.width == 2");
+ } else {
+ DejaGnu.fail("x1.width != 2");
+ }
+ if(x1.height == 2) {
+ DejaGnu.pass("x1.height == 2");
+ } else {
+ DejaGnu.fail("x1.height != 2");
+ }
+
+ x1.width = 40;
+ DejaGnu.note("x1.width = 40;");
+ x1.height = untyped 'string2';
+ DejaGnu.note("x1.height = 'string2';");
+ x1.x = 32;
+ DejaGnu.note("x1.x = 32;");
+ x1.y = -30;
+ DejaGnu.note("x1.y = -30;");
+ if (x1.toString() == "(x=32, y=-30, w=40, h=string2)") {
+ DejaGnu.pass("Rectangle object is correct rectangle
(x=32, y=-30, w=40, h=string2)");
+ } else {
+ DejaGnu.fail(
+ "Rectangle property is incorrect rectangle (should be
(x=32, y=-30, w=40, h=string2), is "+x1.toString()+")");
+ }
+ Reflect.deleteField(x1, 'x');
+ if (x1.toString() == "(x=undefined, y=-30, w=40, h=string2)") {
+ DejaGnu.pass("Rectangle object is correct rectangle
(x=undefined, y=-30, w=40, h=string2)");
+ } else {
+ DejaGnu.fail(
+ "Rectangle property is incorrect rectangle (should be
(x=undefined, y=-30, w=40, h=string2), is "+x1.toString()+")");
+ }
//-------------------------------------------------------------
// Test bottom, right, left top
@@ -453,36 +538,83 @@
// Test bottomRight, topLeft
//-------------------------------------------------------------
- if (Std.is(x1.bottomRight, Point)) {
- DejaGnu.pass("Rectangle.bottomRight property exists");
- } else {
- DejaGnu.fail("Rectangle.bottomRight property doesn't
exist");
- }
- if (Std.is(x1.topLeft, Point)) {
- DejaGnu.pass("Rectangle.topLeft property exists");
- } else {
- DejaGnu.fail("Rectangle.topLeft property doesn't exist");
- }
+ x1 = new Rectangle(untyped 'x', untyped 'y', untyped 'w',
untyped 'h');
+ DejaGnu.note("x1 = new Rectangle(untyped 'x', untyped 'y',
untyped 'w', untyped 'h');");
+ if(Std.is(x1.bottomRight, Point)) {
+ DejaGnu.pass("x1.bottomRight is a Point");
+ } else {
+ DejaGnu.fail("x1.bottomRight should be a Point, is
"+Type.typeof(x1.bottomRight));
+ }
+ if(Std.is(x1.topLeft, Point)) {
+ DejaGnu.pass("x1.topLeft is a Point");
+ } else {
+ DejaGnu.fail("x1.topLeft should be a Point, is
"+Type.typeof(x1.topLeft));
+ }
+ if(x1.bottomRight.toString() == '(x=xw, y=yh)') {
+ DejaGnu.pass("x1.bottomRight is the correct point
(x=xw, y=yh)");
+ } else {
+ DejaGnu.fail("x1.bottomRight should be (x=xw, y=yh), is
"+x1.bottomRight.toString());
+ }
+ if(x1.topLeft.toString() == '(x=x, y=y)') {
+ DejaGnu.pass("x1.topLeft is the correct point (x=x,
y=y)");
+ } else {
+ DejaGnu.fail("x1.topLeft should be (x=x, y=y), is
"+x1.topLeft.toString());
+ }
+
+ //ASSetPropFlags(r0, "bottomRight", 0, 4); // clear read-only
(if any)
+ //r0.bottomRight = 4;
+ //check_equals(typeof(r0.bottomRight), 'object');
+
+ //ASSetPropFlags(r0, "topLeft", 0, 4); // clear read-only (if
any)
+ //r0.topLeft = 4;
+ //check_equals(typeof(r0.topLeft), 'object');
//-------------------------------------------------------------
// Test size
//-------------------------------------------------------------
- if (Std.is(x1.size, Point)) {
- DejaGnu.pass("Rectangle.size property exists");
- } else {
- DejaGnu.fail("Rectangle.size property doesn't exist");
- }
+ x1 = new Rectangle(untyped 'x',untyped 'y',untyped 'w',untyped
'h');
+ DejaGnu.note("x1 = new Rectangle(untyped 'x',untyped
'y',untyped 'w',untyped 'h');");
+ if(Std.is(x1.size, Point)) {
+ DejaGnu.pass("x1.size is a Point");
+ } else {
+ DejaGnu.fail("x1.size is not a Point");
+ }
+ if(x1.size.toString() == '(x=w, y=h)') {
+ DejaGnu.pass("x1.size is the correct Point (x=w, y=h)");
+ } else {
+ DejaGnu.fail("x1.size should be (x=w, y=h), is
"+x1.size.toString());
+ }
+ //ASSetPropFlags(r0, "size", 0, 4); // clear read-only (if any)
+ //r0.size = 4;
+ //check_equals(typeof(r0.topLeft), 'object');
//-------------------------------------------------------------
// Test clone
//-------------------------------------------------------------
- if (Type.typeof(x1.clone) == ValueType.TFunction) {
- DejaGnu.pass("Rectangle::clone() method exists");
- } else {
- DejaGnu.fail("Rectangle::clone() method doesn't exist");
- }
+ x1 = new Rectangle(untyped 'x',untyped 'y',untyped 'w',untyped
'h');
+ DejaGnu.note("x1 = new Rectangle(untyped 'x',untyped
'y',untyped 'w',untyped 'h');");
+ //Reflect.setField(x1, 'custom', 4);
+ untyped x1.custom = 4;
+#if flash9
+ var x2:Rectangle = x1.clone();
+#else
+ var x2:Rectangle<Int> = x1.clone();
+#end
+ DejaGnu.note("x2 = x1.clone();");
+ //check_equals(r2.toString(), '(x=x, y=y, w=w, h=h)');
+ if(x2.toString() == '(x=x, y=y, w=w, h=h)') {
+ DejaGnu.pass("x2 is the correct Rectangle (x=x, y=y,
w=w, h=h)");
+ } else {
+ DejaGnu.fail("x2 should be (x=x, y=y, w=w, h=h), is
"+x2.toString());
+ }
+ //check_equals(r2.custom, undefined);
+ if(Std.string(untyped x2.custom) == 'undefined') {
+ DejaGnu.pass("no nonsense fields were cloned");
+ } else {
+ DejaGnu.fail("a nonsense field was cloned! x2.custom =
"+Std.string(untyped x2.custom));
+ }
//-------------------------------------------------------------
// Test contains
@@ -566,33 +698,185 @@
}
//NONTRIVIAL CALLS
- //if (x1.contains().toString == "undefined") {
- // DejaGnu.pass("Rectangle.contains(null,null) returns
undefined");
- //} else {
- // DejaGnu.fail("Rectangle.contains(null,null) did not
return undefined");
- //}
-
- //if (x1.contains(0).toString == "undefined") {
- // DejaGnu.pass("Rectangle.contains(null,null) returns
undefined");
- //} else {
- // DejaGnu.fail("Rectangle.contains(null,null) did not
return undefined");
- //}
-
- //if (x1.contains(0, undefined).toString == "undefined") {
- // DejaGnu.pass("Rectangle.contains(null,null) returns
undefined");
- //} else {
- // DejaGnu.fail("Rectangle.contains(null,null) did not
return undefined");
- //}
-
- //if (x1.contains(0,null).toString == "undefined") {
- // DejaGnu.pass("Rectangle.contains(null,null) returns
undefined");
- //} else {
- // DejaGnu.fail("Rectangle.contains(null,null) did not
return undefined");
- //}
-
- //ret = r0.contains('1', '1');
- //check_equals(typeof(ret), 'boolean');
- //check_equals(ret, true);
+ if (Type.typeof(Reflect.callMethod(x1, Reflect.field(x1,
'contains'), [])) == ValueType.TNull) {
+ DejaGnu.pass("Rectangle.contains() returns undefined");
+ } else {
+ DejaGnu.fail("Rectangle.contains() did not return
undefined");
+ }
+
+ if (Type.typeof(Reflect.callMethod(x1, Reflect.field(x1,
'contains'), [0])) == ValueType.TNull) {
+ DejaGnu.pass("Rectangle.contains(0) returns undefined");
+ } else {
+ DejaGnu.fail("Rectangle.contains(0) did not return
undefined");
+ }
+
+ if (Type.typeof(Reflect.callMethod(x1, Reflect.field(x1,
'contains'), [0,'undefined'])) == ValueType.TNull) {
+ DejaGnu.pass("Rectangle.contains(0,'undefined') returns
undefined");
+ } else {
+ DejaGnu.fail("Rectangle.contains(0,'undefined') did not
return undefined");
+ }
+
+ if (Type.typeof(Reflect.callMethod(x1, Reflect.field(x1,
'contains'), [0,null])) == ValueType.TNull) {
+ DejaGnu.pass("Rectangle.contains(0,null) returns
undefined");
+ } else {
+ DejaGnu.fail("Rectangle.contains(0,null) did not return
undefined");
+ }
+
+ if (Reflect.callMethod(x1, Reflect.field(x1, 'contains'),
['1','1'])) {
+ DejaGnu.pass("Rectangle.contains('1','1') returns
true");
+ } else {
+ DejaGnu.fail("Rectangle.contains('1','1') returns
false");
+ }
+
+ var o1 = { valueOfCalls : 0 };
+ var o2 = { valueOfCalls : 0 };
+ Reflect.setField(o1, 'valueOf', function() { o1.valueOfCalls++;
return 3; });
+ Reflect.setField(o2, 'valueOf', function() { o2.valueOfCalls++;
return 2; });
+ var ret = x1.contains(untyped o1, untyped o2);
+ if(o1.valueOfCalls == 2) { // if ( *o1* < r0.x || *o1* >=
r0.x+r0.width ) return false
+ DejaGnu.pass("o1.valueOfCalls == 2");
+ } else {
+ DejaGnu.fail("o1.valueOfCalls != 2");
+ }
+ if(o2.valueOfCalls == 2) { // if ( *o2* < r0.y || *o2* >=
r0.y+r0.height ) return false
+ DejaGnu.pass("o2.valueOfCalls == 2");
+ } else {
+ DejaGnu.fail("o2.valueOfCalls != 2");
+ }
+ if(ret) {
+ DejaGnu.pass("x1.contains(o1, o2) returns true");
+ } else {
+ DejaGnu.fail("x1.contains(o1, o2) returns false");
+ }
+
+ Reflect.setField(o1, 'valueOf', function() { o1.valueOfCalls++;
return -1; });
+ Reflect.setField(o2, 'valueOf', function() { o2.valueOfCalls++;
return 2; });
+ Reflect.setField(o1, 'valueOfCalls', 0);
+ Reflect.setField(o2, 'valueOfCalls', 0);
+ ret = x1.contains(untyped o1, untyped o2);
+ if(o1.valueOfCalls == 1) { // if ( *o1* < r0.x || *o1* >=
r0.x+r0.width ) return false
+ DejaGnu.pass("o1.valueOfCalls == 1");
+ } else {
+ DejaGnu.fail("o1.valueOfCalls != 1");
+ }
+ if(o2.valueOfCalls == 0) { // ... (false returned above)
+ DejaGnu.pass("o2.valueOfCalls == 0");
+ } else {
+ DejaGnu.fail("o2.valueOfCalls != 0");
+ }
+ if(Std.is(ret, Bool)) {
+ DejaGnu.pass("Type of ret is boolean");
+ } else {
+ DejaGnu.fail("Type of ret should be boolean, is
"+Type.typeof(ret));
+ }
+ if(!ret) {
+ DejaGnu.pass("and ret = false");
+ } else {
+ DejaGnu.fail("and ret = true");
+ }
+
+ Reflect.setField(o1, 'valueOf', function() { o1.valueOfCalls++;
return 'undefined'; });
+ Reflect.setField(o2, 'valueOf', function() { o2.valueOfCalls++;
return 2; });
+ Reflect.setField(o1, 'valueOfCalls', 0);
+ Reflect.setField(o2, 'valueOfCalls', 0);
+ ret = x1.contains(untyped o1, untyped o2);
+ if(o1.valueOfCalls == 2) { // if ( *o1* < r0.x || *o1* >=
r0.x+r0.width ) return xxx
+ DejaGnu.xpass("o1.valueOfCalls == 2");
+ } else {
+ DejaGnu.xfail("o1.valueOfCalls != 2");
+ }
+ // Test for Y is skipped, likely because
+ // the test for X evaluated to undefined anyway
+ if(o2.valueOfCalls == 0) {
+ DejaGnu.pass("o2.valueOfCalls == 0");
+ } else {
+ DejaGnu.fail("o2.valueOfCalls != 0");
+ }
+ if(Type.typeof(ret) == ValueType.TNull) {
+ DejaGnu.pass("Type of ret is undefined");
+ } else {
+ DejaGnu.fail("Type of ret should be undefined, is
"+Type.typeof(ret));
+ }
+
+ Reflect.setField(o1, 'valueOf', function() { return null; });
+ Reflect.setField(o2, 'valueOf', function() { return 2; });
+ ret = x1.contains(untyped o1, untyped o2);
+ if(Type.typeof(ret) == ValueType.TNull) {
+ DejaGnu.pass("Type of ret is undefined");
+ } else {
+ DejaGnu.fail("Type of ret should be undefined, is
"+Type.typeof(ret));
+ }
+
+ ret = x1.contains(0/0, 2);
+ if(Type.typeof(ret) == ValueType.TNull) {
+ DejaGnu.pass("Type of ret is undefined");
+ } else {
+ DejaGnu.fail("Type of ret should be undefined, is
"+Type.typeof(ret));
+ }
+
+ x1 = new Rectangle(untyped 'd',untyped 'd',untyped '10',untyped
'10');
+ ret = x1.contains(untyped 'e',untyped 'e');
+ if(!ret) {
+ DejaGnu.pass("x1.contains('e', 'e') returns false");
+ } else {
+ DejaGnu.fail("x1.contains('e', 'e') returns true");
+ }
+
+ x1 = new Rectangle(untyped 'a',untyped 'a',untyped 'b',untyped
'b');
+ ret = x1.contains(untyped 'a',untyped 'a'); // 'a' >= 'a' &&
'a' < 'ab'
+ if(ret) {
+ DejaGnu.pass("x1.contains('a', 'a') returns true");
+ } else {
+ DejaGnu.fail("x1.contains('a', 'a') returns false");
+ }
+
+ x1 = new Rectangle(untyped 'a',untyped 'a',untyped 'c',untyped
'c');
+ ret = x1.contains(untyped 'ab',untyped 'ab'); // 'ab' >= 'ac'
&& 'ab' < 'ac'
+ if(ret) {
+ DejaGnu.pass("x1.contains('ab', 'ab') returns true");
+ } else {
+ DejaGnu.fail("x1.contains('ab', 'ab') returns false");
+ }
+
+ x1 = new Rectangle(untyped '2',untyped '2',untyped '10',untyped
'10');
+ ret = x1.contains(untyped '3',untyped '3');
+ if(!ret) { // string-wise, '3' > '210' ('2'+'10')
+ DejaGnu.pass("x1.contains('3', '3') returns false");
+ } else {
+ DejaGnu.fail("x1.contains('3', '3') returns true");
+ }
+
+ x1 = new Rectangle(untyped '2',untyped '2',untyped '10',untyped
'10');
+ ret = x1.contains(3, 3);
+ if(ret) { // number-wise, 3 > 2 and < 210 ('2'+'10')
+ DejaGnu.pass("x1.contains(3, 3) returns true");
+ } else {
+ DejaGnu.fail("x1.contains(3, 3) returns false");
+ }
+
+ x1 = new Rectangle(2, 2, 10, 10);
+ ret = x1.contains(untyped '3',untyped '3');
+ if(ret) { // number-wise, 3 > 2 && 3 < 10
+ DejaGnu.pass("x1.contains('3', '3') returns true");
+ } else {
+ DejaGnu.fail("x1.contains('3', '3') returns false");
+ }
+
+ x1 = new Rectangle(2, 2, untyped '0',untyped '0'); // becomes
2,2,'20','20'
+ ret = x1.contains(untyped '3',untyped '3');
+ if(!ret) { // '3' > 2 but '3' > '20'
+ DejaGnu.pass("x1.contains('3', '3') returns false");
+ } else {
+ DejaGnu.fail("x1.contains('3', '3') returns true");
+ }
+
+ x1 = new Rectangle(2, 2,untyped '0',untyped '0'); // becomes
2,2,'20','20'
+ ret = x1.contains(3, 3);
+ if(ret) { // 3 > 2 && 3 > '20'
+ DejaGnu.pass("x1.contains(3, 3) returns true");
+ } else {
+ DejaGnu.fail("x1.contains(3, 3) returns false");
+ }
//-------------------------------------------------------------
// Test containsPoint
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11122: Fixed more tests,
Bob Naugle <=