Test chromium/chrome/editing/selection/click-before-and-after-table.html Detail

id
chromium/chrome/editing/selection/click-before-and-after-table.html
type
layouttest
version
0
enabled
1
tags
flags
layouttests
sections
url
http://localhost:8888/chromium/chrome/editing/selection/click-before-and-after-table.html
file
chromium/chrome/editing/selection/click-before-and-after-table.html

results
Firefox 2 Win (2.0.0.20) Firefox 2 Lin (2.0.0.20) Firefox 3 Win (3.0.6) Firefox 3 Lin (3.0.6) Firefox 3.1 Win (3.1b2) Firefox 3.1 Lin (3.1b2) Firefox trunk Win (2009 02 22) Firefox trunk Lin (2009 02 22) Safari 3 Win (3.2) Safari trunk Win (41121) Opera 9 Win (9.62) Opera 9 Lin (9.62) IE 6 Win (6) IE 7 Win (7) IE 8 Win (8rc1)

Layouttest detail

expected:
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 7 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of BODY > HTML > #document to 1 of BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of BODY > HTML > #document to 1 of BODY > HTML > #document toDOMRange:range from 8 of #text > TD > TR > TBODY > TABLE > BODY > HTML > #document to 8 of #text > TD > TR > TBODY > TABLE > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > TD > TR > TBODY > TABLE > BODY > HTML > #document to 8 of #text > TD > TR > TBODY > TABLE > BODY > HTML > #document toDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document toDOMRange:range from 0 of TD > TR > TBODY > TABLE > BODY > HTML > #document to 0 of TD > TR > TBODY > TABLE > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
cell one	cell two

file:
<script>
if (window.layoutTestController)
     layoutTestController.dumpEditingCallbacks();
</script>
<style>
td {
    border: 1px solid #aaa;
}
</style>

<body onload="runTest()" style="border: 1px solid red;" contenteditable="true"><table id="table" style="margin: 25px; border:10px solid #ccc; padding: 10px;"><tr><td>cell one</td><td>cell two</td></tr></table>
<ul id="console"></ul>
<script>
function log(message) {
    var console = document.getElementById("console");
    var li = document.createElement("li");
    var text = document.createTextNode(message);
    
    console.appendChild(li);
    li.appendChild(text);
}
function runTest() {
  if (!window.layoutTestController)
      log("This test uses the eventSender to do mouse clicks.  To run it manually, click after the table, the caret should appear there (and not inside the table).  Then click inside the table.  The caret should appear inside it.");
  else {
      window.layoutTestController.dumpAsText();
      var s, x, y, e, top, bottom, left, right;
      table = document.getElementById("table");
  
      top = table.offsetTop;
      left = table.offsetLeft;
      bottom = top + table.offsetHeight;
      right = left + table.offsetWidth;
      
      x = right + 5;
      y = (top + bottom) / 2;
      eventSender.mouseMoveTo(x, y);
      eventSender.mouseDown();
      eventSender.mouseUp();
      s = window.getSelection();
      if (!(s.anchorNode == document.body && s.anchorOffset == 1))
          log("Failure: Clicking after the table didn't put the caret after it.");
      
      x = right - 5;
      y = (top + bottom) / 2;
      eventSender.leapForward(1000);
      eventSender.mouseMoveTo(x, y);
      eventSender.mouseDown();
      eventSender.mouseUp();
      s = window.getSelection();
      if (s.anchorNode == document.body)
          log("Failure: Clicking inside the table put the caret before or after it.");
          
      x = left - 5;
      y = (top + bottom) / 2;
      eventSender.leapForward(1000);
      eventSender.mouseMoveTo(x, y);
      eventSender.mouseDown();
      eventSender.mouseUp();
      s = window.getSelection();
      if (s.anchorNode != table || s.anchorOffset != 0)
      if (!(s.anchorNode == document.body && s.anchorOffset == 0))
          log("Failure: Clicking before the table should be the caret before it.");
          
      x = left + 5;
      y = (top + bottom) / 2;
      eventSender.leapForward(1000);
      eventSender.mouseMoveTo(x, y);
      eventSender.mouseDown();
      eventSender.mouseUp();
      s = window.getSelection();
      if (s.anchorNode == document.body)
          log("Failure: Clicking inside the table put the caret before or after it.");
  }
}
</script>
</body>
file frame show/hide: