blob: 540f3f1067b9fe61d3cf9aca90c961ca41602460 [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">
if (window.testRunner)
testRunner.dumpAsText();
window.moveTo(0,0);
description("This test makes sure that we have similar behavior as other\
browsers when resizing and moving a window outside of the screen. This test\
will fail in some dimensions when run manually because of inconsistencies of\
when the window can and cannot go behind the doc.");
var result;
var testName;
var x;
var y;
// resizeTo /////////////////////////
debug('');
debug('window.resizeTo Tests');
debug('');
x = screen.width*2;
y = screen.height*2;
window.resizeTo(x, y);
debug("Testing - resizeTo: Too Big");
shouldBe('window.outerWidth', 'screen.availWidth');
debug('');
x = 50;
y = 50;
window.resizeTo(x, y);
debug("Testing - resizeTo: Too Small");
shouldBe('window.outerWidth', '100');
debug('');
x = screen.width/10;
y = screen.height/10;
window.moveTo(x, y);
x = screen.width;
y = screen.height;
window.resizeTo(x, y);
debug("Testing - resizeTo: Full Screen Out of Bounds");
shouldBe('window.screenY', 'screen.availTop');
shouldBe('window.outerHeight', 'screen.availHeight');
shouldBe('window.screenX', 'screen.availLeft');
shouldBe('window.outerWidth', 'screen.availWidth');
debug('');
x = 100;
y = 100;
window.resizeTo(x, y);
x = screen.width/2;
y = screen.height/2;
window.moveTo(x, y);
x += 10;
y += 10;
window.resizeTo(x, y);
debug("Testing - resizeTo: Not Full Screen Out of Bounds");
shouldBe('window.outerHeight + window.screenY - screen.availTop', 'screen.availHeight');
shouldBe('window.outerWidth + window.screenX - screen.availLeft', 'screen.availWidth');
// resizeBy /////////////////////////
debug('');
debug('window.resizeBy Tests');
debug('');
x = 150;
y = 150;
window.resizeTo(x, y);
x = -100;
y = -100;
window.resizeBy(x, y);
debug("Testing - resizeBy: Too Small");
shouldBe('window.outerWidth', '100');
debug('');
x = screen.width*2;
y = screen.height*2;
window.resizeBy(x, y);
debug("Testing - resizeBy: Too Big");
shouldBe('window.outerWidth', 'screen.availWidth');
window.moveTo(0,0);
window.resizeTo(screen.width, screen.height);
// moveTo /////////////////////////
debug('');
debug('window.moveTo Tests');
debug('');
x = -100;
y = -100;
window.moveTo(x, y);
debug("Testing - moveTo: Top Left");
shouldBe('window.screenY', 'screen.availTop');
shouldBe('window.screenX', 'screen.availLeft');
debug('');
x = 0;
y = -100;
window.moveTo(x, y);
debug("Testing - moveTo: Top");
shouldBe('window.screenY', 'screen.availTop');
shouldBe('window.screenX', 'screen.availLeft');
debug('');
x = 100;
y = -100;
window.moveTo(x, y);
debug("Testing - moveTo: Top Right");
shouldBe('window.screenY', 'screen.availTop');
shouldBe('window.outerWidth', 'screen.availWidth');
debug('');
x = 100;
y = 0;
window.moveTo(x, y);
debug("Testing - moveTo: Right");
shouldBe('window.screenY', 'screen.availTop');
shouldBe('window.outerWidth', 'screen.availWidth');
debug('');
x = 100;
y = 100;
window.moveTo(x, y);
debug("Testing - moveTo: Bottom Right");
shouldBe('window.outerHeight', 'screen.availHeight');
shouldBe('window.outerWidth', 'screen.availWidth');
debug('');
x = 0;
y = 100;
window.moveTo(x, y);
debug("Testing - moveTo: Bottom");
shouldBe('window.outerHeight', 'screen.availHeight');
shouldBe('window.screenX', 'screen.availLeft');
debug('');
x = -100;
y = 100;
window.moveTo(x, y);
debug("Testing - moveTo: Bottom Left");
shouldBe('window.outerHeight', 'screen.availHeight');
shouldBe('window.screenX', 'screen.availLeft');
debug('');
x = -100;
y = 0;
window.moveTo(x, y);
debug("Testing - moveTo: Left");
shouldBe('window.screenY', 'screen.availTop');
shouldBe('window.screenX', 'screen.availLeft');
window.moveTo(0,0);
window.resizeTo(screen.width, screen.height);
// moveBy /////////////////////////
debug('');
debug('window.moveBy Tests');
debug('');
x = 100;
y = 100;
window.resizeTo(x, y);
x = 200;
y = 200;
window.moveTo(x, y);
var previousScreenX = window.screenX;
var previousScreenY = window.screenY;
x = 0;
y = 0;
window.moveBy(x, y);
debug("Testing - moveBy: Zero Zero");
shouldBeTrue('window.screenX == previousScreenX');
shouldBeTrue('window.screenY == previousScreenY');
debug('');
previousScreenX = window.screenX;
previousScreenY = window.screenY;
x = 1;
y = 0;
window.moveBy(x, y);
debug("Testing - moveBy: One Zero");
shouldBeTrue('window.screenX == previousScreenX + 1');
shouldBeTrue('window.screenY == previousScreenY');
debug('');
previousScreenX = window.screenX;
previousScreenY = window.screenY;
x = 0;
y = 1;
window.moveBy(x, y);
debug("Testing - moveBy: Zero One");
shouldBeTrue('window.screenX == previousScreenX');
shouldBeTrue('window.screenY == previousScreenY + 1');
debug('');
window.moveTo(0,0);
window.resizeTo(screen.width, screen.height);
x = -100;
y = -100;
window.moveBy(x, y);
debug("Testing - moveBy: Top Left");
shouldBe('window.screenY', 'screen.availTop');
shouldBe('window.screenX', 'screen.availLeft');
debug('');
x = 0;
y = -100;
window.moveBy(x, y);
debug("Testing - moveBy: Top");
shouldBe('window.screenY', 'screen.availTop');
shouldBe('window.screenX', 'screen.availLeft');
debug('');
x = 100;
y = -100;
window.moveBy(x, y);
debug("Testing - moveBy: Top Right");
shouldBe('window.screenY', 'screen.availTop');
shouldBe('window.outerWidth', 'screen.availWidth');
debug('');
x = 100;
y = 0;
window.moveBy(x, y);
debug("Testing - moveBy: Right");
shouldBe('window.screenY', 'screen.availTop');
shouldBe('window.outerWidth', 'screen.availWidth');
debug('');
x = 100;
y = 100;
window.moveBy(x, y);
debug("Testing - moveBy: Bottom Right");
shouldBe('window.outerHeight', 'screen.availHeight');
shouldBe('window.outerWidth', 'screen.availWidth');
debug('');
x = 0;
y = 100;
window.moveBy(x, y);
debug("Testing - moveBy: Bottom");
shouldBe('window.outerHeight', 'screen.availHeight');
debug('');
x = -1000;
y = 100;
window.moveBy(x, y);
debug("Testing - moveBy: Bottom Left");
shouldBe('window.outerHeight', 'screen.availHeight');
shouldBe('window.screenX', 'screen.availLeft');
debug('');
x = -100;
y = 0;
window.moveBy(x, y);
debug("Testing - moveBy: Left");
shouldBe('window.screenX', 'screen.availLeft');
debug('');
window.moveTo(0,0);
window.resizeTo(800,600);
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>