blob: 74807d062b9f0f63f798b8bb7a795ee020f6b649 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script language="JavaScript" type="text/javascript">
var resetWidth;
var resetHeight;
var resetX;
var resetY;
var width = 100;
var height = 200;
var x = 25;
var y = 50;
function reset()
{
window.moveTo(0, 0);
window.resizeTo(300, 200);
resetWidth = window.outerWidth;
resetHeight = window.outerHeight;
resetX = window.screenX;
resetY = window.screenY;
}
if (window.testRunner)
testRunner.dumpAsText();
reset();
description("This test makes sure that calling the window moving and resizing\
methods with less than 2 arguments treats the missing arguments as 0.");
// resizeTo /////////////////////////
debug('');
debug('window.resizeTo Tests');
debug('');
debug("Testing - resizeTo with 0 arguments");
window.resizeTo();
shouldBe('window.outerWidth', 'resetWidth');
shouldBe('window.outerHeight', 'resetHeight');
reset();
debug("Testing - resizeTo with 1 argument");
window.resizeTo(x);
shouldBe('window.outerWidth', 'width');
shouldBe('window.outerHeight', 'resetHeight');
reset();
debug("Testing - resizeTo with more than 2 arguments");
window.resizeTo(width, height, 200, "text");
shouldBe('window.outerWidth', 'width');
shouldBe('window.outerHeight', 'height');
reset();
// resizeBy /////////////////////////
debug('');
debug('window.resizeBy Tests');
debug('');
debug("Testing - resizeBy with 0 arguments");
window.resizeBy();
shouldBe('window.outerWidth', 'resetWidth');
shouldBe('window.outerHeight', 'resetHeight');
reset();
debug("Testing - resizeBy with 1 argument");
window.resizeBy(x);
shouldBe('window.outerWidth', 'resetWidth + x');
shouldBe('window.outerHeight', 'resetHeight');
reset();
debug("Testing - resizeBy with more than 2 arguments");
window.resizeBy(x, y, 200, "text");
shouldBe('window.outerWidth', 'resetWidth + x');
shouldBe('window.outerHeight', 'resetHeight + y');
reset();
// moveTo /////////////////////////
debug('');
debug('window.moveTo Tests');
debug('');
debug("Testing - moveTo with 0 arguments");
window.moveTo();
shouldBe('window.screenX', 'resetX');
shouldBe('window.screenY', 'resetY');
reset();
debug("Testing - moveTo with 1 argument");
window.moveTo(x);
shouldBe('window.screenX', 'resetX + x');
shouldBe('window.screenY', 'resetY');
reset();
debug("Testing - moveTo with more than 2 arguments");
window.moveTo(x, y, 200, "text");
shouldBe('window.screenX', 'x + screen.availLeft');
shouldBe('window.screenY', 'y + screen.availTop');
reset();
// moveBy /////////////////////////
debug('');
debug('window.moveBy Tests');
debug('');
debug("Testing - moveBy with 0 arguments");
window.moveBy();
shouldBe('window.screenX', 'resetX');
shouldBe('window.screenY', 'resetY');
reset();
debug("Testing - moveBy with 1 argument");
window.moveBy(x);
shouldBe('window.screenX', 'resetX + x');
shouldBe('window.screenY', 'resetY');
reset();
debug("Testing - moveBy with more than 2 arguments");
window.moveBy(x, y, 200, "text");
shouldBe('window.screenX', 'resetX + x');
shouldBe('window.screenY', 'resetY + y');
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>