<!DOCTYPE HTML>
<html>
<body>
<script src="../resources/js-test-pre.js"></script>

<img tabindex="0" id="svg-image" alt="interactive SVG" >

<div id="console"></div>
<script>

description("This test ensures that accessibility elements can be created out of what a remote SVG image defines.")
window.jsTestIsAsync = true;

// Return the page's relative coordinates. If we rely on the x() or y() of the accessibility object, then
// accessibility transforms are applied that fail because there is no window available
function pageX(element) {
    return element.clickPointX - element.width/2;
}

function pageY(element) {
    return element.clickPointY - element.height/2;
}

function runAXTest() {    
    var container = accessibilityController.accessibleElementById("svg-image");

    var x = pageX(container) - 1;
    var y = pageY(container) - 1;

    debug("container location: (" + x + ", " + y + ")");

    var face = container.childAtIndex(0);
    debug('Face role: ' + face.role);
    debug('Face label: ' + face.description);
    debug('FaceX: ' + (pageX(face) - x));
    debug('FaceY: ' + Math.abs(pageY(face) - y));
    debug('<br>');

    var eye = container.childAtIndex(1);
    debug('Eye role: ' + eye.role);
    debug('Eye label: ' + eye.description);
    debug('EyeX: ' + (pageX(eye) - x));
    debug('EyeY: ' + Math.abs(pageY(eye) - y));
    debug('<br>');

    var nose = container.childAtIndex(3);
    debug('Nose role: ' + nose.role);
    debug('Nose label: ' + nose.description);
    debug('NoseX: ' + (pageX(nose) - x));
    debug('NoseY: ' + Math.abs(pageY(nose) - y));
    debug('<br>');

    var mouth = container.childAtIndex(4);
    debug('Mouth role: ' + mouth.role);
    debug('Mouth label: ' + mouth.description);
    debug('MouthX: ' + (pageX(mouth) - x));
    debug('MouthY: ' + Math.floor(Math.abs(pageY(mouth) - y)));
    debug('<br>');

    finishJSTest();
}

if (window.accessibilityController) {
    document.getElementById("svg-image").addEventListener("load", runAXTest);
}
document.getElementById("svg-image").src = "resources/svg-face.svg";

</script>

<script src="../resources/js-test-post.js"></script>
</body>
</html>

