Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/WebKit/LayoutTests/editing/selection/modify_move/move-by-character-brute-force.html

Issue 1809963002: [Editing][CodeHealth] Use w3c testharness in editing/seletion/move-by-* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698