diff options
author | Pyfisch <pyfisch@gmail.com> | 2018-11-07 18:44:21 +0100 |
---|---|---|
committer | Pyfisch <pyfisch@gmail.com> | 2018-11-07 18:58:51 +0100 |
commit | 7db13e93b7035384276b8c029ba9288ad453f01f (patch) | |
tree | ed35afa12834abc8050171c2aea016ef1323de6d /tests/unit/script/textinput.rs | |
parent | 9c7efd9151bff29192f40bcc0efec5a7e87a6a80 (diff) | |
download | servo-7db13e93b7035384276b8c029ba9288ad453f01f.tar.gz servo-7db13e93b7035384276b8c029ba9288ad453f01f.zip |
Correct select all
Fixes assertion failure.
Set selection direction forward on select all.
Diffstat (limited to 'tests/unit/script/textinput.rs')
-rw-r--r-- | tests/unit/script/textinput.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs index 73d99cf1588..f4e65a0e1d3 100644 --- a/tests/unit/script/textinput.rs +++ b/tests/unit/script/textinput.rs @@ -699,3 +699,13 @@ fn test_selection_bounds() { assert_eq!(TextPoint { line: 0, index: 0 }, textinput.selection_start()); assert_eq!(TextPoint { line: 1, index: 0 }, textinput.selection_end()); } + +#[test] +fn test_select_all() { + let mut textinput = text_input(Lines::Single, "abc"); + textinput.set_selection_range(2, 3, SelectionDirection::Backward); + textinput.select_all(); + assert_eq!(textinput.selection_direction(), SelectionDirection::Forward); + assert_eq!(TextPoint { line: 0, index: 0 }, textinput.selection_start()); + assert_eq!(TextPoint { line: 0, index: 3 }, textinput.selection_end()); +} |