Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/vertical-scrollbar-in-rtl.html

Issue 1413493005: Update layout tests to work when smooth scrolling is enabled by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: worked on nit Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html dir=rtl style="-webkit-writing-mode:vertical-lr"> 1 <html dir=rtl style="-webkit-writing-mode:vertical-lr">
2 <head> 2 <head>
3 <script src="../../resources/js-test.js"></script>
3 <script language="javascript"> 4 <script language="javascript">
5 window.jsTestIsAsync = true;
6
4 function log(str) 7 function log(str)
5 { 8 {
6 var li = document.createElement("li"); 9 var li = document.createElement("li");
7 li.appendChild(document.createTextNode(str)); 10 li.appendChild(document.createTextNode(str));
8 var console = document.getElementById("console"); 11 var console = document.getElementById("console");
9 console.appendChild(li); 12 console.appendChild(li);
10 } 13 }
11 14
12 function assertEqual(message, actual, expected) 15 function assertEqual(message, actual, expected)
13 { 16 {
14 if (actual != expected) 17 if (actual != expected)
15 log("\n" + message + ": Failure, actual: " + actual + "; exp ected: " + expected); 18 log(message + ": Failure, actual: " + actual + "; expected: " + expected);
16 else 19 else
17 log("\n" + message + ": Success"); 20 log(message + ": Success");
18 } 21 }
19 22
20 function assertClose(message, actual, expected) 23 function assertClose(message, actual, expected)
21 { 24 {
22 if ((actual >= expected && actual - expected < 5) || 25 if ((actual >= expected && actual - expected < 5) ||
23 (expected >= actual && expected - actual < 5)) 26 (expected >= actual && expected - actual < 5))
24 log("\n" + message + ": Success"); 27 log(message + ": Success");
25 else 28 else
26 log("\n" + message + ": Failure, actual: " + actual + "; exp ected: " + expected); 29 log(message + ": Failure, actual: " + actual + "; expected: " + expected);
27 } 30 }
28 31
29 var expectedScrollX = 500; 32 var expectedScrollX = 500;
30 var expectedScrollY = -1000; 33 var expectedScrollY = -1000;
31 34
32 onload = function() 35 onload = function()
33 { 36 {
34 if (window.testRunner) 37 if (window.testRunner)
35 testRunner.dumpAsText(); 38 testRunner.dumpAsText();
36 39
37 // Test vertical scrollbar presence and that it is initially at the bottom for RTL page. 40 // Test vertical scrollbar presence and that it is initially at the bottom for RTL page.
38 assertEqual("original scroll y for RTL page ", window.scrollY, 0 ); 41 assertEqual("original scroll y for RTL page ", window.scrollY, 0 );
39 42
40 // Test horizontal scroll. 43 // Test horizontal scroll.
41 window.scrollTo(expectedScrollX, expectedScrollY); 44 window.scrollTo(expectedScrollX, expectedScrollY);
42 assertEqual("vertical scroll: ", window.scrollY, expectedScrollY ); 45 assertEqual("vertical scroll: ", window.scrollY, expectedScrollY );
43 // Test calling window.scrollY continuously wont change the scro llY position. 46 // Test calling window.scrollY continuously wont change the scro llY position.
44 assertEqual("continuously call window.scrollY ", window.scrollY, expectedScrollY); 47 assertEqual("continuously call window.scrollY ", window.scrollY, expectedScrollY);
45 48
46 49
47 // Test zooming wont reset scroll position. 50 // Test zooming wont reset scroll position.
48 if (window.eventSender) { 51 if (window.eventSender) {
49 window.scrollTo(expectedScrollX, expectedScrollY); 52 window.scrollTo(expectedScrollX, expectedScrollY);
50 eventSender.zoomPageIn(); 53 eventSender.zoomPageIn();
51 eventSender.zoomPageOut(); 54 eventSender.zoomPageOut();
52 assertClose("zoom in and out preserve scroll position", wind ow.scrollY, expectedScrollY); 55 assertClose("zoom in and out preserve scroll position", wind ow.scrollY, expectedScrollY);
53 } 56 }
54 57
55 // Test resize wont reset scroll position. 58 // Test resize wont reset scroll position.
56 window.resizeTo(window.innerWidth, 1000); 59 window.resizeTo(window.innerWidth, 1000);
57 window.scrollTo(expectedScrollX, expectedScrollY); 60 window.scrollTo(expectedScrollX, expectedScrollY);
58 window.resizeTo(window.innerWidth, 2000); 61 window.resizeTo(window.innerWidth, 2000);
59 assertEqual("resize preserves scroll position", window.scrollY, expectedScrollY); 62 assertEqual("resize preserves scroll position", window.scrollY, expectedScrollY);
60 63
61 // Test HOME/END operation. 64 // Test HOME/END operation.
62 if (window.eventSender) { 65 if (window.eventSender) {
63 // Not using assert equal here since the behavior is differe nt in each port. 66 // Not using assert equal here since the behavior is differe nt in each port.
64 // For example, in Mac, HOME/END key reset both x and y scro ll position. 67 // For example, in Mac, HOME/END key reset both x and y scro ll position.
65 // In Chromium, HOME/END key only reset y scroll position, a nd x scroll position is preserved. 68 // In Chromium, HOME/END key only reset y scroll position, a nd x scroll position is preserved.
66 window.scrollTo(expectedScrollX, expectedScrollY); 69 function testEnd() {
67 eventSender.keyDown("home"); 70 window.scrollTo(expectedScrollX, expectedScrollY);
68 log("KeyDown HOME move y-scroll position to bottom for RTL p age: " + window.scrollY, 0); 71 eventSender.keyDown("end");
69 window.scrollTo(expectedScrollX, expectedScrollY); 72 shouldBecomeEqual('window.scrollY == 0', 'true', testSel ectAll);
70 eventSender.keyDown("end"); 73 }
71 log("KeyDown END move y-scroll position to bottom for RTL pa ge: " + window.scrollY, 0); 74 function testHome() {
75 window.scrollTo(expectedScrollX, expectedScrollY);
76 eventSender.keyDown("home");
77 shouldBecomeEqual('window.scrollY == -3425', 'true', tes tEnd);
78 }
79 testHome();
72 } 80 }
73
74 // Test select all selects all document content.
75 window.resizeTo(500, 500);
76 var div = document.getElementById("div");
77 div.focus();
78 document.execCommand("SelectAll");
79 var selection = window.getSelection();
80 assertEqual("selectAll selects all document", selection.toString ().substring(0, div.innerHTML.length), div.innerHTML);
81 81
82 div.style.display = "none"; 82 function testSelectAll() {
83 83 // Test select all selects all document content.
84 window.resizeTo(500, 500);
85 var div = document.getElementById("div");
86 div.focus();
87 document.execCommand("SelectAll");
88 var selection = window.getSelection();
89 assertEqual("selectAll selects all document", selection.toSt ring().substring(0, div.innerHTML.length), div.innerHTML);
90
91 div.style.display = "none";
92
93 finishJSTest();
94 }
84 } 95 }
85 </script> 96 </script>
86 </head> 97 </head>
87 <body> 98 <body>
88 <div id="div" style="whitespace:nowrap; width: 1000px; height: 4000px; b order: 1px solid red;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad m inim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea com modo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse c illum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non pro ident, sunt in culpa qui officia deserunt mollit anim id est laborum."</div> 99 <div id="div" style="whitespace:nowrap; width: 1000px; height: 4000px; b order: 1px solid red;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad m inim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea com modo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse c illum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non pro ident, sunt in culpa qui officia deserunt mollit anim id est laborum."</div>
89 <ul id="console" dir=ltr></ul> 100 <ul id="console" dir=ltr></ul>
90 </body> 101 </body>
91 </html> 102 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698