v / vlib / clipboard / clipboard_test.v
29 lines · 26 sloc · 549 bytes · 45495c3ebb61ce614649a1fb34e64537ae98fd37
Raw
1import clipboard
2
3fn run_test(is_primary bool) {
4 mut cb := if is_primary { clipboard.new_primary() } else { clipboard.new() }
5 if !cb.is_available() {
6 return
7 }
8 assert cb.check_ownership() == false
9 assert cb.copy('I am a good boy!') == true
10 // assert cb.check_ownership() == true TODO
11 assert cb.paste() == 'I am a good boy!'
12 cb.clear_all()
13 assert cb.paste().len <= 0
14 cb.destroy()
15}
16
17fn test_primary() {
18 $if linux || freebsd {
19 // run_test(true)
20 return
21 }
22}
23
24fn test_clipboard() {
25 $if linux || freebsd {
26 return
27 }
28 run_test(false)
29}
30