<!DOCTYPE html>

<html>
<head>
    <script src="../../../../resources/basic-gestures.js"></script>
    <script>
        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.waitUntilDone();
        }
    
        async function runTest()
        {
            if (!testRunner.runUIScript)
                return;

            var output = '';
            var editableTargetRect = document.getElementById('editable').getBoundingClientRect();
            var firstTargetRect = document.getElementById('firstSelection').getBoundingClientRect();
            var secondTargetRect = document.getElementById('secondSelection').getBoundingClientRect();
            var thirdTargetRect = document.getElementById('thirdSelection').getBoundingClientRect();
            var editableToNoneditableOffset = document.getElementById('noneditable').getBoundingClientRect().y - document.getElementById('editable').getBoundingClientRect().y;
        
            var pressPointX = firstTargetRect.x + firstTargetRect.width / 2;
            var pressPointY = firstTargetRect.y + firstTargetRect.height / 2 - editableToNoneditableOffset;
            var dragY = firstTargetRect.y - editableToNoneditableOffset;
            var dragX = firstTargetRect.x;
            var dragY2 = secondTargetRect.y - editableToNoneditableOffset;
            var dragY3 = thirdTargetRect.y - editableToNoneditableOffset;
            var dragY4 = firstTargetRect.y + firstTargetRect.height - editableToNoneditableOffset;
        
            await longPressAtPoint(pressPointX, pressPointY);
            if (document.getSelection().toString() == "ut")
                output += 'PASS: Correct Selection';
            else
                output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
            output += '<br>';

            await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY2);
            if (document.getSelection().toString() == "o eiusmod tempor incididunt ut")
                output += 'PASS: Correct Selection';
            else
                output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
            output += '<br>';

            await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY3);
            if (document.getSelection().toString() == " adipiscing elit, sed do eiusmod tempor incididunt ut")
                output += 'PASS: Correct Selection';
            else
                output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
            output += '<br>';

            await touchAndDragFromPointToPoint(dragX, dragY3, dragX, dragY2);
            if (document.getSelection().toString() == "o eiusmod tempor incididunt ut")
                output += 'PASS: Correct Selection';
            else
                output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
            output += '<br>';

            await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);
            if (document.getSelection().toString() == "ut")
                output += 'PASS: Correct Selection';
            else
                output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
            output += '<br>';

            var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4);
            if (document.getSelection().toString() == "ut")
                output += 'PASS: Correct Selection';
            else
                output += 'FAIL: failed to reduce selection to a single character by dragging down. Incorrect Selection: ' + document.getSelection().toString();
            output += '<br>';
            output += result;

            var noneditableElement = document.getElementById('noneditable');
            noneditableElement.parentNode.removeChild(noneditableElement);
            var editableElement = document.getElementById('editable');
            editableElement.parentNode.removeChild(editableElement);
            document.getElementById('target').innerHTML = output;
            testRunner.notifyDone();
        }

        window.addEventListener('load', runTest, false);
    </script>
    <style>
        #noneditable {
            height: 200px;
            width: 300px;
            background-color: silver;
            font-family: monospace;
            font-size: 18px;
        }
        #editable {
            height: 200px;
            width: 300px;
            background-color: silver;
            font-family: monospace;
            font-size: 18px;
        }
        #target {
            height: 50px;
            width: 300px;
            background-color: silver;
            font-family: monospace;
            font-size: 18px;
        }
    </style>
    <meta name="viewport" content="initial-scale=1">
</head>
<body>
    <div id="editable" contenteditable>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div> 
    <div id="noneditable">
        <p>Lorem ipsum dolor sit amet, consectetur<span id="thirdSelection"></span> adipiscing elit, sed d<span id="secondSelection"></span>o eiusmod tempor incididunt <span id="firstSelection">ut</span> labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
    <div id="target">
        This test requires UIScriptController to run.
    </div>
</body>
</html>
