<!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">
	// FIXME Disabled because of <rdar://problem/5569119>

    if (window.testRunner)
        testRunner.dumpAsText();

    window.moveTo(0, 0);

    description("This test makes sure that we cannot set the parameter of a \
    window to NaN, causing unpredicable results");

    var result;
    var testName;
    var x;
    var y;
    var badNum = "NaN";
    var defaultSize = 500;
    var defaultLocation = 0;

    // initialize window to a known size
    x = defaultSize;
    y = defaultSize;
    window.resizeTo(x, y);

    // resizeTo /////////////////////////
    debug('');
    debug('window.resizeTo Tests');
    debug('');

    x = badNum;
    y = defaultSize;
    window.resizeTo(x, y);
    debug("Testing - resizeTo: Bad width input");
    shouldBe('window.outerWidth', 'defaultSize');
    shouldBe('window.outerHeight', 'defaultSize');

    debug('');

    x = defaultSize;
    y = badNum;
    window.resizeTo(x, y);
    debug("Testing - resizeTo: Bad height input");
    shouldBe('window.outerWidth', 'defaultSize');
    shouldBe('window.outerHeight', 'defaultSize');
    
    debug('');

    x = badNum;
    y = badNum;
    window.resizeTo(x, y);
    debug("Testing - resizeTo: Bad width and height input");
    shouldBe('window.outerWidth', 'defaultSize');
    shouldBe('window.outerHeight', 'defaultSize');

    // resizeBy /////////////////////////
    debug('');
    debug('window.resizeBy Tests');
    debug('');

    x = badNum;
    y = 100;
    window.resizeBy(x, y);
    debug("Testing - resizeBy: Bad width input");
    shouldBe('window.outerWidth', 'defaultSize');
    shouldBe('window.outerHeight', 'defaultSize + y');

    debug('');
    window.resizeTo(defaultSize, defaultSize);

    x = 100;
    y = badNum;
    window.resizeBy(x, y);
    debug("Testing - resizeBy: Bad height input");
    shouldBe('window.outerWidth', 'defaultSize + x');
    shouldBe('window.outerHeight', 'defaultSize');

    // moveTo /////////////////////////
    debug('');
    debug('window.moveTo Tests');
    debug('');
    window.moveTo(screen.availLeft, screen.availTop);

    x = badNum;
    y = screen.availTop + 100;
    window.moveTo(x, y);
    debug("Testing - moveTo: Bad x input");
    shouldBe('window.screenY', 'y + (screen.availTop * 2)'); // FIXME this should be just y
    shouldBe('window.screenX', 'screen.availLeft');

    debug('');
    window.moveTo(screen.availLeft, screen.availTop);

    x = screen.availLeft + 100;
    y = badNum;
    window.moveTo(x, y);
    debug("Testing - moveTo: Bad y input");
    shouldBe('window.screenY', 'screen.availTop * 2'); // FIXME this should just be screen.availTop
    shouldBe('window.screenX', 'x');

    debug('');
    window.moveTo(screen.availLeft, screen.availTop);

    x = badNum;
    y = badNum;
    window.moveTo(x, y);
    debug("Testing - moveTo: Bad x and y input");
    shouldBe('window.screenY', 'screen.availTop * 2'); // FIXME this should just be screen.availTop
    shouldBe('window.screenX', 'screen.availLeft');

    // moveBy /////////////////////////
    debug('');
    debug('window.moveBy Tests');
    debug('');
    window.moveTo(screen.availLeft, screen.availTop);

    x = badNum;
    y = 100;
    window.moveBy(x, y);
    debug("Testing - moveBy: Bad x input");
    shouldBe('window.screenY', '(screen.availTop * 4) + y'); // FIXME this should just be screen.availTop + y
    shouldBe('window.screenX', 'screen.availLeft');

    debug('');
    window.moveTo(screen.availLeft, screen.availTop);

    x = 100;
    y = badNum;
    window.moveBy(x, y);
    debug("Testing - moveBy: Bad y input");
    shouldBe('window.screenY', 'screen.availTop * 4'); // FIXME this should just be screen.availTop
    shouldBe('window.screenX', 'screen.availLeft + x');

    debug('');
    window.moveTo(screen.availLeft, screen.availTop);

    x = badNum;
    y = badNum;
    window.moveBy(x, y);
    debug("Testing - moveBy: Bad x and y input");
    shouldBe('window.screenY', 'screen.availTop * 4'); // FIXME this should just be screen.availTop
    shouldBe('window.screenX', 'screen.availLeft');
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
