mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix test_clipboard_paste to pass on Mac OS.
This commit is contained in:
parent
0587717944
commit
d054946f7d
1 changed files with 13 additions and 2 deletions
|
@ -7,7 +7,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use msg::constellation_msg::{Key, CONTROL};
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
use msg::constellation_msg::SUPER;
|
||||
#[cfg(not(target_os="macos"))]
|
||||
use msg::constellation_msg::CONTROL;
|
||||
|
||||
use script::textinput::{TextInput, Selection, Lines, DeleteDir};
|
||||
use script::clipboard_provider::DummyClipboardContext;
|
||||
use std::borrow::ToOwned;
|
||||
|
@ -169,9 +175,14 @@ fn test_textinput_set_content() {
|
|||
|
||||
#[test]
|
||||
fn test_clipboard_paste() {
|
||||
#[cfg(target_os="macos")]
|
||||
const MODIFIERS: KeyModifiers = SUPER;
|
||||
#[cfg(not(target_os="macos"))]
|
||||
const MODIFIERS: KeyModifiers = CONTROL;
|
||||
|
||||
let mut textinput = TextInput::new(Lines::Single, "defg".to_owned(), DummyClipboardContext::new("abc"));
|
||||
assert_eq!(textinput.get_content(), "defg");
|
||||
assert_eq!(textinput.edit_point.index, 0);
|
||||
textinput.handle_keydown_aux(Key::V, CONTROL);
|
||||
textinput.handle_keydown_aux(Key::V, MODIFIERS);
|
||||
assert_eq!(textinput.get_content(), "abcdefg");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue