| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 | |
| 4 <head> | |
| 5 <meta charset="UTF-8"> | |
| 6 <script> | |
| 7 | |
| 8 if (window.testRunner) | |
| 9 testRunner.dumpAsText(); | |
| 10 | |
| 11 function shouldBe(actual, expected, testName) | |
| 12 { | |
| 13 var result = testName + ": "; | |
| 14 if (actual == expected) | |
| 15 result += "PASS"; | |
| 16 else | |
| 17 result += "FAIL"; | |
| 18 | |
| 19 document.getElementById("results").innerHTML += result + "<br>"; | |
| 20 } | |
| 21 | |
| 22 function test() | |
| 23 { | |
| 24 var FONT_AND_EXPECTATIONS = [ | |
| 25 [ null, false, true ], | |
| 26 [ "MS PGothic", true, false ], | |
| 27 [ "MS Gothic", true, false ], | |
| 28 [ "MS PMincho", true, false ], | |
| 29 [ "MS Mincho", true, false ], | |
| 30 [ "Meiryo", true, false ], | |
| 31 [ "MS Pゴシック", true, false ], | |
| 32 [ "MS ゴシック", true, false ], | |
| 33 [ "MS P明朝", true, false ], | |
| 34 [ "MS 明朝", true, false ], | |
| 35 [ "メイリオ", true, false ], | |
| 36 [ "Times", false, true ], | |
| 37 [ "foobar", false, true ] | |
| 38 ]; | |
| 39 | |
| 40 var sandbox = document.getElementById("sandbox"); | |
| 41 | |
| 42 for (var i = 0; FONT_AND_EXPECTATIONS[i]; i++) { | |
| 43 var fontName = FONT_AND_EXPECTATIONS[i][0]; | |
| 44 var isSearchableByYen = FONT_AND_EXPECTATIONS[i][1]; | |
| 45 var isSearchableByBackslash = FONT_AND_EXPECTATIONS[i][2]; | |
| 46 var element = document.createElement("div"); | |
| 47 if (fontName) | |
| 48 element.style.fontFamily = fontName; | |
| 49 element.innerText = "\\"; | |
| 50 | |
| 51 sandbox.appendChild(element); | |
| 52 | |
| 53 if (!fontName) | |
| 54 fontName = "No specified font"; | |
| 55 shouldBe(document.execCommand("FindString", false, "¥"), isSearchableByY
en, fontName + " + yen sign"); | |
| 56 shouldBe(document.execCommand("FindString", false, "\\"), isSearchableBy
Backslash, fontName + " + backslash"); | |
| 57 | |
| 58 sandbox.removeChild(element); | |
| 59 } | |
| 60 } | |
| 61 | |
| 62 </script> | |
| 63 </head> | |
| 64 | |
| 65 <body onload="test()"> | |
| 66 <div id="sandbox"></div> | |
| 67 <div id="results"></div> | |
| 68 </body> | |
| 69 | |
| 70 </html> | |
| OLD | NEW |