-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path_input_cursor_visibility_test.v
More file actions
45 lines (43 loc) · 1019 Bytes
/
_input_cursor_visibility_test.v
File metadata and controls
45 lines (43 loc) · 1019 Bytes
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
module gui
fn test_input_insert_forces_cursor_visible() {
id_focus := u32(9101)
mut w := Window{}
w.view_state.input_cursor_on = false
w.view_state.cursor_on_sticky = false
mut imap := state_map[u32, InputState](mut w, ns_input, cap_many)
imap.set(id_focus, InputState{
cursor_pos: 0
})
cfg := InputCfg{
id_focus: id_focus
text: ''
}
got := cfg.insert('a', mut w) or {
assert false
return
}
assert got == 'a'
assert w.view_state.input_cursor_on
assert w.view_state.cursor_on_sticky
}
fn test_input_delete_forces_cursor_visible() {
id_focus := u32(9102)
mut w := Window{}
w.view_state.input_cursor_on = false
w.view_state.cursor_on_sticky = false
mut imap := state_map[u32, InputState](mut w, ns_input, cap_many)
imap.set(id_focus, InputState{
cursor_pos: 2
})
cfg := InputCfg{
id_focus: id_focus
text: 'ab'
}
got := cfg.delete(mut w, false) or {
assert false
return
}
assert got == 'a'
assert w.view_state.input_cursor_on
assert w.view_state.cursor_on_sticky
}