Changeset 80492 in webkit
- Timestamp:
- Mar 7, 2011 1:22:28 PM (13 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r80491 r80492 1 2011-03-07 Xiaomei Ji <xji@chromium.org> 2 3 Reviewed by Martin Robinson. 4 5 Make fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html less port-dependent. 6 Preiously, the test clicked at a specific pixel so different fonts result in slightly different positions. 7 Change the test to click on a specific character offset. 8 https://bugs.webkit.org/show_bug.cgi?id=30816 9 10 * fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll-expected.txt: 11 * fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html: 12 * platform/chromium/test_expectations.txt: 13 * platform/gtk/Skipped: 14 * platform/mac-wk2/Skipped: 15 * platform/qt-wk2/Skipped: 16 * platform/qt/Skipped: 17 1 18 2011-03-07 Mihai Parparita <mihaip@chromium.org> 2 19 -
trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll-expected.txt
r49990 r80492 1 This is to test document.caretRangeFromPoint() in a zoom and scrolled page. The point calculation in caretRangeFromPoint() is wrong in a zoom and scrolled page. Same applies to elementFromPoint(). 1 A long text to test document caretRangeFromPoint. Test scroll, zoom, zoomAndScroll .................................... The End 2 PASS Test completed successfully 2 3 3 In a window large enough to hold the page without any scroll, click mouse after "S" in "Same" at the above sentence, observe the printed offset.4 5 Now, please resize the window to make the page scroll. Then, scroll the page. Click the mouse after "S" in "Same", observe the printed offset.6 7 8 9 Result: ".10 Success11 Success12 Success13 Success14 Success15 Success16 Success17 Success -
trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html
r49990 r80492 1 <HTML> 2 <HEAD> 3 <TITLE>document.caretRangeFromPoint() Method</TITLE> 4 <SCRIPT LANGUAGE="JavaScript"> 5 function log(str) { 6 var li = document.createElement("li"); 7 li.appendChild(document.createTextNode(str)); 8 var console = document.getElementById("console"); 9 console.appendChild(li); 10 } 1 <div id="first" style="width: 4000px; height: 1000px">A long text to test document caretRangeFromPoint. Test scroll, zoom, zoomAndScroll .................................... The End </div> 2 <ul id="console"></ul> 11 3 12 function assertEqual(actual, expected) { 13 if (actual != expected) 14 log("Failure, actual: " + actual + "; expected: " + expected); 15 else 16 log("Success"); 17 } 4 <script src="../../../js/resources/js-test-pre.js"></script> 5 <script> 6 function sendClick(x, y) 7 { 8 eventSender.mouseMoveTo(x, y); 9 eventSender.mouseDown(); 10 eventSender.mouseUp(); 11 } 12 13 // 29 is the character offset in the div text "A long text to test document caretRangeFromPoint". 14 var expectedOffset = 29; 15 var succeed = true; 16 17 function checkNodeAndOffsetFromCaretRangeFromPoint(message, event) 18 { 19 var range = document.caretRangeFromPoint(event.clientX, event.clientY); 20 var offset = 0; 21 if (range) 22 offset = range.startOffset; 23 else { 24 alert("range is null"); 25 return; 26 } 18 27 19 function sendClick() 20 { 21 eventSender.mouseMoveTo(50, 50); 22 eventSender.mouseDown(); 23 eventSender.mouseUp(); 24 } 28 var node = document.getElementById("first").firstChild; 29 if (range.startContainer != node) { 30 testFailed(message + " node should be div's child text node"); 31 succeed = false; 32 } 33 if (offset != expectedOffset) { 34 testFailed(message + " offset actual: " + offset + "; expected: " + expectedOffset); 35 succeed = false; 36 } 37 } 38 39 function checkBase(event) 40 { 41 checkNodeAndOffsetFromCaretRangeFromPoint("check base", event); 42 } 43 44 function checkScroll(event) 45 { 46 checkNodeAndOffsetFromCaretRangeFromPoint("check scroll", event); 47 } 48 49 function checkZoom(event) 50 { 51 checkNodeAndOffsetFromCaretRangeFromPoint("check zoom", event); 52 } 53 54 function checkZoomScroll(event) 55 { 56 checkNodeAndOffsetFromCaretRangeFromPoint("check zoom and scroll", event); 57 } 58 59 function scrollPage(x, y) 60 { 61 window.scrollTo(x, y); 62 } 63 64 onload = function() 65 { 66 if (!window.layoutTestController) 67 return; 68 69 layoutTestController.dumpAsText(); 70 71 var range = document.createRange(); 72 var node = document.getElementById("first"); 73 // Set range in the middle of word "document". 74 range.setStart(node.firstChild, expectedOffset); 75 range.setEnd(node.firstChild, expectedOffset + 1); 25 76 26 function check(event, expected) 27 { 28 var range =document.caretRangeFromPoint(event.clientX, event.clientY); 29 var offset = 0; 30 if (range) 31 offset = range.startOffset; 32 else { 33 alert("range is null"); 34 return; 77 // Base test. 78 window.addEventListener("click", checkBase, false); 79 rects = range.getClientRects(); 80 var x = rects[0].left; 81 var y = rects[0].top + rects[0].width / 2; 82 sendClick(x, y); 83 window.removeEventListener("click", checkBase, false); 84 85 // Test scroll. 86 window.addEventListener("click", checkScroll, false); 87 scrollPage(x / 2, 0); 88 sendClick(x / 2, y); 89 scrollPage(0, 0); 90 window.removeEventListener("click", checkScroll, false); 91 92 // Test zoom. 93 window.addEventListener("click", checkZoom, false); 94 node.style.zoom = 2.0; 95 rects = range.getClientRects(); 96 var x = rects[0].left; 97 var y = rects[0].top + rects[0].width / 2; 98 sendClick(x * 2, y); 99 window.removeEventListener("click", checkZoom, false); 100 101 // Test scroll and Zoom. 102 window.addEventListener("click", checkZoomScroll, false); 103 scrollPage(x, 0); 104 sendClick(x, y); 105 scrollPage(0, 0); 106 node.style.zoom = 1.0; 107 window.removeEventListener("click", checkZoomScroll, false); 108 109 if (succeed == true) 110 testPassed("Test completed successfully"); 35 111 } 36 37 var element = document.elementFromPoint(event.clientX, event.clientY); 38 assertEqual(element.id, "first"); 39 assertEqual(offset, expected); 40 } 41 42 function checkBase(event) 43 { 44 check(event, 54); 45 } 46 47 function checkScroll(event) 48 { 49 check(event, 93); 50 } 51 52 function checkZoom(event) 53 { 54 check(event, 19); 55 } 56 57 function checkZoomScroll(event) 58 { 59 check(event, 64); 60 } 61 62 function zoomPageIn() 63 { 64 if (window.eventSender) { 65 eventSender.zoomPageIn(); 66 } 67 } 68 69 function zoomPageOut() 70 { 71 if (window.eventSender) { 72 eventSender.zoomPageOut(); 73 } 74 } 75 76 function scrollPage(x, y) 77 { 78 window.scrollTo(x, y); 79 } 80 81 onload = function() 82 { 83 if (!window.layoutTestController) 84 return; 85 86 layoutTestController.dumpAsText(); 87 88 // Base. 89 window.addEventListener("click", checkBase, false); 90 sendClick(); 91 window.removeEventListener("click", checkBase, false); 92 93 // Scroll. 94 window.addEventListener("click", checkScroll, false); 95 scrollPage(50, 50); 96 sendClick(); 97 scrollPage(0, 0); 98 window.removeEventListener("click", checkScroll, false); 99 100 // Zoom. 101 window.addEventListener("click", checkZoom, false); 102 zoomPageIn(); zoomPageIn(); zoomPageIn(); 103 sendClick(); 104 zoomPageOut(); zoomPageOut(); zoomPageOut(); 105 window.removeEventListener("click", checkZoom, false); 106 107 // Scroll and Zoom. 108 window.addEventListener("click", checkZoomScroll, false); 109 zoomPageIn(); zoomPageIn(); zoomPageIn(); 110 scrollPage(50, 50); 111 sendClick(); 112 zoomPageOut(); zoomPageOut(); zoomPageOut(); 113 scrollPage(0, 0); 114 window.removeEventListener("click", checkZoomScroll, false); 115 } 116 </SCRIPT> 117 </HEAD> 118 <BODY style="width: 100px; height: 100px" > 119 <P id="first">This is to test document.caretRangeFromPoint() in a zoom and scrolled page. The point calculation in caretRangeFromPoint() is wrong in a zoom and scrolled page. <span id="same">Same applies to elementFromPoint(). 120 </P> 121 <P id="second">In a window large enough to hold the page without any scroll, click mouse after "S" in "Same" at the above sentence, observe the printed offset. 122 </P> 123 <P id="third">Now, please resize the window to make the page scroll. Then, scroll the page. Click the mouse after "S" in "Same", observe the printed offset. 124 </P> 125 <BR id="fourth"><BR>Result: <SPAN ID="mySpan" STYLE="font-weight:bold"></SPAN>". 126 <ul id="console"></ul> 127 </BODY> 128 </HTML> 112 </script> -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r80491 r80492 1625 1625 // Incorrect baseline removed. 1626 1626 BUGCR25433 WIN LINUX : css2.1/t040103-ident-03-c.html = IMAGE 1627 1628 // WebKit roll 49961:499921629 // Added in http://trac.webkit.org/changeset/499901630 BUGCR25884 WIN LINUX : fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html = FAIL1631 1627 1632 1628 // This only crashes on the old buildbot slave. It fails image, like the other slaves, on the new one. -
trunk/LayoutTests/platform/gtk/Skipped
r80460 r80492 625 625 fast/xsl/sort-locale.xml 626 626 627 # https://bugs.webkit.org/show_bug.cgi?id=30816628 fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html629 630 627 # https://bugs.webkit.org/show_bug.cgi?id=30818 631 628 fast/css/opacity-float.html -
trunk/LayoutTests/platform/mac-wk2/Skipped
r80404 r80492 244 244 fast/css/universal-hover-quirk.html 245 245 fast/css/user-drag-none.html 246 fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html247 246 fast/dom/horizontal-scrollbar-in-rtl.html 248 247 fast/dom/HTMLSelectElement/click-size-zero-no-crash.html -
trunk/LayoutTests/platform/qt-wk2/Skipped
r80193 r80492 251 251 fast/css/universal-hover-quirk.html 252 252 fast/css/user-drag-none.html 253 fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html254 253 fast/dom/HTMLTableColElement/resize-table-using-col-width.html 255 254 fast/dom/HTMLSelectElement/click-size-zero-no-crash.html -
trunk/LayoutTests/platform/qt/Skipped
r80464 r80492 1490 1490 fast/history/window-open.html 1491 1491 fast/dom/HTMLDocument/hasFocus.html 1492 fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html1493 1492 fast/dom/Range/range-expand.html 1494 1493 fast/encoding/char-decoding.html
Note: See TracChangeset
for help on using the changeset viewer.