Index: third_party/WebKit/LayoutTests/editing/selection/modify_move/move-by-character-brute-force.html |
diff --git a/third_party/WebKit/LayoutTests/editing/selection/modify_move/move-by-character-brute-force.html b/third_party/WebKit/LayoutTests/editing/selection/modify_move/move-by-character-brute-force.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..095222dcc7371a162eb36af7984f5647dfcff0bf |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/selection/modify_move/move-by-character-brute-force.html |
@@ -0,0 +1,41 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<meta charset="UTF-8"> |
+<div id="sample"></div> |
+<div id="log"></div> |
+<script> |
+test(function(){ |
+ function hasSimpleCaretMovement(charCode) { |
+ var testString = "aaaaa" + String.fromCharCode(charCode) + "bbbb"; |
+ sample.textContent = testString; |
+ var selection = window.getSelection(); |
+ selection.collapse(sample, 0); |
+ for (var i = 0; i < testString.length; ++i) { |
+ selection.modify("move", "forward", "character"); |
+ if (selection.baseOffset != i + 1) |
+ return false; |
+ } |
+ return true; |
+ } |
+ |
+ function toHex(i) { |
+ var hex = i.toString(16); |
+ while (hex.length < 4) |
+ hex = "0" + hex; |
+ return hex; |
+ } |
+ |
+ |
+ assert_true(hasSimpleCaretMovement(0x0041)); |
+ |
+ assert_false(hasSimpleCaretMovement(0x0300)); |
+ |
+ for (var i = 1; i < 1024; ++i) { |
+ if (i >= 0x0300 && i <= 0x036F) |
+ assert_false(hasSimpleCaretMovement(i)); |
+ else |
+ assert_true(hasSimpleCaretMovement(i)); |
+ } |
+}, "This test checks that we have simple caret motion up to a certain limit"); |
+</script> |