-
Notifications
You must be signed in to change notification settings - Fork 6
/
test_combobox.nim
44 lines (32 loc) · 931 Bytes
/
test_combobox.nim
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
import std/unittest
import uing
suite "Test ComboBox":
# setup
init()
let window = newWindow("ComboBox Test", 200, 200)
let combobox = newComboBox()
# tests
test "ComboBox can add items":
combobox.add "test1", "test2", "test3"
check combobox.items.len == 3
check combobox.items == @["test1", "test2", "test3"]
test "ComboBox can insert items":
combobox.insertAt 1, "test_inserted"
check combobox.items.len == 4
check combobox.items == @["test1", "test_inserted", "test2", "test3"]
test "ComboBox can delete items":
combobox.delete 1
check combobox.items.len == 3
test "ComboBox can clear items":
combobox.clear()
check combobox.items.len == 0
test "ComboBox can set selected":
combobox.add "test1"
combobox.selected = 0
check combobox.selected == 0
# teardown
window.child = combobox
show window
mainSteps()
mainStep(1)
uing.quit()