-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsptest.py
More file actions
50 lines (41 loc) · 1.16 KB
/
sptest.py
File metadata and controls
50 lines (41 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import spclipbd
def print_clipboard():
bd = spclipbd.ClipboardContent()
print(f'Suffix: [{bd.get_suffix()}], Length: {len(bd.get_raw())}')
print('Content[:100]:', bd.get_raw()[:100])
print('-' * 20)
def read_bin(filename: str) -> bytes:
with open(filename, 'rb') as f:
raw = f.read()
return raw
def test_plaintext():
print('test plaintext:')
spclipbd.copy_to_clipboard('_plaintext', '你好hello'.encode('utf-8'))
print_clipboard()
input('next...')
def test_txt():
print('test txt:')
spclipbd.copy_to_clipboard('txt', '你好hello'.encode('utf-8'))
print_clipboard()
input('next...')
def test_png():
print('test png:')
spclipbd.copy_to_clipboard('png', read_bin('test.png'))
print_clipboard()
input('next...')
def test_jpg():
print('test jpg:')
spclipbd.copy_to_clipboard('jpg', read_bin('test.jpg'))
print_clipboard()
input('next...')
def test_zip():
print('test zip:')
spclipbd.copy_to_clipboard('zip', read_bin('test.zip'))
print_clipboard()
input('next...')
if __name__ == '__main__':
test_plaintext()
test_txt()
test_zip()
test_png()
test_jpg()