reftests for bug 299065 and some of its dependencies and mochitests for bidi editing issues found when debugging bug 332655
authorSimon Montagu <smontagu@smontagu.org>
Thu, 19 Mar 2009 02:15:06 -0700
changeset 26350 b7b8d7526192e6c06087757ac5896a6a85df740d
parent 26349 032ffaec3006f2253a02c93f069f78a5958c5b4e
child 26351 18b1811cd1042e4b4f6f0444f865683c2683d11d
push idunknown
push userunknown
push dateunknown
bugs299065, 332655
milestone1.9.2a1pre
reftests for bug 299065 and some of its dependencies and mochitests for bidi editing issues found when debugging bug 332655
layout/base/tests/Makefile.in
layout/base/tests/test_bug332655-1.html
layout/base/tests/test_bug332655-2.html
layout/reftests/bidi/258928-1-ref.html
layout/reftests/bidi/258928-1.html
layout/reftests/bidi/299065-1-ref.html
layout/reftests/bidi/299065-1.html
layout/reftests/bidi/305643-1-ref.html
layout/reftests/bidi/305643-1.html
layout/reftests/bidi/reftest.list
--- a/layout/base/tests/Makefile.in
+++ b/layout/base/tests/Makefile.in
@@ -75,16 +75,18 @@ DEFINES += -D_IMPL_NS_LAYOUT
 # test_bug396024.html is currently disabled because it interacts badly with
 # the "You can't print-preview while the page is loading" dialog.
 # (See bug 407080)
 
 # Tests for bugs 441782 and 467672 don't pass reliably on Windows, because of bug 469208
 ifeq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT)))
 _TEST_FILES += \
 		bidi_numeral_test.js \
+		test_bug332655-1.html \
+		test_bug332655-2.html \
 		test_bug441782-1.html \
 		bug441782-1.html \
 		bug441782-1-ref.html \
 		test_bug441782-2.html \
 		bug441782-2.html \
 		bug441782-2-ref.html \
 		test_bug441782-3.html \
 		bug441782-3.html \
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug332655-1.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=332655
+-->
+<head>
+  <title>Test for Bug 332655</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="test()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332655">Mozilla Bug 332655</a>
+<p id="display"></p>
+<div id="content">
+<input type="text" id="testInput">
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 332655 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function test() {
+  var textInput = $("testInput");
+  var s1, s2, s3, equal, str1, str2;
+
+  textInput.focus();
+  synthesizeKey("a", { });
+  synthesizeKey("b", { });
+  synthesizeKey(" ", { });
+  synthesizeKey("\u05d0", { });
+  synthesizeKey("\u05d1", { });
+  s1 = snapshotWindow(window);
+
+  synthesizeKey(" ", { });
+  s2 = snapshotWindow(window);
+
+  [equal, str1, str2] = compareSnapshots(s1, s2, true);
+  ok(equal, "space after LTR + RTL shouldn't change direction: expected " +
+     str1 + " but got " + str2);
+
+  synthesizeKey("VK_BACK_SPACE", { });
+  s3 = snapshotWindow(window);
+
+  [equal, str1, str2] = compareSnapshots(s1, s3, true);
+  ok(equal, "backspace should restore the status quo: expected " + str1 + 
+     " but got " + str2);
+
+  SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug332655-2.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=332655
+-->
+<head>
+  <title>Test for Bug 332655</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="test()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332655">Mozilla Bug 332655</a>
+<p id="display"></p>
+<div id="content">
+<input type="text" id="testInput">
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 332655 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function repeatKey(key, repetitions) {
+  for (var i = 0; i < 4; ++i) {
+    synthesizeKey(key, {});
+  }
+}
+
+function test() {
+  var textInput = $("testInput");
+  var s1, s2, s3, equal, str1, str2;
+
+  textInput.focus();
+  synthesizeKey("\u05d0", { });
+  synthesizeKey("a", { });
+  synthesizeKey("b", { });
+  synthesizeKey(" ", { });
+  synthesizeKey("\u05d1", { });
+  synthesizeKey("\u05d2", { });
+  s1 = snapshotWindow(window);
+
+  // 4 LEFT to get to the beginning of the line: HOME doesn't work on OS X
+  repeatKey("VK_LEFT", 4);
+  synthesizeKey("VK_BACK_SPACE", { });
+  synthesizeKey("\u05d0", { });
+  s2 = snapshotWindow(window);
+
+  [equal, str1, str2] = compareSnapshots(s1, s2, true);
+  ok(equal, "deleting and inserting RTL char at beginning of line shouldn't change: expected " +
+     str1 + " but got " + str2);
+
+  textInput.select();
+  synthesizeKey("a", { });
+  synthesizeKey("b", { });
+  synthesizeKey(" ", { });
+  synthesizeKey("\u05d1", { });
+  synthesizeKey("\u05d2", { });
+  // 4 LEFT to get to the beginning of the line: HOME doesn't work on OS X
+  repeatKey("VK_LEFT", 4);
+  synthesizeKey("\u05d0", { });
+
+  s3 = snapshotWindow(window);
+
+  [equal, str1, str2] = compareSnapshots(s1, s3, true);
+  ok(equal, "the order entering Bidi text shouldn't change rendering: expected " +
+     str1 + " but got " + str2);
+
+  SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bidi/258928-1-ref.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+  <title>RTL list displayed as inline broken</title>
+  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+  <style type="text/css">
+ul {
+ padding: 3px 10px;
+ border-bottom: 3px solid #4949A9;
+ white-space: nowrap;
+ font-size: 13px;
+}
+
+ul li {
+ display: inline;
+ margin: 0;
+ padding: 3px 10px;
+ border-top: 1px solid gray;
+ border-right: 1px solid gray;
+ border-left: 1px solid gray;
+ background-color: #f0f0f0;
+}
+  </style>
+ </head>
+ <body>
+  <h1>Broken RTL list when displayed as inline</h1>
+  <h2>One Item</h2>
+  <ul class="tabs">
+   <li>Tab</li>
+  </ul>
+  <h2>Two Items</h2>
+  <ul class="tabs">
+   <li>Tab</li>
+   <li>Tab</li>
+  </ul>
+  <h2>Many</h2>
+  <ul class="tabs">
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+  </ul>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bidi/258928-1.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+  <title>RTL list displayed as inline broken</title>
+  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+  <style type="text/css">
+ul {
+ padding: 3px 10px;
+ border-bottom: 3px solid #4949A9;
+ white-space: nowrap;
+ font-size: 13px;
+ direction: rtl;
+ text-align: left;
+}
+
+ul li {
+ display: inline;
+ margin: 0;
+ padding: 3px 10px;
+ border-top: 1px solid gray;
+ border-right: 1px solid gray;
+ border-left: 1px solid gray;
+ background-color: #f0f0f0;
+}
+  </style>
+ </head>
+ <body>
+  <h1>Broken RTL list when displayed as inline</h1>
+  <h2>One Item</h2>
+  <ul class="tabs">
+   <li>Tab</li>
+  </ul>
+  <h2>Two Items</h2>
+  <ul class="tabs">
+   <li>Tab</li>
+   <li>Tab</li>
+  </ul>
+  <h2>Many</h2>
+  <ul class="tabs">
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+   <li>Tab</li>
+  </ul>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bidi/299065-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html lang="en">
+ <head>
+  <title>Testcase, bug 299065</title>
+  <style type="text/css">
+  p    { border: thin solid; background: aqua;   color: blue;  }
+  span { background: yellow; color: olive; }
+  </style>
+ </head>
+ <body>
+  <p>AA<span>AA</span><span>&#x5D0;&#x5D0;</span>&#x5D0;&#x5D0;</p>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bidi/299065-1.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html lang="en">
+ <head>
+  <title>Testcase, bug 299065</title>
+  <style type="text/css">
+  p    { border: thin solid; background: aqua;   color: blue;  }
+  span { background: yellow; color: olive; }
+  </style>
+ </head>
+ <body>
+  <p>AA<span>AA&#x5D0;&#x5D0;</span>&#x5D0;&#x5D0;</p>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bidi/305643-1-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+  <meta charset="iso-8859-8-i">
+ </head>
+ <body>
+  <table>
+   <tbody>
+    <tr>
+     <td dir="rtl" align="right">
+      <span style="unicode-bidi: bidi-override; font-size: 12px;">(שעה: 20:52) איילון צפון: התנועה זורמת ממחלף קיבוץ גלויות עד מחלף הרצליה</span>
+     </td>
+    </tr>
+   </tbody>
+  </table>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bidi/305643-1.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+  <meta charset="iso-8859-8">
+ </head>
+ <body>
+  <table>
+   <tbody>
+    <tr>
+     <td dir="rtl" align="right">
+      <span style="font-size: 12px;">(שעה: 20:52) איילון צפון: התנועה זורמת ממחלף קיבוץ גלויות עד מחלף הרצליה</span>
+     </td>
+    </tr>
+   </tbody>
+  </table>
+ </body>
+</html>
--- a/layout/reftests/bidi/reftest.list
+++ b/layout/reftests/bidi/reftest.list
@@ -16,16 +16,19 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") ==
 random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == mixedChartype-02.html mixedChartype-02-ref.html
 random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == mixedChartype-02-j.html mixedChartype-02-ref.html
 random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == mixedChartype-03.html mixedChartype-03-ref.html
 random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == mixedChartype-03-j.html mixedChartype-03-ref.html
 == with-first-letter-1a.html with-first-letter-1-ref.html
 == with-first-letter-1b.html with-first-letter-1-ref.html
 == with-first-letter-2a.html with-first-letter-2-ref.html
 == with-first-letter-2b.html with-first-letter-2-ref.html
+== 258928-1.html 258928-1-ref.html
+== 299065-1.html 299065-1-ref.html
+== 305643-1.html 305643-1-ref.html
 random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 386339.html 386339-ref.html
 == 409375.html 409375-ref.html
 == 413542-1.html 413542-1-ref.html
 == 413542-2.html 413542-2-ref.html
 == 413928-1.html 413928-1-ref.html
 == 413928-2.html 413928-2-ref.html
 == 425338-1a.html 425338-1-ref.html
 == 425338-1b.html 425338-1-ref.html