Skip to content

Commit

Permalink
Restore DummyClipboardContext for textinput.rs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmiecz committed Jun 15, 2019
1 parent 884b54a commit 2726fc1
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/unit/script/textinput.rs
Expand Up @@ -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,
Expand Down

0 comments on commit 2726fc1

Please sign in to comment.