chromium/third_party/blink/web_tests/fast/dom/HTMLImageElement/image-natural-width-height.html

<html>
<script>
function runTest()
{
    if (window.testRunner)
        testRunner.dumpAsText();
        
    var result = document.getElementById('result');
    
    var i1 = document.getElementById('image1');
    if (i1.naturalWidth != 75 || i1.naturalHeight != 25)
        return;

    var i2 = document.getElementById('image2');
    if (i2.naturalWidth != 75 || i2.naturalHeight != 25)
        return;

    var i3 = document.getElementById('image3');
    if (i3.naturalWidth != 0 || i3.naturalHeight != 0)
        return;

    var i4 = document.getElementById('image4');
    if (i4.naturalWidth != 0 || i4.naturalHeight != 0)
        return;
        
    result.innerHTML = 'SUCCESS';
}
</script>

<body onload="runTest()">
<img id="image1" src="resources/blue_rect.jpg">
<img id="image2" width="10" height="10" src="resources/blue_rect.jpg">
<img id="image3" src="non-existent.jpg">
<img id="image4" src="non-existent.jpg" width="10" height="10">
<div>This tests that the naturalWidth and naturalHeight HTMLImageElement properties work correctly.</div>
<div id="result">FAILURE</div>
</body>
</html>