Test case for bug 613807 - Caret is moved at second row when undoing after committing IME text; r=roc a=blocking-final+
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 24 Nov 2010 17:57:58 -0500
changeset 58195 48202671f152cc979f407039f594eb42ceb6213e
parent 58194 435a1bae2cead77cdfe8e67cea300bb6a1a568da
child 58196 a4af96fd1ce2bb1e8e8eee783cb0312d2406c431
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersroc, blocking-final
bugs613807
milestone2.0b8pre
Test case for bug 613807 - Caret is moved at second row when undoing after committing IME text; r=roc a=blocking-final+
layout/base/tests/Makefile.in
layout/base/tests/bug613807-1-ref.html
layout/base/tests/bug613807-1.html
layout/base/tests/test_reftests_with_caret.html
--- a/layout/base/tests/Makefile.in
+++ b/layout/base/tests/Makefile.in
@@ -121,16 +121,18 @@ DEFINES += -D_IMPL_NS_LAYOUT
 		     bug602141-3.html \
 		     bug602141-3-ref.html \
 		     bug602141-4.html \
 		     bug602141-4-ref.html \
 		     bug613433-1.html \
 		     bug613433-2.html \
 		     bug613433-3.html \
 		     bug613433-ref.html \
+		     bug613807-1.html \
+		     bug613807-1-ref.html \
 		test_bug514127.html \
 		test_bug518777.html \
 		test_bug548545.xhtml \
 		test_bug558663.html \
 		test_bug559499.html \
 		test_flush_on_paint.html \
 		test_mozPaintCount.html \
 		test_scroll_selection_into_view.html \
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug613807-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<textarea id="t" rows="4" autofocus></textarea>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug613807-1.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+</head>
+<body>
+<textarea id="t" rows="4"></textarea>
+<script>
+  addLoadEvent(function() {
+    var area = document.getElementById('t');
+    area.focus();
+
+    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+    const nsIDOMWindowUtils = Components.interfaces.nsIDOMWindowUtils;
+
+    // start composition
+    synthesizeComposition(true);
+
+    // input raw characters
+    synthesizeText(
+      { composition:
+        { string: "\u306D",
+          clauses: [
+            { length: 1, attr: nsIDOMWindowUtils.COMPOSITION_ATTR_RAWINPUT }
+          ]
+        },
+        caret: { start: 1, length: 0 }
+      });
+    synthesizeText(
+      { composition:
+        { string: "\u306D\u3053",
+          clauses: [
+            { length: 2, attr: nsIDOMWindowUtils.COMPOSITION_ATTR_RAWINPUT }
+          ]
+        },
+        caret: { start: 2, length: 0 }
+      });
+
+    // convert
+    synthesizeText(
+      { composition:
+        { string: "\u732B",
+          clauses: [
+            { length: 1, attr: nsIDOMWindowUtils.COMPOSITION_ATTR_SELECTEDCONVERTEDTEXT }
+          ]
+        },
+        caret: { start: 1, length: 0 }
+      });
+
+    // commit
+    synthesizeText(
+      { composition:
+        { string: "\u732B",
+          clauses: [
+            { length: 0, attr: 0 }
+          ]
+        },
+        caret: { start: 1, length: 0 }
+      });
+
+    // end composition
+    synthesizeComposition(false);
+
+    document.body.clientWidth;
+
+    // undo
+    synthesizeKey("Z", {accelKey: true});
+  });
+</script>
+</body>
+</html>
--- a/layout/base/tests/test_reftests_with_caret.html
+++ b/layout/base/tests/test_reftests_with_caret.html
@@ -99,17 +99,18 @@ var tests = [
     [ 'bug585922.html'   , 'bug585922-ref.html'   ] ,
     [ 'bug597519-1.html' , 'bug597519-1-ref.html' ] ,
     [ 'bug602141-1.html' , 'bug602141-1-ref.html' ] ,
     [ 'bug602141-2.html' , 'bug602141-2-ref.html' ] ,
     [ 'bug602141-3.html' , 'bug602141-3-ref.html' ] ,
     [ 'bug602141-4.html' , 'bug602141-4-ref.html' ] ,
     [ 'bug613433-1.html' , 'bug613433-ref.html' ] ,
     [ 'bug613433-2.html' , 'bug613433-ref.html' ] ,
-    [ 'bug613433-3.html' , 'bug613433-ref.html' ]
+    [ 'bug613433-3.html' , 'bug613433-ref.html' ] ,
+    [ 'bug613807-1.html' , 'bug613807-1-ref.html' ]
 ];
 var testIndex = 0;
 
 function nextTest() {
   if (testIndex < tests.length) {
     refTest(tests[testIndex][0],tests[testIndex][1]);
     ++testIndex;
   } else {