Changeset 66828 in webkit


Ignore:
Timestamp:
Sep 6, 2010 7:42:38 AM (14 years ago)
Author:
Martin Robinson
Message:

2010-09-06 Martin Robinson <mrobinson@igalia.com>

Reviewed by Antonio Gomes.

Convert editing/selection/shift-click.html to use setEditingBehavior
https://bugs.webkit.org/show_bug.cgi?id=45233

  • editing/selection/script-tests/shift-click.js: (shiftClick): Take only one expected string. (assertSelectionString): Take only one expected string. (runShiftClickTest): Added. Runs the test with a particular editing behavior.
  • editing/selection/shift-click-expected.txt: Updated to reflect new results.
  • platform/win/editing/selection/shift-click-expected.txt: Removed.
Location:
trunk/LayoutTests
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r66827 r66828  
     12010-09-06  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Antonio Gomes.
     4
     5        Convert editing/selection/shift-click.html to use setEditingBehavior
     6        https://bugs.webkit.org/show_bug.cgi?id=45233
     7
     8        * editing/selection/script-tests/shift-click.js:
     9        (shiftClick): Take only one expected string.
     10        (assertSelectionString): Take only one expected string.
     11        (runShiftClickTest): Added. Runs the test with a particular editing behavior.
     12        * editing/selection/shift-click-expected.txt: Updated to reflect new results.
     13        * platform/win/editing/selection/shift-click-expected.txt: Removed.
     14
    1152010-09-06  Xan Lopez  <xlopez@igalia.com>
    216
  • trunk/LayoutTests/editing/selection/script-tests/shift-click.js

    r58892 r66828  
    1212var end = document.getElementById('end');
    1313
    14 function shiftClick(x, y, macExpected, otherExpected)
     14function shiftClick(x, y, expected)
    1515{
    1616    eventSender.mouseMoveTo(x, y);
    1717    eventSender.mouseDown(0, ['shiftKey']);
    1818    eventSender.mouseUp(0, ['shiftKey']);
    19     assertSelectionString(macExpected, otherExpected);
     19    assertSelectionString(expected);
    2020}
    2121
    22 var onMac = navigator.userAgent.search(/\bMac OS X\b/) != -1;
    23 
    24 function assertSelectionString(macExpected, otherExpected)
     22function assertSelectionString(expected)
    2523{
    26     var expected = onMac ? macExpected : otherExpected;
    2724    if (window.getSelection().toString() == expected)
    2825        testPassed('window.getSelection().toString() is correct');
     
    4643}
    4744
    48 // Double-click select to get around eventSender bug where it won't select
    49 // text just using single-click.
    50 if (window.eventSender) {
     45function runShiftClickTest(editingBehavior)
     46{
     47    layoutTestController.setEditingBehavior(editingBehavior);
     48
     49    // Double-click select to get around eventSender bug where it won't select
     50    // text just using single-click.
    5151    eventSender.mouseMoveTo(start.offsetLeft, start.offsetTop);
    5252    eventSender.mouseDown();
     
    5757    eventSender.mouseUp();
    5858
    59     assertSelectionString('two three\nfour five', 'two three\nfour five')
     59    assertSelectionString('two three\nfour five');
    6060    assertSelectionOrder('forward');
    6161
    62     shiftClick(second.offsetLeft + second.offsetWidth, second.offsetTop, 'two three\nfour five six', 'two three\nfour five six');
     62    shiftClick(second.offsetLeft + second.offsetWidth, second.offsetTop, 'two three\nfour five six');
    6363    assertSelectionOrder('forward');
    64        
    65     shiftClick(end.offsetLeft, end.offsetTop, 'two three\nfour five', 'two three\nfour five');
     64
     65    shiftClick(end.offsetLeft, end.offsetTop, 'two three\nfour five');
    6666    assertSelectionOrder('forward');
    6767
     
    6969    // In the first shiftClick call, the space after five is selected and shouldn't be.
    7070    // In the second shiftClick call, "six" is selected and shouldn't be.
    71     shiftClick(first.offsetLeft, first.offsetTop, 'one two three\nfour five', 'one two');
     71    if (editingBehavior == "mac")
     72        shiftClick(first.offsetLeft, first.offsetTop, 'one two three\nfour five');
     73    else
     74        shiftClick(first.offsetLeft, first.offsetTop, 'one two');
    7275    assertSelectionOrder('backward');
    7376
    74     shiftClick(start.offsetLeft, start.offsetTop, 'two three\nfour five', 'two');
     77    if (editingBehavior == "mac")
     78        shiftClick(start.offsetLeft, start.offsetTop, 'two three\nfour five');
     79    else
     80        shiftClick(start.offsetLeft, start.offsetTop, 'two');
     81
    7582    // FIXME: The selection direction is incorrect on Win/Linux here. It should be backward.
    7683    assertSelectionOrder('backward');
    7784}
    7885
     86if (window.eventSender) {
     87    runShiftClickTest("mac");
     88    runShiftClickTest("win");
     89}
     90
    7991var successfullyParsed = true;
  • trunk/LayoutTests/editing/selection/shift-click-expected.txt

    r58892 r66828  
    1818four five"
    1919PASS Selection direction is correct.
     20PASS window.getSelection().toString() is correct
     21PASS Selection direction is correct.
     22PASS window.getSelection().toString() is correct
     23PASS Selection direction is correct.
     24PASS window.getSelection().toString() is correct
     25PASS Selection direction is correct.
     26PASS window.getSelection().toString() is correct
     27PASS Selection direction is correct.
     28PASS window.getSelection().toString() is correct
     29FAIL Selection direction is not correct. Expected a backward selection.[anchorNode: [object Text](two three) anchorOffset: 0 focusNode: [object Text](two three) focusOffset: 3 isCollapsed: false]
    2030PASS successfullyParsed is true
    2131
Note: See TracChangeset for help on using the changeset viewer.