2019-11-17 05:40:03 +03:00
|
|
|
import clipboard
|
|
|
|
|
2020-11-03 01:00:29 +03:00
|
|
|
fn run_test(is_primary bool) {
|
|
|
|
mut cb := if is_primary { clipboard.new_primary() } else { clipboard.new() }
|
|
|
|
if !cb.is_available() {
|
|
|
|
return
|
|
|
|
}
|
2020-11-20 13:58:53 +03:00
|
|
|
assert cb.check_ownership() == false
|
2020-11-03 01:00:29 +03:00
|
|
|
assert cb.copy('I am a good boy!') == true
|
2020-11-20 13:58:53 +03:00
|
|
|
// assert cb.check_ownership() == true TODO
|
2020-11-03 01:00:29 +03:00
|
|
|
assert cb.paste() == 'I am a good boy!'
|
2019-11-17 05:40:03 +03:00
|
|
|
cb.clear_all()
|
|
|
|
assert cb.paste().len <= 0
|
|
|
|
cb.destroy()
|
|
|
|
}
|
|
|
|
|
2020-11-03 01:00:29 +03:00
|
|
|
fn test_primary() {
|
2020-12-31 12:34:46 +03:00
|
|
|
$if linux || freebsd {
|
2020-11-03 01:00:29 +03:00
|
|
|
// run_test(true)
|
2020-10-14 22:51:16 +03:00
|
|
|
return
|
2019-11-17 05:40:03 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-03 01:00:29 +03:00
|
|
|
fn test_clipboard() {
|
2020-12-31 12:34:46 +03:00
|
|
|
$if linux || freebsd {
|
2020-04-21 07:16:47 +03:00
|
|
|
return
|
|
|
|
}
|
2019-11-17 05:40:03 +03:00
|
|
|
run_test(false)
|
2019-11-18 13:10:31 +03:00
|
|
|
}
|