Title: [139617] trunk/LayoutTests
- Revision
- 139617
- Author
- commit-qu...@webkit.org
- Date
- 2013-01-14 09:25:04 -0800 (Mon, 14 Jan 2013)
Log Message
Web Inspector: add text editor formatter test
https://bugs.webkit.org/show_bug.cgi?id=106705
Patch by Andrey Lushnikov <lushni...@chromium.org> on 2013-01-14
Reviewed by Pavel Feldman.
Adds a test checking text editor formatting.
The test creates a new text editor and fills it in with some
code by the means of simulated key and textInput events.
* inspector/editor/text-editor-formatter-expected.txt: Added.
* inspector/editor/text-editor-formatter.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (139616 => 139617)
--- trunk/LayoutTests/ChangeLog 2013-01-14 16:46:58 UTC (rev 139616)
+++ trunk/LayoutTests/ChangeLog 2013-01-14 17:25:04 UTC (rev 139617)
@@ -1,3 +1,17 @@
+2013-01-14 Andrey Lushnikov <lushni...@chromium.org>
+
+ Web Inspector: add text editor formatter test
+ https://bugs.webkit.org/show_bug.cgi?id=106705
+
+ Reviewed by Pavel Feldman.
+
+ Adds a test checking text editor formatting.
+ The test creates a new text editor and fills it in with some
+ code by the means of simulated key and textInput events.
+
+ * inspector/editor/text-editor-formatter-expected.txt: Added.
+ * inspector/editor/text-editor-formatter.html: Added.
+
2013-01-14 Vsevolod Vlasov <vse...@chromium.org>
Web Inspector: Audit Tool's False Positive on Set-Cookie header
Modified: trunk/LayoutTests/inspector/editor/editor-test.js (139616 => 139617)
--- trunk/LayoutTests/inspector/editor/editor-test.js 2013-01-14 16:46:58 UTC (rev 139616)
+++ trunk/LayoutTests/inspector/editor/editor-test.js 2013-01-14 17:25:04 UTC (rev 139617)
@@ -19,6 +19,21 @@
textModel.setText(lines.join("\n"));
}
+InspectorTest.insertTextLine = function(line)
+{
+ function enter()
+ {
+ eventSender.keyDown("\n");
+ }
+
+ function innerInsertTextLine()
+ {
+ textInputController.insertText(line);
+ }
+ setTimeout(innerInsertTextLine);
+ setTimeout(enter);
+}
+
InspectorTest.dumpEditorChunks = function(textEditor)
{
InspectorTest.addResult("Chunk model");
Added: trunk/LayoutTests/inspector/editor/text-editor-formatter-expected.txt (0 => 139617)
--- trunk/LayoutTests/inspector/editor/text-editor-formatter-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/editor/text-editor-formatter-expected.txt 2013-01-14 17:25:04 UTC (rev 139617)
@@ -0,0 +1,54 @@
+This test checks text editor _javascript_ formatting.
+
+/**
+ * Multi-line comment
+ *
+ */
+function foo(n) {
+ // one-line comment
+ function bar() {
+ return 42;
+ }
+
+ var sum = 0;
+ for(var i = 0; i < n; ++i) {
+ for(var j = 0; j < n; ++j) {
+ sum += i + j;
+ }
+ }
+
+
+ if (sum > 1000) {
+ while (sum > 0) {
+ --sum;
+ }
+ }
+}
+============ editor contents start ============
+/**
+*.Multi-line.comment
+*
+*/
+function.foo(n).{
+....//.one-line.comment
+....function.bar().{
+........return.42;
+....}
+....
+....var.sum.=.0;
+....for(var.i.=.0;.i.<.n;.++i).{
+........for(var.j.=.0;.j.<.n;.++j).{
+............sum.+=.i.+.j;
+........}
+....}
+....
+....
+....if.(sum.>.1000).{
+........while.(sum.>.0).{
+............--sum;
+........}
+....}
+}
+
+============ editor contents end ============
+
Added: trunk/LayoutTests/inspector/editor/text-editor-formatter.html (0 => 139617)
--- trunk/LayoutTests/inspector/editor/text-editor-formatter.html (rev 0)
+++ trunk/LayoutTests/inspector/editor/text-editor-formatter.html 2013-01-14 17:25:04 UTC (rev 139617)
@@ -0,0 +1,73 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function codeSnippet() {
+ return document.getElementById("codeSnippet").textContent;
+}
+
+function test()
+{
+ var textEditor = InspectorTest.createTestEditor();
+ textEditor.overrideViewportForTest(0, undefined, 3);
+ textEditor.mimeType = "text/_javascript_";
+ textEditor.setReadOnly(false);
+ textEditor.element.focus();
+
+ function step2(result)
+ {
+ var codeLines = result.value.split("\n");
+ for(var i = 0; i < codeLines.length; ++i)
+ InspectorTest.insertTextLine(codeLines[i].trim());
+
+ setTimeout(step3);
+ }
+
+ function step3()
+ {
+ InspectorTest.addResult("============ editor contents start ============");
+ InspectorTest.addResult(textEditor.text().replace(/ /g, "."));
+ InspectorTest.addResult("============ editor contents end ============");
+ InspectorTest.completeTest();
+ }
+
+ InspectorTest.evaluateInPage("codeSnippet();", step2);
+}
+
+</script>
+</head>
+
+<body _onload_="runTest();">
+<p>
+This test checks text editor _javascript_ formatting.
+</p>
+
+<pre id="codeSnippet">
+/**
+ * Multi-line comment
+ *
+ */
+function foo(n) {
+ // one-line comment
+ function bar() {
+ return 42;
+ }
+
+ var sum = 0;
+ for(var i = 0; i < n; ++i) {
+ for(var j = 0; j < n; ++j) {
+ sum += i + j;
+ }
+ }
+
+
+ if (sum > 1000) {
+ while (sum > 0) {
+ --sum;
+ }
+ }
+}</pre>
+
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac/TestExpectations (139616 => 139617)
--- trunk/LayoutTests/platform/mac/TestExpectations 2013-01-14 16:46:58 UTC (rev 139616)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2013-01-14 17:25:04 UTC (rev 139617)
@@ -233,6 +233,10 @@
# https://bugs.webkit.org/show_bug.cgi?id=42821
animations/play-state.html
+# window.eventSender doesn't exist in devtools front-end on mac.
+# https://bugs.webkit.org/show_bug.cgi?id=106793
+inspector/editor/text-editor-formatter.html [ Skip ]
+
# https://bugs.webkit.org/show_bug.cgi?id=71120
inspector/debugger/selected-call-frame-after-formatting-source.html
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes