From c699be2677ed19e1b196ba171022c1288f0c7c18 Mon Sep 17 00:00:00 2001 From: Gae24 <96017547+Gae24@users.noreply.github.com> Date: Sat, 12 Oct 2024 19:30:51 +0200 Subject: [PATCH] add test for html() get operation --- examples/{set_html.rs => set_get_html.rs} | 3 +++ src/lib.rs | 9 +++++++++ 2 files changed, 12 insertions(+) rename examples/{set_html.rs => set_get_html.rs} (78%) diff --git a/examples/set_html.rs b/examples/set_get_html.rs similarity index 78% rename from examples/set_html.rs rename to examples/set_get_html.rs index 125f6b1..a88c27f 100644 --- a/examples/set_html.rs +++ b/examples/set_get_html.rs @@ -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}"); } diff --git a/src/lib.rs b/src/lib.rs index 81d4f51..eb3c1bd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 = "hello world!"; + + ctx.set().html(html, None).unwrap(); + + assert_eq!(ctx.get().html().unwrap(), html); + } #[cfg(feature = "image-data")] { let mut ctx = Clipboard::new().unwrap();