haikuwebkit/LayoutTests/editing/selection/find-yensign-and-backslash-...

71 lines
1.8 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
if (window.testRunner)
testRunner.dumpAsText();
function shouldBe(actual, expected, testName)
{
var result = testName + ": ";
if (actual == expected)
result += "PASS";
else
result += "FAIL";
document.getElementById("results").innerHTML += result + "<br>";
}
function test()
{
var FONT_AND_EXPECTATIONS = [
[ null, false, true ],
[ "MS PGothic", true, false ],
[ "MS Gothic", true, false ],
[ "MS PMincho", true, false ],
[ "MS Mincho", true, false ],
[ "Meiryo", true, false ],
[ " Pゴシック", true, false ],
[ " ゴシック", true, false ],
[ " P明朝", true, false ],
[ " 明朝", true, false ],
[ "メイリオ", true, false ],
[ "Times", false, true ],
[ "foobar", false, true ]
];
var sandbox = document.getElementById("sandbox");
for (var i = 0; FONT_AND_EXPECTATIONS[i]; i++) {
var fontName = FONT_AND_EXPECTATIONS[i][0];
var isSearchableByYen = FONT_AND_EXPECTATIONS[i][1];
var isSearchableByBackslash = FONT_AND_EXPECTATIONS[i][2];
var element = document.createElement("div");
if (fontName)
element.style.fontFamily = fontName;
element.innerText = "\\";
sandbox.appendChild(element);
if (!fontName)
fontName = "No specified font";
shouldBe(document.execCommand("FindString", false, "¥"), isSearchableByYen, fontName + " + yen sign");
shouldBe(document.execCommand("FindString", false, "\\"), isSearchableByBackslash, fontName + " + backslash");
sandbox.removeChild(element);
}
}
</script>
</head>
<body onload="test()">
<div id="sandbox"></div>
<div id="results"></div>
</body>
</html>