aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/script/textinput.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-04-16 15:08:59 -0500
committerGitHub <noreply@github.com>2017-04-16 15:08:59 -0500
commite45546edf0445d5ca714162bff89c0780d087993 (patch)
treeea03da7c02aebceac5c07670b22362f4b5753a55 /tests/unit/script/textinput.rs
parent5ccb087769fdb5253514e1ea2babd28b21c65907 (diff)
parent49ea443146f52f5d6558970359e26352af616585 (diff)
downloadservo-e45546edf0445d5ca714162bff89c0780d087993.tar.gz
servo-e45546edf0445d5ca714162bff89c0780d087993.zip
Auto merge of #15822 - charlesvdv:unicode-panic, r=emilio
Correct unicode handling for text input <!-- Please describe your changes on the following line: --> Allow proprer handling of unicode sequence in text input. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #15819 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15822) <!-- Reviewable:end -->
Diffstat (limited to 'tests/unit/script/textinput.rs')
-rw-r--r--tests/unit/script/textinput.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs
index a9e5a9fc08b..620368b4d8f 100644
--- a/tests/unit/script/textinput.rs
+++ b/tests/unit/script/textinput.rs
@@ -602,3 +602,13 @@ fn test_textinput_set_selection_with_direction() {
assert_eq!(textinput.selection_begin.unwrap().line, 0);
assert_eq!(textinput.selection_begin.unwrap().index, 6);
}
+
+#[test]
+fn test_textinput_unicode_handling() {
+ let mut textinput = text_input(Lines::Single, "éèùµ$£");
+ assert_eq!(textinput.edit_point.index, 0);
+ textinput.set_edit_point_index(1);
+ assert_eq!(textinput.edit_point.index, 2);
+ textinput.set_edit_point_index(4);
+ assert_eq!(textinput.edit_point.index, 8);
+}