Update CSS tests to revision c8ec30de8099360ecf6581035bfdf2180fcc9755

Necessary for:

https://github.com/servo/servo/pull/7117
This commit is contained in:
Corey Farwell 2015-09-01 14:37:41 -04:00
parent e46499a5df
commit c51deb9a6e
156 changed files with 13569 additions and 535 deletions

View file

@ -21,64 +21,8 @@
<p>Test DOMRect and DOMRectReadOnly interfaces</p>
<div id="log"></div>
<script>
test(function() {
checkDOMRect(new DOMRect(),
{ x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0 });
},'testConstructor0');
test(function() {
checkDOMRect(new DOMRect(1),
{ x: 1, y: 0, width: 0, height: 0, top: 0, right: 1, bottom: 0, left: 1 });
},'testConstructor1');
test(function() {
checkDOMRect(new DOMRect(1, 2),
{ x: 1, y: 2, width: 0, height: 0, top: 2, right: 1, bottom: 2, left: 1 });
},'testConstructor2');
test(function() {
checkDOMRect(new DOMRect(1, 2, 3),
{ x: 1, y: 2, width: 3, height: 0, top: 2, right: 4, bottom: 2, left: 1 });
},'testConstructor3');
test(function() {
checkDOMRect(new DOMRect(1, 2, 3, 4),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
},'testConstructor4');
test(function() {
checkDOMRect(new DOMRect(1, 2, 3, 4, 5),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
},'testConstructor5');
test(function() {
checkDOMRect(new DOMRect(2, 2, -4, 4),
{ x: 2, y: 2, width: -4, height: 4, top: 2, right: 2, bottom: 6, left: -2 });
},'testConstructorNegativeWidth');
test(function() {
checkDOMRect(new DOMRect(2, 2, 4, -4),
{ x: 2, y: 2, width: 4, height: -4, top: -2, right: 6, bottom: 2, left: 2 });
},'testConstructorNegativeHeight');
test(function() {
checkDOMRect(new DOMRect(2, 2, -4, -4),
{ x: 2, y: 2, width: -4, height: -4, top: -2, right: 2, bottom: 2, left: -2 });
},'testConstructorNegativeWidthHeight');
test(function() {
checkDOMRect(new DOMRect(0, 0, undefined, 4),
{ x: 0, y: 0, width: NaN, height: 4, top: 0, right: 0, bottom: 4, left: 0 });
},'testConstructorUndefined1');
test(function() {
checkDOMRect(new DOMRect(NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, null),
{ x: NaN, y: -Infinity, width: Infinity, height: 0, top: -Infinity, right: NaN, bottom: -Infinity, left: NaN });
},'testConstructorUndefined2');
test(function() {
checkDOMRect(new DOMRect("1", "2", "3", "4"),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
},'testConstructorString1');
test(function() {
checkDOMRect(new DOMRect("a", "b", "c", "d"),
{ x: NaN, y: NaN, width: NaN, height: NaN, top: NaN, right: NaN, bottom: NaN, left: NaN });
},'testConstructorString2');
test(function() {
assert_throws(new TypeError(), function() { new DOMRectReadOnly(); });
},'testConstructorIllegal1');
test(function() {
assert_throws(new TypeError(), function() { new DOMRectReadOnly(1, 2, 3, 4); });
},'testConstructorIllegal2');
testConstructor(DOMRect);
testConstructor(DOMRectReadOnly);
test(function() {
var r = new DOMRect();
r.top = 5;
@ -94,13 +38,115 @@
var r = new DOMRect();
r.x = 5;
assert_equals(r.x, 5, "Expected value for x is 5");
assert_equals(r.left, 5, "Expected value for left is 5");
assert_equals(r.right, 5, "Expected value for right is 5");
r.y = 5;
assert_equals(r.y, 5, "Expected value for y is 5");
assert_equals(r.top, 5, "Expected value for top is 5");
assert_equals(r.bottom, 5, "Expected value for bottom is 5");
r.width = 5;
assert_equals(r.width, 5, "Expected value for width is 5");
assert_equals(r.left, 5, "Expected value for left is 5");
assert_equals(r.right, 10, "Expected value for right is 10");
r.height = 5;
assert_equals(r.height, 5, "Expected value for height is 5");
assert_equals(r.top, 5, "Expected value for top is 5");
assert_equals(r.bottom, 10, "Expected value for bottom is 10");
},'testSetAttributes');
test(function() {
var r = new DOMRectReadOnly();
r.top = 5;
assert_equals(r.top, 0, "Expected value for top is 0");
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
r.right = 5;
assert_equals(r.right, 0, "Expected value for right is 0");
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.left, 0, "Expected value for left is 0");
r.bottom = 5;
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.top, 0, "Expected value for top is 0");
r.left = 5;
assert_equals(r.left, 0, "Expected value for left is 0");
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.right, 0, "Expected value for right is 0");
},'testReadOnlySetReadOnlyAttributes');
test(function() {
var r = new DOMRectReadOnly();
r.x = 0;
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.left, 0, "Expected value for left is 0");
assert_equals(r.right, 0, "Expected value for right is 0");
r.y = 0;
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.top, 0, "Expected value for top is 0");
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
r.width = 0;
assert_equals(r.width, 0, "Expected value for width is 0");
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.right, 0, "Expected value for right is 0");
r.height = 0;
assert_equals(r.height, 0, "Expected value for height is 0");
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
},'testReadOnlySetAttributes');
function testConstructor(constructor) {
var prefix = constructor === DOMRect ? 'testConstructor' : 'testReadOnlyConstructor';
test(function() {
checkDOMRect(new constructor(),
{ x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0 });
}, prefix + '0');
test(function() {
checkDOMRect(new constructor(1),
{ x: 1, y: 0, width: 0, height: 0, top: 0, right: 1, bottom: 0, left: 1 });
}, prefix + '1');
test(function() {
checkDOMRect(new constructor(1, 2),
{ x: 1, y: 2, width: 0, height: 0, top: 2, right: 1, bottom: 2, left: 1 });
}, prefix + '2');
test(function() {
checkDOMRect(new constructor(1, 2, 3),
{ x: 1, y: 2, width: 3, height: 0, top: 2, right: 4, bottom: 2, left: 1 });
}, prefix + '3');
test(function() {
checkDOMRect(new constructor(1, 2, 3, 4),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
}, prefix + '4');
test(function() {
checkDOMRect(new constructor(1, 2, 3, 4, 5),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
}, prefix + '5');
test(function() {
checkDOMRect(new constructor(2, 2, -4, 4),
{ x: 2, y: 2, width: -4, height: 4, top: 2, right: 2, bottom: 6, left: -2 });
}, prefix + 'NegativeWidth');
test(function() {
checkDOMRect(new constructor(2, 2, 4, -4),
{ x: 2, y: 2, width: 4, height: -4, top: -2, right: 6, bottom: 2, left: 2 });
}, prefix + 'NegativeHeight');
test(function() {
checkDOMRect(new constructor(2, 2, -4, -4),
{ x: 2, y: 2, width: -4, height: -4, top: -2, right: 2, bottom: 2, left: -2 });
}, prefix + 'NegativeWidthHeight');
test(function() {
checkDOMRect(new constructor(0, 0, undefined, 4),
{ x: 0, y: 0, width: 0, height: 4, top: 0, right: 0, bottom: 4, left: 0 });
}, prefix + 'Undefined1');
test(function() {
checkDOMRect(new constructor(NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, null),
{ x: NaN, y: -Infinity, width: Infinity, height: 0, top: -Infinity, right: NaN, bottom: -Infinity, left: NaN });
}, prefix + 'Undefined2');
test(function() {
checkDOMRect(new constructor("1", "2", "3", "4"),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
}, prefix + 'String1');
test(function() {
checkDOMRect(new constructor("a", "b", "c", "d"),
{ x: NaN, y: NaN, width: NaN, height: NaN, top: NaN, right: NaN, bottom: NaN, left: NaN });
}, prefix + 'String2');
}
function checkDOMRect(r, exp) {
assert_equals(r.x, exp.x, "Expected value for x is " + exp.x);

View file

@ -9,5 +9,5 @@ html/dompoint-001.htm 4eab429b2c693c8262acc9c9e4b8fe388ccefe7d ?
xhtml1/dompoint-001.xht 4eab429b2c693c8262acc9c9e4b8fe388ccefe7d ?
html/domquad-001.htm 55abae26ff2b8b770ae585a4373ca850270f920b ?
xhtml1/domquad-001.xht 55abae26ff2b8b770ae585a4373ca850270f920b ?
html/domrect-001.htm a5a47b5f64f9f0148de72d0093892bdbc64b3c63 ?
xhtml1/domrect-001.xht a5a47b5f64f9f0148de72d0093892bdbc64b3c63 ?
html/domrect-001.htm 2683301224ae44225ab87152ac19e1cd866f59ae ?
xhtml1/domrect-001.xht 2683301224ae44225ab87152ac19e1cd866f59ae ?

View file

@ -2,4 +2,4 @@ id references title flags links revision credits assertion
DOMMatrix-001 Geometry Interfaces: DOMMatrix and DOMMatrixReadOnly constructors script http://www.w3.org/TR/geometry-1/#DOMMatrix,http://www.w3.org/TR/geometry-1/#dommatrix-constructors,http://www.w3.org/TR/geometry-1/#dom-dommatrix-dommatrix 9ef5062544554f66a8c941d084bf9fd707277436 `Dirk Schulze`<mailto:dschulze@adobe.com>
DOMPoint-001 Geometry Interfaces: DOMPoint and DOMPointReadOnly interface tests script http://www.w3.org/TR/geometry-1/#DOMPoint,http://www.w3.org/TR/geometry-1/#dictdef-dompointinit,http://www.w3.org/TR/geometry-1/#dom-dompoint-dompoint,http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-x,http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-y,http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-z,http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-w 4eab429b2c693c8262acc9c9e4b8fe388ccefe7d `Dirk Schulze`<mailto:dschulze@adobe.com>
DOMQuad-001 Geometry Interfaces: DOMQuad interface tests script http://www.w3.org/TR/geometry-1/#DOMQuad,http://www.w3.org/TR/geometry-1/#dom-domquad-domquad,http://www.w3.org/TR/geometry-1/#dom-domquad-p1,http://www.w3.org/TR/geometry-1/#dom-domquad-p2,http://www.w3.org/TR/geometry-1/#dom-domquad-p3,http://www.w3.org/TR/geometry-1/#dom-domquad-p4,http://www.w3.org/TR/geometry-1/#dom-domquad-bounds 55abae26ff2b8b770ae585a4373ca850270f920b `Dirk Schulze`<mailto:dschulze@adobe.com>
DOMRect-001 Geometry Interfaces: DOMRect and DOMRectReadOnly interface tests script http://www.w3.org/TR/geometry-1/#DOMRect,http://www.w3.org/TR/geometry-1/#dom-domrect,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly,http://www.w3.org/TR/geometry-1/#dom-domrect-domrect,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-x,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-y,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-width,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-height,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-top,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-left,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-right,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-bottom a5a47b5f64f9f0148de72d0093892bdbc64b3c63 `Dirk Schulze`<mailto:dschulze@adobe.com>
DOMRect-001 Geometry Interfaces: DOMRect and DOMRectReadOnly interface tests script http://www.w3.org/TR/geometry-1/#DOMRect,http://www.w3.org/TR/geometry-1/#dom-domrect,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly,http://www.w3.org/TR/geometry-1/#dom-domrect-domrect,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-x,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-y,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-width,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-height,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-top,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-left,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-right,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-bottom 2683301224ae44225ab87152ac19e1cd866f59ae `Dirk Schulze`<mailto:dschulze@adobe.com>

View file

@ -21,64 +21,8 @@
<p>Test DOMRect and DOMRectReadOnly interfaces</p>
<div id="log"></div>
<script>
test(function() {
checkDOMRect(new DOMRect(),
{ x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0 });
},'testConstructor0');
test(function() {
checkDOMRect(new DOMRect(1),
{ x: 1, y: 0, width: 0, height: 0, top: 0, right: 1, bottom: 0, left: 1 });
},'testConstructor1');
test(function() {
checkDOMRect(new DOMRect(1, 2),
{ x: 1, y: 2, width: 0, height: 0, top: 2, right: 1, bottom: 2, left: 1 });
},'testConstructor2');
test(function() {
checkDOMRect(new DOMRect(1, 2, 3),
{ x: 1, y: 2, width: 3, height: 0, top: 2, right: 4, bottom: 2, left: 1 });
},'testConstructor3');
test(function() {
checkDOMRect(new DOMRect(1, 2, 3, 4),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
},'testConstructor4');
test(function() {
checkDOMRect(new DOMRect(1, 2, 3, 4, 5),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
},'testConstructor5');
test(function() {
checkDOMRect(new DOMRect(2, 2, -4, 4),
{ x: 2, y: 2, width: -4, height: 4, top: 2, right: 2, bottom: 6, left: -2 });
},'testConstructorNegativeWidth');
test(function() {
checkDOMRect(new DOMRect(2, 2, 4, -4),
{ x: 2, y: 2, width: 4, height: -4, top: -2, right: 6, bottom: 2, left: 2 });
},'testConstructorNegativeHeight');
test(function() {
checkDOMRect(new DOMRect(2, 2, -4, -4),
{ x: 2, y: 2, width: -4, height: -4, top: -2, right: 2, bottom: 2, left: -2 });
},'testConstructorNegativeWidthHeight');
test(function() {
checkDOMRect(new DOMRect(0, 0, undefined, 4),
{ x: 0, y: 0, width: NaN, height: 4, top: 0, right: 0, bottom: 4, left: 0 });
},'testConstructorUndefined1');
test(function() {
checkDOMRect(new DOMRect(NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, null),
{ x: NaN, y: -Infinity, width: Infinity, height: 0, top: -Infinity, right: NaN, bottom: -Infinity, left: NaN });
},'testConstructorUndefined2');
test(function() {
checkDOMRect(new DOMRect("1", "2", "3", "4"),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
},'testConstructorString1');
test(function() {
checkDOMRect(new DOMRect("a", "b", "c", "d"),
{ x: NaN, y: NaN, width: NaN, height: NaN, top: NaN, right: NaN, bottom: NaN, left: NaN });
},'testConstructorString2');
test(function() {
assert_throws(new TypeError(), function() { new DOMRectReadOnly(); });
},'testConstructorIllegal1');
test(function() {
assert_throws(new TypeError(), function() { new DOMRectReadOnly(1, 2, 3, 4); });
},'testConstructorIllegal2');
testConstructor(DOMRect);
testConstructor(DOMRectReadOnly);
test(function() {
var r = new DOMRect();
r.top = 5;
@ -94,13 +38,115 @@
var r = new DOMRect();
r.x = 5;
assert_equals(r.x, 5, "Expected value for x is 5");
assert_equals(r.left, 5, "Expected value for left is 5");
assert_equals(r.right, 5, "Expected value for right is 5");
r.y = 5;
assert_equals(r.y, 5, "Expected value for y is 5");
assert_equals(r.top, 5, "Expected value for top is 5");
assert_equals(r.bottom, 5, "Expected value for bottom is 5");
r.width = 5;
assert_equals(r.width, 5, "Expected value for width is 5");
assert_equals(r.left, 5, "Expected value for left is 5");
assert_equals(r.right, 10, "Expected value for right is 10");
r.height = 5;
assert_equals(r.height, 5, "Expected value for height is 5");
assert_equals(r.top, 5, "Expected value for top is 5");
assert_equals(r.bottom, 10, "Expected value for bottom is 10");
},'testSetAttributes');
test(function() {
var r = new DOMRectReadOnly();
r.top = 5;
assert_equals(r.top, 0, "Expected value for top is 0");
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
r.right = 5;
assert_equals(r.right, 0, "Expected value for right is 0");
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.left, 0, "Expected value for left is 0");
r.bottom = 5;
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.top, 0, "Expected value for top is 0");
r.left = 5;
assert_equals(r.left, 0, "Expected value for left is 0");
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.right, 0, "Expected value for right is 0");
},'testReadOnlySetReadOnlyAttributes');
test(function() {
var r = new DOMRectReadOnly();
r.x = 0;
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.left, 0, "Expected value for left is 0");
assert_equals(r.right, 0, "Expected value for right is 0");
r.y = 0;
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.top, 0, "Expected value for top is 0");
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
r.width = 0;
assert_equals(r.width, 0, "Expected value for width is 0");
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.right, 0, "Expected value for right is 0");
r.height = 0;
assert_equals(r.height, 0, "Expected value for height is 0");
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
},'testReadOnlySetAttributes');
function testConstructor(constructor) {
var prefix = constructor === DOMRect ? 'testConstructor' : 'testReadOnlyConstructor';
test(function() {
checkDOMRect(new constructor(),
{ x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0 });
}, prefix + '0');
test(function() {
checkDOMRect(new constructor(1),
{ x: 1, y: 0, width: 0, height: 0, top: 0, right: 1, bottom: 0, left: 1 });
}, prefix + '1');
test(function() {
checkDOMRect(new constructor(1, 2),
{ x: 1, y: 2, width: 0, height: 0, top: 2, right: 1, bottom: 2, left: 1 });
}, prefix + '2');
test(function() {
checkDOMRect(new constructor(1, 2, 3),
{ x: 1, y: 2, width: 3, height: 0, top: 2, right: 4, bottom: 2, left: 1 });
}, prefix + '3');
test(function() {
checkDOMRect(new constructor(1, 2, 3, 4),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
}, prefix + '4');
test(function() {
checkDOMRect(new constructor(1, 2, 3, 4, 5),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
}, prefix + '5');
test(function() {
checkDOMRect(new constructor(2, 2, -4, 4),
{ x: 2, y: 2, width: -4, height: 4, top: 2, right: 2, bottom: 6, left: -2 });
}, prefix + 'NegativeWidth');
test(function() {
checkDOMRect(new constructor(2, 2, 4, -4),
{ x: 2, y: 2, width: 4, height: -4, top: -2, right: 6, bottom: 2, left: 2 });
}, prefix + 'NegativeHeight');
test(function() {
checkDOMRect(new constructor(2, 2, -4, -4),
{ x: 2, y: 2, width: -4, height: -4, top: -2, right: 2, bottom: 2, left: -2 });
}, prefix + 'NegativeWidthHeight');
test(function() {
checkDOMRect(new constructor(0, 0, undefined, 4),
{ x: 0, y: 0, width: 0, height: 4, top: 0, right: 0, bottom: 4, left: 0 });
}, prefix + 'Undefined1');
test(function() {
checkDOMRect(new constructor(NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, null),
{ x: NaN, y: -Infinity, width: Infinity, height: 0, top: -Infinity, right: NaN, bottom: -Infinity, left: NaN });
}, prefix + 'Undefined2');
test(function() {
checkDOMRect(new constructor("1", "2", "3", "4"),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
}, prefix + 'String1');
test(function() {
checkDOMRect(new constructor("a", "b", "c", "d"),
{ x: NaN, y: NaN, width: NaN, height: NaN, top: NaN, right: NaN, bottom: NaN, left: NaN });
}, prefix + 'String2');
}
function checkDOMRect(r, exp) {
assert_equals(r.x, exp.x, "Expected value for x is " + exp.x);

View file

@ -21,64 +21,8 @@
<p>Test DOMRect and DOMRectReadOnly interfaces</p>
<div id="log"></div>
<script>
test(function() {
checkDOMRect(new DOMRect(),
{ x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0 });
},'testConstructor0');
test(function() {
checkDOMRect(new DOMRect(1),
{ x: 1, y: 0, width: 0, height: 0, top: 0, right: 1, bottom: 0, left: 1 });
},'testConstructor1');
test(function() {
checkDOMRect(new DOMRect(1, 2),
{ x: 1, y: 2, width: 0, height: 0, top: 2, right: 1, bottom: 2, left: 1 });
},'testConstructor2');
test(function() {
checkDOMRect(new DOMRect(1, 2, 3),
{ x: 1, y: 2, width: 3, height: 0, top: 2, right: 4, bottom: 2, left: 1 });
},'testConstructor3');
test(function() {
checkDOMRect(new DOMRect(1, 2, 3, 4),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
},'testConstructor4');
test(function() {
checkDOMRect(new DOMRect(1, 2, 3, 4, 5),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
},'testConstructor5');
test(function() {
checkDOMRect(new DOMRect(2, 2, -4, 4),
{ x: 2, y: 2, width: -4, height: 4, top: 2, right: 2, bottom: 6, left: -2 });
},'testConstructorNegativeWidth');
test(function() {
checkDOMRect(new DOMRect(2, 2, 4, -4),
{ x: 2, y: 2, width: 4, height: -4, top: -2, right: 6, bottom: 2, left: 2 });
},'testConstructorNegativeHeight');
test(function() {
checkDOMRect(new DOMRect(2, 2, -4, -4),
{ x: 2, y: 2, width: -4, height: -4, top: -2, right: 2, bottom: 2, left: -2 });
},'testConstructorNegativeWidthHeight');
test(function() {
checkDOMRect(new DOMRect(0, 0, undefined, 4),
{ x: 0, y: 0, width: NaN, height: 4, top: 0, right: 0, bottom: 4, left: 0 });
},'testConstructorUndefined1');
test(function() {
checkDOMRect(new DOMRect(NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, null),
{ x: NaN, y: -Infinity, width: Infinity, height: 0, top: -Infinity, right: NaN, bottom: -Infinity, left: NaN });
},'testConstructorUndefined2');
test(function() {
checkDOMRect(new DOMRect("1", "2", "3", "4"),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
},'testConstructorString1');
test(function() {
checkDOMRect(new DOMRect("a", "b", "c", "d"),
{ x: NaN, y: NaN, width: NaN, height: NaN, top: NaN, right: NaN, bottom: NaN, left: NaN });
},'testConstructorString2');
test(function() {
assert_throws(new TypeError(), function() { new DOMRectReadOnly(); });
},'testConstructorIllegal1');
test(function() {
assert_throws(new TypeError(), function() { new DOMRectReadOnly(1, 2, 3, 4); });
},'testConstructorIllegal2');
testConstructor(DOMRect);
testConstructor(DOMRectReadOnly);
test(function() {
var r = new DOMRect();
r.top = 5;
@ -94,13 +38,115 @@
var r = new DOMRect();
r.x = 5;
assert_equals(r.x, 5, "Expected value for x is 5");
assert_equals(r.left, 5, "Expected value for left is 5");
assert_equals(r.right, 5, "Expected value for right is 5");
r.y = 5;
assert_equals(r.y, 5, "Expected value for y is 5");
assert_equals(r.top, 5, "Expected value for top is 5");
assert_equals(r.bottom, 5, "Expected value for bottom is 5");
r.width = 5;
assert_equals(r.width, 5, "Expected value for width is 5");
assert_equals(r.left, 5, "Expected value for left is 5");
assert_equals(r.right, 10, "Expected value for right is 10");
r.height = 5;
assert_equals(r.height, 5, "Expected value for height is 5");
assert_equals(r.top, 5, "Expected value for top is 5");
assert_equals(r.bottom, 10, "Expected value for bottom is 10");
},'testSetAttributes');
test(function() {
var r = new DOMRectReadOnly();
r.top = 5;
assert_equals(r.top, 0, "Expected value for top is 0");
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
r.right = 5;
assert_equals(r.right, 0, "Expected value for right is 0");
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.left, 0, "Expected value for left is 0");
r.bottom = 5;
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.top, 0, "Expected value for top is 0");
r.left = 5;
assert_equals(r.left, 0, "Expected value for left is 0");
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.right, 0, "Expected value for right is 0");
},'testReadOnlySetReadOnlyAttributes');
test(function() {
var r = new DOMRectReadOnly();
r.x = 0;
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.left, 0, "Expected value for left is 0");
assert_equals(r.right, 0, "Expected value for right is 0");
r.y = 0;
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.top, 0, "Expected value for top is 0");
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
r.width = 0;
assert_equals(r.width, 0, "Expected value for width is 0");
assert_equals(r.x, 0, "Expected value for x is 0");
assert_equals(r.right, 0, "Expected value for right is 0");
r.height = 0;
assert_equals(r.height, 0, "Expected value for height is 0");
assert_equals(r.y, 0, "Expected value for y is 0");
assert_equals(r.bottom, 0, "Expected value for bottom is 0");
},'testReadOnlySetAttributes');
function testConstructor(constructor) {
var prefix = constructor === DOMRect ? 'testConstructor' : 'testReadOnlyConstructor';
test(function() {
checkDOMRect(new constructor(),
{ x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0 });
}, prefix + '0');
test(function() {
checkDOMRect(new constructor(1),
{ x: 1, y: 0, width: 0, height: 0, top: 0, right: 1, bottom: 0, left: 1 });
}, prefix + '1');
test(function() {
checkDOMRect(new constructor(1, 2),
{ x: 1, y: 2, width: 0, height: 0, top: 2, right: 1, bottom: 2, left: 1 });
}, prefix + '2');
test(function() {
checkDOMRect(new constructor(1, 2, 3),
{ x: 1, y: 2, width: 3, height: 0, top: 2, right: 4, bottom: 2, left: 1 });
}, prefix + '3');
test(function() {
checkDOMRect(new constructor(1, 2, 3, 4),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
}, prefix + '4');
test(function() {
checkDOMRect(new constructor(1, 2, 3, 4, 5),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
}, prefix + '5');
test(function() {
checkDOMRect(new constructor(2, 2, -4, 4),
{ x: 2, y: 2, width: -4, height: 4, top: 2, right: 2, bottom: 6, left: -2 });
}, prefix + 'NegativeWidth');
test(function() {
checkDOMRect(new constructor(2, 2, 4, -4),
{ x: 2, y: 2, width: 4, height: -4, top: -2, right: 6, bottom: 2, left: 2 });
}, prefix + 'NegativeHeight');
test(function() {
checkDOMRect(new constructor(2, 2, -4, -4),
{ x: 2, y: 2, width: -4, height: -4, top: -2, right: 2, bottom: 2, left: -2 });
}, prefix + 'NegativeWidthHeight');
test(function() {
checkDOMRect(new constructor(0, 0, undefined, 4),
{ x: 0, y: 0, width: 0, height: 4, top: 0, right: 0, bottom: 4, left: 0 });
}, prefix + 'Undefined1');
test(function() {
checkDOMRect(new constructor(NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, null),
{ x: NaN, y: -Infinity, width: Infinity, height: 0, top: -Infinity, right: NaN, bottom: -Infinity, left: NaN });
}, prefix + 'Undefined2');
test(function() {
checkDOMRect(new constructor("1", "2", "3", "4"),
{ x: 1, y: 2, width: 3, height: 4, top: 2, right: 4, bottom: 6, left: 1 });
}, prefix + 'String1');
test(function() {
checkDOMRect(new constructor("a", "b", "c", "d"),
{ x: NaN, y: NaN, width: NaN, height: NaN, top: NaN, right: NaN, bottom: NaN, left: NaN });
}, prefix + 'String2');
}
function checkDOMRect(r, exp) {
assert_equals(r.x, exp.x, "Expected value for x is " + exp.x);