[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 12:22:13 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 0610dcc7ee5c78f9e60594ff0bb6a9e5451cf6b5
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 20 03:37:28 2010 +0000

    2010-08-19  Kenichi Ishibashi  <bashi at google.com>
    
            Reviewed by Kent Tamura.
    
            Improve portability of fast/forms/listbox-selection.html
            https://bugs.webkit.org/show_bug.cgi?id=35786
    
            Changed to use script-tests style for improving portability.
            - For sending mouse events to the target element, calculating the
            item height at runtime instead using Mac-specific metrics.
            - Using mouseDown(), mouseUp(), and keyDown() to send events with
            modifier keys in a platform-independent way.
    
            * fast/forms/listbox-selection-expected.txt: Updated to match with new test.
            * fast/forms/listbox-selection.html: Modified to use script-tests style.
            * fast/forms/script-tests/listbox-selection.js: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65723 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7c38659..1ea39da 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-19  Kenichi Ishibashi  <bashi at google.com>
+
+        Reviewed by Kent Tamura.
+
+        Improve portability of fast/forms/listbox-selection.html
+        https://bugs.webkit.org/show_bug.cgi?id=35786
+
+        Changed to use script-tests style for improving portability.
+        - For sending mouse events to the target element, calculating the
+        item height at runtime instead using Mac-specific metrics.
+        - Using mouseDown(), mouseUp(), and keyDown() to send events with
+        modifier keys in a platform-independent way.
+
+        * fast/forms/listbox-selection-expected.txt: Updated to match with new test.
+        * fast/forms/listbox-selection.html: Modified to use script-tests style.
+        * fast/forms/script-tests/listbox-selection.js: Added.
+
 2010-08-19  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Tony Chang.
diff --git a/LayoutTests/fast/forms/listbox-selection-expected.txt b/LayoutTests/fast/forms/listbox-selection-expected.txt
index 4fa2b24..54fe9ee 100644
--- a/LayoutTests/fast/forms/listbox-selection-expected.txt
+++ b/LayoutTests/fast/forms/listbox-selection-expected.txt
@@ -1,29 +1,37 @@
- 1) Select one item with mouse (no previous selection)
- 2) Select one item with mouse (with previous selection)
- 3) Select one item with the keyboard (no previous selection)
- 4) Select one item with the keyboard (with previous selection)
- 5) Attempt to select an item cmd-clicking
- 6) Attempt to select a range shift-clicking
- 7) Attempt to select a range with the keyboard
- 8) Select one item with mouse (no previous selection)
- 9) Select one item with mouse (with previous selection)
- 10) Select one item with the keyboard (no previous selection)
- 11) Select one item with the keyboard (with previous selection)
- 12) Select an item cmd-clicking
- 13) Select a range shift-clicking
- 14) Select a range with the keyboard
-Results:
-Test 1 Passed
-Test 2 Passed
-Test 3 Passed
-Test 4 Passed
-Test 5 Passed
-Test 6 Passed
-Test 7 Passed
-Test 8 Passed
-Test 9 Passed
-Test 10 Passed
-Test 11 Passed
-Test 12 Passed
-Test 13 Passed
-Test 14 Passed
+<select> selection test for mouse events and keyevents.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+1) Select one item with mouse (no previous selection)
+PASS selectionPattern("sl1") is "10000"
+2) Select one item with mouse (with previous selection)
+PASS selectionPattern("sl2") is "10000"
+3) Select one item with the keyboard (no previous selection)
+PASS selectionPattern("sl3") is "00001"
+4) Select one item with the keyboard (with previous selection)
+PASS selectionPattern("sl4") is "00100"
+5) Attempt to select an item cmd-clicking
+PASS selectionPattern("sl5") is "01000"
+6) Attempt to select a range shift-clicking
+PASS selectionPattern("sl6") is "01000"
+7) Attempt to select a range with the keyboard
+PASS selectionPattern("sl7") is "00100"
+8) Select one item with mouse (no previous selection)
+PASS selectionPattern("sl8") is "10000"
+9) Select one item with mouse (with previous selection)
+PASS selectionPattern("sl9") is "10000"
+10) Select one item with the keyboard (no previous selection)
+PASS selectionPattern("sl10") is "00001"
+11) Select one item with the keyboard (with previous selection)
+PASS selectionPattern("sl11") is "00100"
+12) Select an item cmd-clicking
+PASS selectionPattern("sl12") is "01100"
+13) Select a range shift-clicking
+PASS selectionPattern("sl13") is "11110"
+14) Select a range with the keyboard
+PASS selectionPattern("sl14") is "01100"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/listbox-selection.html b/LayoutTests/fast/forms/listbox-selection.html
index 4037707..7ea3d10 100644
--- a/LayoutTests/fast/forms/listbox-selection.html
+++ b/LayoutTests/fast/forms/listbox-selection.html
@@ -1,201 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
-    <head>
-        <script>
-            function setup()
-            {
-                createSelect("sl1", 5, false, -1, " 1) Select one item with mouse (no previous selection)");
-                createSelect("sl2", 5, false, 1, " 2) Select one item with mouse (with previous selection)");
-                createSelect("sl3", 5, false, -1, " 3) Select one item with the keyboard (no previous selection)");
-                createSelect("sl4", 5, false, 1, " 4) Select one item with the keyboard (with previous selection)");
-                createSelect("sl5", 5, false, 2, " 5) Attempt to select an item cmd-clicking");
-                createSelect("sl6", 5, false, 3, " 6) Attempt to select a range shift-clicking");
-                createSelect("sl7", 5, false, 1, " 7) Attempt to select a range with the keyboard");
-
-                createSelect("sl8", 5, true, -1, " 8) Select one item with mouse (no previous selection)");
-                createSelect("sl9", 5, true, 1, " 9) Select one item with mouse (with previous selection)");
-                createSelect("sl10", 5, true, -1, " 10) Select one item with the keyboard (no previous selection)");
-                createSelect("sl11", 5, true, 1, " 11) Select one item with the keyboard (with previous selection)");
-                createSelect("sl12", 5, true, 2, " 12) Select an item cmd-clicking");
-                createSelect("sl13", 5, true, 0, " 13) Select a range shift-clicking");
-                createSelect("sl14", 5, true, 1, " 14) Select a range with the keyboard");
-                
-                var results = document.createElement('div');
-                results.id = "res";
-                results.appendChild(document.createTextNode("Results:"));
-                document.body.appendChild(results);
-            }
-            function test()
-            {
-                setup();
-                
-                if (window.layoutTestController) {
-                    layoutTestController.dumpAsText();
-                    layoutTestController.waitUntilDone();
-                }
-                
-                // 1) Select one item with mouse (no previous selection)
-                mouseDownOnSelect("sl1", 0, false, false);                
-                var expectedSelectionResults = new Array(true, false, false, false, false);
-                testResults(expectedSelectionResults, 1);
-
-                // 2) Select one item with mouse (with previous selection)
-                mouseDownOnSelect("sl2", 0, false, false);                
-                expectedSelectionResults = new Array(true, false, false, false, false);
-                testResults(expectedSelectionResults, 2);
-                                
-                // 3) Select one item with the keyboard (no previous selection)
-                keyDownOnSelect("sl3", "upArrow", false, false);               
-                expectedSelectionResults = new Array(false, false, false, false, true);
-                testResults(expectedSelectionResults, 3);
-
-                // 4) Select one item with the keyboard (with previous selection)
-                keyDownOnSelect("sl4", "downArrow", false, false);
-                expectedSelectionResults = new Array(false, false, true, false, false);
-                testResults(expectedSelectionResults, 4);
-
-                //  5) Attempt to select an item cmd-clicking
-                mouseDownOnSelect("sl5", 1, false, true);                    
-                expectedSelectionResults = new Array(false, true, false, false, false);
-                testResults(expectedSelectionResults, 5);
-                
-                // 6) Attempt to select a range shift-clicking
-                mouseDownOnSelect("sl6", 1, true, false);                    
-                expectedSelectionResults = new Array(false, true, false, false, false);
-                testResults(expectedSelectionResults, 6);
-                
-                // 7) Attempt to select a range with the keyboard
-                keyDownOnSelect("sl7", "downArrow", true, false);
-                expectedSelectionResults = new Array(false, false, true, false, false);
-                testResults(expectedSelectionResults, 7);
-                
-                // Multiple selection tests
-                
-                // 8) Select one item with mouse (no previous selection)
-                mouseDownOnSelect("sl8", 0, false, false);                    
-                expectedSelectionResults = new Array(true, false, false, false, false);
-                testResults(expectedSelectionResults, 8);
-                
-                // 9) Select one item with mouse (with previous selection)
-                var sl0 = document.getElementById('sl9');
-                mouseDownOnSelect("sl9", 0, false, false);                    
-                expectedSelectionResults = new Array(true, false, false, false, false);
-                testResults(expectedSelectionResults, 9);
-                
-                // 10) Select one item with the keyboard (no previous selection)
-                keyDownOnSelect("sl10", "upArrow", false, false);
-                expectedSelectionResults = new Array(false, false, false, false, true);
-                testResults(expectedSelectionResults, 10);
-                                
-                // 11) Select one item with the keyboard (with previous selection)
-                keyDownOnSelect("sl11", "downArrow", false, false);
-                expectedSelectionResults = new Array(false, false, true, false, false);
-                testResults(expectedSelectionResults, 11);
-                
-                // 12) Select an item cmd-clicking
-                mouseDownOnSelect("sl12", 1, false, true);                    
-                expectedSelectionResults = new Array(false, true, true, false, false);
-                testResults(expectedSelectionResults, 12);
-                                
-                // 13) Select a range shift-clicking
-                mouseDownOnSelect("sl13", 3, true, false);
-                expectedSelectionResults = new Array(true, true, true, true, false);
-                testResults(expectedSelectionResults, 13);
-                                
-                // 14) Select a range with the keyboard
-                keyDownOnSelect("sl14", "downArrow", true, false);
-                expectedSelectionResults = new Array(false, true, true, false, false);
-                testResults(expectedSelectionResults, 14);
-                
-                if (window.layoutTestController)
-                    layoutTestController.notifyDone();
-                
-            }
-            
-            function mouseDownOnSelect(selId, index, shift, metaOrCtrl)
-            {
-                var meta = false;
-                var ctrl = false;
-                if (metaOrCtrl) {
-                    if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
-                        meta = true;
-                    else
-                        ctrl = true;
-                }
-                var sl = document.getElementById(selId);
-                var itemHeight = 14;
-                var border = 1;
-                var y = border + index * itemHeight - window.pageYOffset;
-                var event = document.createEvent("MouseEvent");
-                event.initMouseEvent("mousedown", true, true, document.defaultView, 1, sl.offsetLeft + border, sl.offsetTop + y, sl.offsetLeft + border, sl.offsetTop + y, ctrl, false, shift, meta, 0, document);
-                sl.dispatchEvent(event);
-            }
-            
-            function keyDownOnSelect(selId, identifier, shift, metaOrCtrl)
-            {
-                modifiers = [];
-                if (shift)
-                    modifiers[0] = "shiftKey";
-                if (metaOrCtrl) {
-                    if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
-                        modifiers[modifiers.length] = "metaKey";
-                    else
-                        modifiers[modifiers.length] = "controlKey";
-                }
-
-                document.getElementById(selId).focus();
-                eventSender.keyDown(identifier, modifiers);
-            }
-            
-            function createSelect(idName, sz, mlt, selIndex, testMsg)
-            {
-                var sl = document.createElement("select");
-                var i = 0;
-                sl.size = sz;
-                while (i < sz) {
-                    var opt = document.createElement("option");
-                    if (i == selIndex)
-                        opt.selected = true;
-                    opt.textContent = "item " + i;
-                    sl.appendChild(opt);
-                    i++;
-                }
-                sl.multiple = mlt;
-                sl.id = idName;
-                document.body.appendChild(sl);
-                document.body.appendChild(document.createTextNode(testMsg));
-                document.body.appendChild(document.createElement("br"));
-            }
-            
-            function testResults(expectedArr, testNum)
-            {
-                var sl = document.getElementById("sl" + testNum);
-                var res = document.getElementById('res');
-                var resultsArr = new Array(sl.options.length);
-                
-                var i;
-                for (i=0; i < sl.options.length; i++) {
-                    resultsArr[i] = sl.options[i].selected;
-                }
-                var successString = "Failed";
-                var success = false;
-                if (expectedArr.join() == resultsArr.join()) {
-                    success = true;
-                    successString = "Passed";
-                }
-                
-               log("Test " + testNum + " " + successString);
-                if (!success) {
-                    log("<pre>     Expected: " + expectedArr.join() + "<br>" + "     Actual: " + resultsArr.join() + "</pre>");
-                }
-            }
-            
-            function log(msg)
-            {
-                var r = document.getElementById('res');
-                r.innerHTML = r.innerHTML + "<br>" + msg;
-            }
-        </script>
-    </head>
-    <body onload="test()">
-    </body>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/listbox-selection.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
 </html>
diff --git a/LayoutTests/fast/forms/script-tests/listbox-selection.js b/LayoutTests/fast/forms/script-tests/listbox-selection.js
new file mode 100644
index 0000000..74d7dc9
--- /dev/null
+++ b/LayoutTests/fast/forms/script-tests/listbox-selection.js
@@ -0,0 +1,127 @@
+description('&lt;select&gt; selection test for mouse events and keyevents.');
+
+function mouseDownOnSelect(selId, index, modifier) {
+    var sl = document.getElementById(selId);
+    var itemHeight = Math.floor(sl.offsetHeight / sl.size);
+    var border = 1;
+    var y = border + index * itemHeight - window.pageYOffset;
+
+    sl.focus();
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(sl.offsetLeft + border, sl.offsetTop + y);
+        eventSender.mouseDown(0, [modifier]);
+        eventSender.mouseUp(0, [modifier]);
+    }
+}
+
+function keyDownOnSelect(selId, identifier, modifier) {
+    document.getElementById(selId).focus();
+    if (window.eventSender)
+        eventSender.keyDown(identifier, [modifier]);
+}
+
+function createSelect(idName, sz, mlt, selIndex) {
+    var sl = document.createElement("select");
+    var i = 0;
+    sl.size = sz;
+    while (i < sz) {
+        var opt = document.createElement("option");
+        if (i == selIndex)
+            opt.selected = true;
+        opt.textContent = "item " + i;
+        sl.appendChild(opt);
+        i++;
+    }
+    sl.multiple = mlt;
+    sl.id = idName;
+    var parent = document.getElementById("parent");
+    parent.appendChild(sl);
+}
+
+function selectionPattern(selId) {
+    var sl = document.getElementById(selId);
+    var result = '';
+    for (var i = 0; i < sl.options.length; i++)
+        result += sl.options[i].selected ? '1' : '0';
+    return result;
+}
+
+var parent = document.createElement('div');
+parent.id = "parent";
+document.body.appendChild(parent);
+
+createSelect("sl1", 5, false, -1);
+createSelect("sl2", 5, false, 1);
+createSelect("sl3", 5, false, -1);
+createSelect("sl4", 5, false, 1);
+createSelect("sl5", 5, false, 2);
+createSelect("sl6", 5, false, 3);
+createSelect("sl7", 5, false, 1);
+
+createSelect("sl8", 5, true, -1);
+createSelect("sl9", 5, true, 1);
+createSelect("sl10", 5, true, -1);
+createSelect("sl11", 5, true, 1);
+createSelect("sl12", 5, true, 2);
+createSelect("sl13", 5, true, 0);
+createSelect("sl14", 5, true, 1);
+
+debug("1) Select one item with mouse (no previous selection)");
+mouseDownOnSelect("sl1", 0);
+shouldBe('selectionPattern("sl1")', '"10000"');
+
+debug("2) Select one item with mouse (with previous selection)");
+mouseDownOnSelect("sl2", 0);
+shouldBe('selectionPattern("sl2")', '"10000"');
+
+debug("3) Select one item with the keyboard (no previous selection)");
+keyDownOnSelect("sl3", "upArrow");
+shouldBe('selectionPattern("sl3")', '"00001"');
+
+debug("4) Select one item with the keyboard (with previous selection)");
+keyDownOnSelect("sl4", "downArrow");
+shouldBe('selectionPattern("sl4")', '"00100"');
+
+debug("5) Attempt to select an item cmd-clicking");
+mouseDownOnSelect("sl5", 1, "addSelectionKey");
+shouldBe('selectionPattern("sl5")', '"01000"');
+
+debug("6) Attempt to select a range shift-clicking");
+mouseDownOnSelect("sl6", 1, "rangeSelectionKey");
+shouldBe('selectionPattern("sl6")', '"01000"');
+
+debug("7) Attempt to select a range with the keyboard");
+keyDownOnSelect("sl7", "downArrow", "rangeSelectionKey");
+shouldBe('selectionPattern("sl7")', '"00100"');
+
+// Multiple selection tests
+
+debug("8) Select one item with mouse (no previous selection)");
+mouseDownOnSelect("sl8", 0);
+shouldBe('selectionPattern("sl8")', '"10000"');
+
+debug("9) Select one item with mouse (with previous selection)");
+mouseDownOnSelect("sl9", 0);
+shouldBe('selectionPattern("sl9")', '"10000"');
+
+debug("10) Select one item with the keyboard (no previous selection)");
+keyDownOnSelect("sl10", "upArrow");
+shouldBe('selectionPattern("sl10")', '"00001"');
+
+debug("11) Select one item with the keyboard (with previous selection)");
+keyDownOnSelect("sl11", "downArrow");
+shouldBe('selectionPattern("sl11")', '"00100"');
+
+debug("12) Select an item cmd-clicking");
+mouseDownOnSelect("sl12", 1, "addSelectionKey");
+shouldBe('selectionPattern("sl12")', '"01100"');
+
+debug("13) Select a range shift-clicking");
+mouseDownOnSelect("sl13", 3, "rangeSelectionKey");
+shouldBe('selectionPattern("sl13")', '"11110"');
+
+debug("14) Select a range with the keyboard");
+keyDownOnSelect("sl14", "downArrow", "rangeSelectionKey");
+shouldBe('selectionPattern("sl14")', '"01100"');
+
+var successfullyParsed = true;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list