Changeset 74279 in webkit


Ignore:
Timestamp:
Dec 17, 2010 10:58:23 AM (13 years ago)
Author:
rniwa@webkit.org
Message:

2010-12-17 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Antonio Gomes.

editing/execCommand/toggle-compound-styles-expected should use LayoutTestController::setEditingBehavior
https://bugs.webkit.org/show_bug.cgi?id=51261

Modified the test to run each test case using each editing behavior, eliminating the need for
platform-specific expected results.

  • editing/execCommand/script-tests/toggle-compound-styles.js: (testSingleToggle):
  • platform/gtk/editing/execCommand/toggle-compound-styles-expected.txt: Removed.
  • platform/mac/editing/execCommand/toggle-compound-styles-expected.txt: Removed.
  • platform/qt/editing/execCommand/toggle-compound-styles-expected.txt: Removed.
  • platform/win/editing/execCommand/toggle-compound-styles-expected.txt: Removed.
Location:
trunk/LayoutTests
Files:
1 added
4 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r74273 r74279  
     12010-12-17  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Antonio Gomes.
     4
     5        editing/execCommand/toggle-compound-styles-expected should use LayoutTestController::setEditingBehavior
     6        https://bugs.webkit.org/show_bug.cgi?id=51261
     7
     8        Modified the test to run each test case using each editing behavior, eliminating the need for
     9        platform-specific expected results.
     10
     11        * editing/execCommand/script-tests/toggle-compound-styles.js:
     12        (testSingleToggle):
     13        * platform/gtk/editing/execCommand/toggle-compound-styles-expected.txt: Removed.
     14        * platform/mac/editing/execCommand/toggle-compound-styles-expected.txt: Removed.
     15        * platform/qt/editing/execCommand/toggle-compound-styles-expected.txt: Removed.
     16        * platform/win/editing/execCommand/toggle-compound-styles-expected.txt: Removed.
     17
    1182010-12-17  Antonio Gomes  <agomes@rim.com>
    219
  • trunk/LayoutTests/editing/execCommand/script-tests/toggle-compound-styles.js

    r51965 r74279  
    55document.body.appendChild(testContainer);
    66
    7 function testSingleToggle(toggleCommand, initialContents, expectedContents, dependsOnPlatform)
     7function testSingleToggle(toggleCommand, initialContents, expectedContents)
    88{
    99    testContainer.innerHTML = initialContents;
    1010    window.getSelection().selectAllChildren(testContainer);
    1111    document.execCommand(toggleCommand, false, null);
    12     if (!expectedContents)
    13         debug('<span>' + escapeHTML("one " + toggleCommand + " command converted " + initialContents + " to " + testContainer.innerHTML) + '</span>');
    14     else if (testContainer.innerHTML === expectedContents)
    15         testPassed("one " + toggleCommand + " command converted " + initialContents + " to " + expectedContents);
     12    var action = 'one ' + toggleCommand + ' command converted "' + initialContents + '" to "' + expectedContents;
     13    if (testContainer.innerHTML === expectedContents)
     14        testPassed(action);
    1615    else
    17         testFailed("one " + toggleCommand + " command converted " + initialContents + " to " + testContainer.innerHTML + ", expected " + expectedContents);
     16        testFailed(action + '", expected "' + expectedContents + '"');
    1817}
    1918
    20 debug('PLATFORM-DEPENDENT TESTS');
    21 testSingleToggle("bold", "<u><b>hello</b> world</u>");
    22 testSingleToggle("bold", "<b>hello </b>world");
    23 testSingleToggle("bold", "<u><b>hello </b></u>world");
    24 testSingleToggle("italic", "<i>hello</i> <img>");
    25 testSingleToggle("italic", "<s><b>hello<i> world</i></b></s>");
    26 debug('PLATFORM-INDEPENDENT TESTS');
    27 testSingleToggle("bold", "<u><span id='test'><b>hello</b></span><b>world</b></u>", '<u><span id="test">hello</span>world</u>');
    28 testSingleToggle("bold", "<span id='test' style='font-weight:normal;'><b>hello</b></span>", '<span id="test">hello</span>');
    29 testSingleToggle("bold", "<div><b>hello</b><br><br><b>world</b></div>", "<div>hello<br><br>world</div>");
    30 testSingleToggle("italic", "<i>hello </i><img>", "hello <img>");
    31 testSingleToggle("italic", "<i><b>hello</b>world</i>", "<b>hello</b>world");
    32 testSingleToggle("italic", "<span style='font-style: normal;'> <i> hello </i> </span>", "  hello  ");
    33 testSingleToggle("italic", "<p><i>hello</i><span style='font-style:italic;'>world</span></p>", "<p>helloworld</p>");
     19platforms = ['mac', 'win', 'unix'];
     20
     21for (var i = 0; i < platforms.length; i++) {
     22    platform = platforms[i];
     23    debug('Platform: ' + platform);
     24
     25    if (window.layoutTestController)
     26        layoutTestController.setEditingBehavior(platform);
     27
     28    if (platform == 'win' || platform == 'unix')
     29        platform = 'nonmac';
     30
     31    testSingleToggle("bold", "<u><b>hello</b> world</u>", {mac: '<u>hello world</u>', nonmac: '<u><b>hello world</b></u>'}[platform]);
     32    testSingleToggle("bold", "<b>hello </b>world", {mac: 'hello world', nonmac: '<b>hello world</b>'}[platform]);
     33    testSingleToggle("bold", "<u><b>hello </b></u>world", {mac: '<u>hello </u>world', nonmac: '<b><u>hello </u>world</b>'}[platform]);
     34    testSingleToggle("italic", "<i>hello</i> <img>", {mac: 'hello <img>', nonmac: '<i>hello <img></i>'}[platform]);
     35
     36    // Following tests are cross-platform
     37    testSingleToggle("bold", "<u><span id='test'><b>hello</b></span><b>world</b></u>", '<u><span id="test">hello</span>world</u>');
     38    testSingleToggle("bold", "<span id='test' style='font-weight:normal;'><b>hello</b></span>", '<span id="test">hello</span>');
     39    testSingleToggle("bold", "<div><b>hello</b><br><br><b>world</b></div>", "<div>hello<br><br>world</div>");
     40    testSingleToggle("italic", "<i>hello </i><img>", "hello <img>");
     41    testSingleToggle("italic", "<i><b>hello</b>world</i>", "<b>hello</b>world");
     42    testSingleToggle("italic", "<span style='font-style: normal;'> <i> hello </i> </span>", "  hello  ");
     43    testSingleToggle("italic", "<p><i>hello</i><span style='font-style:italic;'>world</span></p>", "<p>helloworld</p>");
     44    testSingleToggle("italic", "<s><b>hello<i> world</i></b></s>", "<s><b><i>hello world</i></b></s>");
     45
     46    debug('');
     47}
    3448
    3549document.body.removeChild(testContainer);
Note: See TracChangeset for help on using the changeset viewer.