Skip to content

Commit

Permalink
add test for html() get operation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gae24 committed Oct 12, 2024
1 parent d42f5e6 commit c699be2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/set_html.rs → examples/set_get_html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ consectetur adipiscing elit."#;

ctx.set_html(html, Some(alt_text)).unwrap();
thread::sleep(Duration::from_secs(5));

let success = ctx.get().html().unwrap() == html;
println!("Set and Get html operation were successful: {success}");
}
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,15 @@ mod tests {
ctx.set_html(html, Some(alt_text)).unwrap();
assert_eq!(ctx.get_text().unwrap(), alt_text);
}
{
let mut ctx = Clipboard::new().unwrap();

let html = "<b>hello</b> <i>world</i>!";

ctx.set().html(html, None).unwrap();

assert_eq!(ctx.get().html().unwrap(), html);
}
#[cfg(feature = "image-data")]
{
let mut ctx = Clipboard::new().unwrap();
Expand Down

0 comments on commit c699be2

Please sign in to comment.