Changeset 74279 in webkit
- Timestamp:
- Dec 17, 2010 10:58:23 AM (13 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 1 added
- 4 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r74273 r74279 1 2010-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 1 18 2010-12-17 Antonio Gomes <agomes@rim.com> 2 19 -
trunk/LayoutTests/editing/execCommand/script-tests/toggle-compound-styles.js
r51965 r74279 5 5 document.body.appendChild(testContainer); 6 6 7 function testSingleToggle(toggleCommand, initialContents, expectedContents , dependsOnPlatform)7 function testSingleToggle(toggleCommand, initialContents, expectedContents) 8 8 { 9 9 testContainer.innerHTML = initialContents; 10 10 window.getSelection().selectAllChildren(testContainer); 11 11 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); 16 15 else 17 testFailed( "one " + toggleCommand + " command converted " + initialContents + " to " + testContainer.innerHTML + ", expected " + expectedContents);16 testFailed(action + '", expected "' + expectedContents + '"'); 18 17 } 19 18 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>"); 19 platforms = ['mac', 'win', 'unix']; 20 21 for (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 } 34 48 35 49 document.body.removeChild(testContainer);
Note: See TracChangeset
for help on using the changeset viewer.