From 49ea443146f52f5d6558970359e26352af616585 Mon Sep 17 00:00:00 2001 From: charlesvdv Date: Sun, 16 Apr 2017 11:52:21 +0200 Subject: [PATCH] add test for text input unicode handling --- tests/unit/script/textinput.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs index 01e28433ed6..d74c83fa6e8 100644 --- a/tests/unit/script/textinput.rs +++ b/tests/unit/script/textinput.rs @@ -496,3 +496,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); +}