1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/base/tests/test_bug332655-2.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,78 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=332655 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 332655</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script> 1.13 + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.14 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.15 +</head> 1.16 +<body onload="test()"> 1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332655">Mozilla Bug 332655</a> 1.18 +<p id="display"></p> 1.19 +<div id="content"> 1.20 +<input type="text" id="testInput"> 1.21 +</div> 1.22 +<pre id="test"> 1.23 +<script class="testbody" type="text/javascript"> 1.24 + 1.25 +/** Test for Bug 332655 **/ 1.26 + 1.27 +SimpleTest.waitForExplicitFinish(); 1.28 + 1.29 +function repeatKey(key, repetitions) { 1.30 + for (var i = 0; i < 4; ++i) { 1.31 + synthesizeKey(key, {}); 1.32 + } 1.33 +} 1.34 + 1.35 +function test() { 1.36 + var textInput = $("testInput"); 1.37 + var s1, s2, s3, equal, str1, str2; 1.38 + 1.39 + textInput.focus(); 1.40 + synthesizeKey("\u05d0", { }); 1.41 + synthesizeKey("a", { }); 1.42 + synthesizeKey("b", { }); 1.43 + synthesizeKey(" ", { }); 1.44 + synthesizeKey("\u05d1", { }); 1.45 + synthesizeKey("\u05d2", { }); 1.46 + s1 = snapshotWindow(window); 1.47 + 1.48 + // 4 LEFT to get to the beginning of the line: HOME doesn't work on OS X 1.49 + repeatKey("VK_LEFT", 4); 1.50 + synthesizeKey("VK_BACK_SPACE", { }); 1.51 + synthesizeKey("\u05d0", { }); 1.52 + s2 = snapshotWindow(window); 1.53 + 1.54 + [equal, str1, str2] = compareSnapshots(s1, s2, true); 1.55 + ok(equal, "deleting and inserting RTL char at beginning of line shouldn't change: expected " + 1.56 + str1 + " but got " + str2); 1.57 + 1.58 + textInput.select(); 1.59 + synthesizeKey("a", { }); 1.60 + synthesizeKey("b", { }); 1.61 + synthesizeKey(" ", { }); 1.62 + synthesizeKey("\u05d1", { }); 1.63 + synthesizeKey("\u05d2", { }); 1.64 + // 4 LEFT to get to the beginning of the line: HOME doesn't work on OS X 1.65 + repeatKey("VK_LEFT", 4); 1.66 + synthesizeKey("\u05d0", { }); 1.67 + 1.68 + s3 = snapshotWindow(window); 1.69 + 1.70 + [equal, str1, str2] = compareSnapshots(s1, s3, true); 1.71 + ok(equal, "the order entering Bidi text shouldn't change rendering: expected " + 1.72 + str1 + " but got " + str2); 1.73 + 1.74 + SimpleTest.finish(); 1.75 +} 1.76 + 1.77 +</script> 1.78 +</pre> 1.79 +</body> 1.80 +</html> 1.81 +