|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=332655 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 332655</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script> |
|
10 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
12 </head> |
|
13 <body onload="test()"> |
|
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332655">Mozilla Bug 332655</a> |
|
15 <p id="display"></p> |
|
16 <div id="content"> |
|
17 <input type="text" id="testInput"> |
|
18 </div> |
|
19 <pre id="test"> |
|
20 <script class="testbody" type="text/javascript"> |
|
21 |
|
22 /** Test for Bug 332655 **/ |
|
23 |
|
24 SimpleTest.waitForExplicitFinish(); |
|
25 |
|
26 function repeatKey(key, repetitions) { |
|
27 for (var i = 0; i < 4; ++i) { |
|
28 synthesizeKey(key, {}); |
|
29 } |
|
30 } |
|
31 |
|
32 function test() { |
|
33 var textInput = $("testInput"); |
|
34 var s1, s2, s3, equal, str1, str2; |
|
35 |
|
36 textInput.focus(); |
|
37 synthesizeKey("\u05d0", { }); |
|
38 synthesizeKey("a", { }); |
|
39 synthesizeKey("b", { }); |
|
40 synthesizeKey(" ", { }); |
|
41 synthesizeKey("\u05d1", { }); |
|
42 synthesizeKey("\u05d2", { }); |
|
43 s1 = snapshotWindow(window); |
|
44 |
|
45 // 4 LEFT to get to the beginning of the line: HOME doesn't work on OS X |
|
46 repeatKey("VK_LEFT", 4); |
|
47 synthesizeKey("VK_BACK_SPACE", { }); |
|
48 synthesizeKey("\u05d0", { }); |
|
49 s2 = snapshotWindow(window); |
|
50 |
|
51 [equal, str1, str2] = compareSnapshots(s1, s2, true); |
|
52 ok(equal, "deleting and inserting RTL char at beginning of line shouldn't change: expected " + |
|
53 str1 + " but got " + str2); |
|
54 |
|
55 textInput.select(); |
|
56 synthesizeKey("a", { }); |
|
57 synthesizeKey("b", { }); |
|
58 synthesizeKey(" ", { }); |
|
59 synthesizeKey("\u05d1", { }); |
|
60 synthesizeKey("\u05d2", { }); |
|
61 // 4 LEFT to get to the beginning of the line: HOME doesn't work on OS X |
|
62 repeatKey("VK_LEFT", 4); |
|
63 synthesizeKey("\u05d0", { }); |
|
64 |
|
65 s3 = snapshotWindow(window); |
|
66 |
|
67 [equal, str1, str2] = compareSnapshots(s1, s3, true); |
|
68 ok(equal, "the order entering Bidi text shouldn't change rendering: expected " + |
|
69 str1 + " but got " + str2); |
|
70 |
|
71 SimpleTest.finish(); |
|
72 } |
|
73 |
|
74 </script> |
|
75 </pre> |
|
76 </body> |
|
77 </html> |
|
78 |