mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
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 -->
This commit is contained in:
commit
e45546edf0
3 changed files with 23 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue