Commit 3be6290c authored by Yoichi Osato's avatar Yoichi Osato Committed by Commit Bot

[LayoutNG] Simplify a failing continuations-with-move-caret-to-boundary.html.

This patch simplifies the tests that confirms text selection upon drag
selects differently on mac.
I will move the test to selection/mouse.

Bug: 811502, 866120
Change-Id: Id9bb292236b709b65a98be1eff3fc778da02264b
Reviewed-on: https://chromium-review.googlesource.com/1163348
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581139}
parent 4f08052f
<!DOCTYPE HTML> <!DOCTYPE HTML>
<script src="../../resources/ahem.js"></script>
<script src="../../resources/testharness.js"></script> <script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script> <script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script> <script src="../assert_selection.js"></script>
<script> <script>
// Mac supports the 'moveCaretToBoundary' editing behavior. const isMac = navigator.platform.indexOf('Mac') === 0;
if (window.internals)
internals.settings.setEditingBehavior('mac'); function dragOverBlocks(selection, offsetTopToDestination) {
const document = selection.document;
test(() => const divlist = document.querySelectorAll('p');
assert_selection( const div0 = divlist[0];
'<font color="blue" id="font">|AAAAA<div>BLOCK</div><p>BBBBB</p><p id="secondP">CCCCC</p></font>', const div1 = divlist[1];
selection => { eventSender.mouseMoveTo(document.offsetLeft + div0.offsetLeft,
var document = selection.document; document.offsetTop + div0.offsetTop + 5);
var font = document.getElementById('font'); eventSender.mouseDown();
var secondP = document.getElementById('secondP'); eventSender.mouseMoveTo(document.offsetLeft + div1.offsetLeft + 40,
document.offsetTop + div1.offsetTop
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5); + offsetTopToDestination);
eventSender.mouseDown(); eventSender.mouseUp();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop + 5); }
eventSender.mouseUp();
}, const kStyle = '<style>* { font: 20px Ahem; }</style>';
'<font color="blue" id="font">^AAAAA<div>BLOCK</div><p>BBBBB</p><p id="secondP">CC|CCC</p></font>'),
'Continuations across a block when not hitting the margin'); selection_test(
[kStyle, '<p>AAAAA</p><p>BBBBB</p>'],
test(() => selection => dragOverBlocks(selection, -20),
assert_selection( [kStyle, '<p>^AA|AAA</p><p>BBBBB</p>'],
'<font color="blue" id="font">|AAAAA<p>BBBBB</p><p id="secondP">CCCCC</p></font>', 'Continuations across a block -20');
selection => {
var document = selection.document; selection_test(
var font = document.getElementById('font'); [kStyle, '<p>AAAAA</p><p>BBBBB</p>'],
var secondP = document.getElementById('secondP'); selection => dragOverBlocks(selection, -15),
[kStyle,
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5); isMac
eventSender.mouseDown(); ? '<p>^AAAAA</p><p>|BBBBB</p>'
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop - 5); : '<p>^AAAAA</p><p>BB|BBB</p>'
eventSender.mouseUp(); ],
}, 'Continuations across a block -15');
'<font color="blue" id="font">^AAAAA<p>BBBBB</p><p id="secondP">|CCCCC</p></font>'),
'Continuation margin'); selection_test(
[kStyle, '<p>AAAAA</p><p>BBBBB</p>'],
test(() => selection => dragOverBlocks(selection, 5),
assert_selection( [kStyle,'<p>^AAAAA</p><p>BB|BBB</p>'],
'<font color="blue" id="font">|AAAAA<div>BLOCK</div><p>BBBBB</p><p id="secondP">CCCCC</p></font>', 'Continuations across a block 5');
selection => {
var document = selection.document;
var font = document.getElementById('font');
var secondP = document.getElementById('secondP');
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop - 5);
eventSender.mouseUp();
},
'<font color="blue" id="font">^AAAAA<div>BLOCK</div><p>BBBBB</p><p id="secondP">|CCCCC</p></font>'),
'Continuation margin across a block 1');
test(() =>
assert_selection(
'<font color="blue" id="font">|AAAAA<p>BBBBB</p><div>BLOCK</div><p id="secondP">CCCCC</p></font>',
selection => {
var document = selection.document;
var font = document.getElementById('font');
var secondP = document.getElementById('secondP');
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop - 5);
eventSender.mouseUp();
},
'<font color="blue" id="font">^AAAAA<p>BBBBB</p><div>BLOCK</div><p id="secondP">|CCCCC</p></font>'),
'Continuation margin across a block 2');
test(() =>
assert_selection(
'<font color="blue" id="font">|AAAAA<div style="position: relative; margin-top: 50px;">BLOCK</div><p>BBBBB</p><p id="secondP">CCCCC</p></font>',
selection => {
var document = selection.document;
var font = document.getElementById('font');
var secondP = document.getElementById('secondP');
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop - 5);
eventSender.mouseUp();
},
'<font color="blue" id="font">^AAAAA<div style="position: relative; margin-top: 50px;">BLOCK</div><p>BBBBB</p><p id="secondP">|CCCCC</p></font>'),
'Continuation margin across a relative block 1');
test(() =>
assert_selection(
'<font color="blue" id="font">|AAAAA<p>BBBBB</p><div style="position: relative; margin-top: 50px;">BLOCK</div><p id="secondP">CCCCC</p></font>',
selection => {
var document = selection.document;
var font = document.getElementById('font');
var secondP = document.getElementById('secondP');
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop - 5);
eventSender.mouseUp();
},
'<font color="blue" id="font">^AAAAA<p>BBBBB</p><div style="position: relative; margin-top: 50px;">BLOCK</div><p id="secondP">|CCCCC</p></font>'),
'Continuation margin across a relative block 2');
</script> </script>
<!DOCTYPE HTML>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// Win does not support the 'moveCaretToBoundary' editing behavior.
if (window.internals)
internals.settings.setEditingBehavior('win');
test(() =>
assert_selection(
'<font color="blue" id="font">|AAAAA<div>BLOCK</div><p>BBBBB</p><p id="secondP">CCCCC</p></font>',
selection => {
var document = selection.document;
var font = document.getElementById('font');
var secondP = document.getElementById('secondP');
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop + 5);
eventSender.mouseUp();
},
'<font color="blue" id="font">^AAAAA<div>BLOCK</div><p>BBBBB</p><p id="secondP">CC|CCC</p></font>'),
'Continuations across a block when not hitting the margin');
test(() =>
assert_selection(
'<font color="blue" id="font">|AAAAA<p>BBBBB</p><p id="secondP">CCCCC</p></font>',
selection => {
var document = selection.document;
var font = document.getElementById('font');
var secondP = document.getElementById('secondP');
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop - 5);
eventSender.mouseUp();
},
'<font color="blue" id="font">^AAAAA<p>BBBBB</p><p id="secondP">CC|CCC</p></font>'),
'Continuation margin');
test(() =>
assert_selection(
'<font color="blue" id="font">|AAAAA<div>BLOCK</div><p>BBBBB</p><p id="secondP">CCCCC</p></font>',
selection => {
var document = selection.document;
var font = document.getElementById('font');
var secondP = document.getElementById('secondP');
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop - 5);
eventSender.mouseUp();
},
'<font color="blue" id="font">^AAAAA<div>BLOCK</div><p>BBBBB</p><p id="secondP">CC|CCC</p></font>'),
'Continuation margin across a block 1');
test(() =>
assert_selection(
'<font color="blue" id="font">|AAAAA<p>BBBBB</p><div>BLOCK</div><p id="secondP">CCCCC</p></font>',
selection => {
var document = selection.document;
var font = document.getElementById('font');
var secondP = document.getElementById('secondP');
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop - 5);
eventSender.mouseUp();
},
'<font color="blue" id="font">^AAAAA<p>BBBBB</p><div>BLOCK</div><p id="secondP">CC|CCC</p></font>'),
'Continuation margin across a block 2');
test(() =>
assert_selection(
'<font color="blue" id="font">|AAAAA<div style="position: relative; margin-top: 50px;">BLOCK</div><p>BBBBB</p><p id="secondP">CCCCC</p></font>',
selection => {
var document = selection.document;
var font = document.getElementById('font');
var secondP = document.getElementById('secondP');
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop - 5);
eventSender.mouseUp();
},
'<font color="blue" id="font">^AAAAA<div style="position: relative; margin-top: 50px;">BLOCK</div><p>BBBBB</p><p id="secondP">CC|CCC</p></font>'),
'Continuation margin across a relative block 1');
test(() =>
assert_selection(
'<font color="blue" id="font">|AAAAA<p>BBBBB</p><div style="position: relative; margin-top: 50px;">BLOCK</div><p id="secondP">CCCCC</p></font>',
selection => {
var document = selection.document;
var font = document.getElementById('font');
var secondP = document.getElementById('secondP');
eventSender.mouseMoveTo(document.offsetLeft + font.offsetLeft, document.offsetTop + font.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(document.offsetLeft + secondP.offsetLeft + 20, document.offsetTop + secondP.offsetTop - 5);
eventSender.mouseUp();
},
'<font color="blue" id="font">^AAAAA<p>BBBBB</p><div style="position: relative; margin-top: 50px;">BLOCK</div><p id="secondP">CC|CCC</p></font>'),
'Continuation margin across a relative block 2');
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment