| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../http/tests/inspector/console-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function populateConsoleWithMessages(count) | 6 function populateConsoleWithMessages(count) |
| 7 { | 7 { |
| 8 for (var i = 0; i < count; ++i) | 8 for (var i = 0; i < count; ++i) |
| 9 console.log("Message #" + i); | 9 console.log("Message #" + i); |
| 10 } | 10 } |
| 11 | 11 |
| 12 function test() | 12 function test() |
| 13 { | 13 { |
| 14 InspectorTest.fixConsoleViewportDimensions(600, 200); | 14 InspectorTest.fixConsoleViewportDimensions(600, 200); |
| 15 var consoleView = WebInspector.ConsolePanel._view(); | 15 var consoleView = WebInspector.ConsolePanel._view(); |
| 16 var viewport = consoleView._viewport; | 16 var viewport = consoleView._viewport; |
| 17 const minimumViewportMessagesCount = 10; | 17 const minimumViewportMessagesCount = 10; |
| 18 const messagesCount = 150; | 18 const messagesCount = 150; |
| 19 const middleMessage = messagesCount / 2; | 19 const middleMessage = messagesCount / 2; |
| 20 var testSuite = [ | 20 var testSuite = [ |
| 21 function verifyViewportIsTallEnough(next) | 21 function verifyViewportIsTallEnough(next) |
| 22 { | 22 { |
| 23 viewport.invalidate(); | 23 viewport.invalidate(); |
| 24 var viewportMessagesCount = viewport._lastVisibleIndex - viewport._f
irstVisibleIndex; | 24 viewport.forceScrollItemToBeFirst(0); |
| 25 var viewportMessagesCount = viewport._lastVisibleIndex - viewport._f
irstVisibleIndex + 1; |
| 25 if (viewportMessagesCount < minimumViewportMessagesCount) { | 26 if (viewportMessagesCount < minimumViewportMessagesCount) { |
| 26 InspectorTest.addResult(String.sprintf("Test cannot be run as vi
ewport is not tall enough. It is required to contain at least %d messages, but %
d only fit", minimumViewportMessagesCount, viewportMessagesCount)); | 27 InspectorTest.addResult(String.sprintf("Test cannot be run as vi
ewport is not tall enough. It is required to contain at least %d messages, but %
d only fit", minimumViewportMessagesCount, viewportMessagesCount)); |
| 27 InspectorTest.completeTest(); | 28 InspectorTest.completeTest(); |
| 28 return; | 29 return; |
| 29 } | 30 } |
| 31 InspectorTest.addResult(String.sprintf("Viewport contains %d message
s", viewportMessagesCount)); |
| 30 next(); | 32 next(); |
| 31 }, | 33 }, |
| 32 | 34 |
| 33 function testSelectionSingleLineText(next) | 35 function testSelectionSingleLineText(next) |
| 34 { | 36 { |
| 35 selectMessages(middleMessage, 2, middleMessage, 7); | 37 selectMessages(middleMessage, 2, middleMessage, 7); |
| 36 dumpSelectionText(); | 38 dumpSelectionText(); |
| 39 dumpBottom(); |
| 37 next(); | 40 next(); |
| 38 }, | 41 }, |
| 39 | 42 |
| 40 function testReversedSelectionSingleLineText(next) | 43 function testReversedSelectionSingleLineText(next) |
| 41 { | 44 { |
| 42 selectMessages(middleMessage, 7, middleMessage, 2); | 45 selectMessages(middleMessage, 7, middleMessage, 2); |
| 43 dumpSelectionText(); | 46 dumpSelectionText(); |
| 47 dumpBottom(); |
| 44 next(); | 48 next(); |
| 45 }, | 49 }, |
| 46 | 50 |
| 47 function testSelectionMultiLineText(next) | 51 function testSelectionMultiLineText(next) |
| 48 { | 52 { |
| 49 selectMessages(middleMessage - 1, 4, middleMessage + 1, 7); | 53 selectMessages(middleMessage - 1, 4, middleMessage + 1, 7); |
| 50 dumpSelectionText(); | 54 dumpSelectionText(); |
| 55 dumpBottom(); |
| 51 next(); | 56 next(); |
| 52 }, | 57 }, |
| 53 | 58 |
| 54 function testSimpleVisibleSelection(next) | 59 function testSimpleVisibleSelection(next) |
| 55 { | 60 { |
| 56 selectMessages(middleMessage - 3, 6, middleMessage + 2, 6); | 61 selectMessages(middleMessage - 3, 6, middleMessage + 2, 6); |
| 57 dumpSelectionModel(); | 62 dumpSelectionModel(); |
| 58 dumpBottom(); | 63 dumpBottom(); |
| 59 next(); | 64 next(); |
| 60 }, | 65 }, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 236 } |
| 232 } | 237 } |
| 233 </script> | 238 </script> |
| 234 </head> | 239 </head> |
| 235 <body onload="runTest()"> | 240 <body onload="runTest()"> |
| 236 <p> | 241 <p> |
| 237 Tests that console viewport handles selection properly. | 242 Tests that console viewport handles selection properly. |
| 238 </p> | 243 </p> |
| 239 </body> | 244 </body> |
| 240 </html> | 245 </html> |
| OLD | NEW |