<p>
    This tests the mapping of length-type attributes to CSS length values.
</p>
<pre id="console"></pre>
<img id="img" style="display: none;">
<table><col id="col" style="display: none;"></table>
<script>
    if (window.layoutTestController)
        layoutTestController.dumpAsText();

    var console = document.getElementById("console");
    function log(message)
    {
        console.appendChild(document.createTextNode(message + "\n"));
    }

    function test(target, value, expected)
    {
        target.setAttribute("height", value);
        var actual = getComputedStyle(target, null).height;
        var mapping = actual == "auto" ? "not mapped" : "mapped to " + actual;
        if (actual == (expected ? expected : "auto"))
            log("PASS: " + value + " is " + mapping);
        else
            log("FAIL: " + value + " is " + mapping + " instead of " + (expected ? expected : "not being mapped"));
    }

    var img = document.getElementById("img");
    log ("<img>:");
    test(img, "90zz", "90px");
    test(img, "80%", "80%");
    test(img, "70%5", "70%");
    test(img, "60%%", "60%");
    test(img, "50*");
    test(img, "40*5");
    test(img, "30.5", "30px");
    log("");

    var col = document.getElementById("col");
    log ("<col>:");
    test(col, "90zz", "90px");
    test(col, "80%", "80%");
    test(col, "70%5", "70%");
    test(col, "60%%", "60%");
    test(col, "50*");
    test(col, "40*5");
    test(col, "30.5", "30px");
</script>
