mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Restore DummyClipboardContext for textinput.rs tests
This commit is contained in:
parent
884b54a626
commit
2726fc1dea
1 changed files with 22 additions and 1 deletions
|
@ -8,13 +8,34 @@
|
|||
// except according to those terms.
|
||||
|
||||
use keyboard_types::{Key, Modifiers};
|
||||
use script::clipboard_provider::DummyClipboardContext;
|
||||
use script::clipboard_provider::ClipboardProvider;
|
||||
use script::test::DOMString;
|
||||
use script::textinput::{
|
||||
Direction, Lines, Selection, SelectionDirection, TextInput, TextPoint, UTF16CodeUnits,
|
||||
UTF8Bytes,
|
||||
};
|
||||
|
||||
pub struct DummyClipboardContext {
|
||||
content: String,
|
||||
}
|
||||
|
||||
impl DummyClipboardContext {
|
||||
pub fn new(s: &str) -> DummyClipboardContext {
|
||||
DummyClipboardContext {
|
||||
content: s.to_owned(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ClipboardProvider for DummyClipboardContext {
|
||||
fn clipboard_contents(&mut self) -> String {
|
||||
self.content.clone()
|
||||
}
|
||||
fn set_clipboard_contents(&mut self, s: String) {
|
||||
self.content = s;
|
||||
}
|
||||
}
|
||||
|
||||
fn text_input(lines: Lines, s: &str) -> TextInput<DummyClipboardContext> {
|
||||
TextInput::new(
|
||||
lines,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue