File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ impl ClipboardUtil {
36
36
let text = CString :: new ( text) . unwrap ( ) ;
37
37
let result = sys:: clipboard:: SDL_SetClipboardText ( text. as_ptr ( ) as * const c_char ) ;
38
38
39
- if result {
39
+ if ! result {
40
40
Err ( get_error ( ) )
41
41
} else {
42
42
Ok ( ( ) )
Original file line number Diff line number Diff line change
1
+ extern crate sdl3;
2
+
3
+ #[ test]
4
+ fn test_clipboard ( ) {
5
+ let sdl_context = sdl3:: init ( ) . unwrap ( ) ;
6
+ let video_subsystem = sdl_context. video ( ) . unwrap ( ) ;
7
+ let clipboard = video_subsystem. clipboard ( ) ;
8
+ let text = "Hello World!" ;
9
+
10
+ // set some text
11
+ assert ! ( clipboard. set_clipboard_text( text) . is_ok( ) ) ;
12
+ assert ! ( clipboard. has_clipboard_text( ) ) ;
13
+ // get it back
14
+ assert_eq ! ( clipboard. clipboard_text( ) , Ok ( text. to_string( ) ) ) ;
15
+ }
You can’t perform that action at this time.
0 commit comments