]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/gadgets/buttons/buttons-tests.factor
bdd9ebaf13c630e6476ea3d6dcdec5d9b40788c3
[factor.git] / basis / ui / gadgets / buttons / buttons-tests.factor
1 USING: ui.commands ui.gadgets.buttons ui.gadgets.labels
2 ui.gadgets tools.test namespaces sequences kernel models
3 accessors ;
4 IN: ui.gadgets.buttons.tests
5
6 TUPLE: foo-gadget ;
7
8 : com-foo-a ;
9
10 : com-foo-b ;
11
12 \ foo-gadget "toolbar" f {
13     { f com-foo-a }
14     { f com-foo-b }
15 } define-command-map
16
17 T{ foo-gadget } <toolbar> "t" set
18
19 [ 2 ] [ "t" get children>> length ] unit-test
20 [ "Foo A" ] [ "t" get gadget-child gadget-child label-string ] unit-test
21
22 [ ] [
23     2 <model> {
24         { 0 "atheist" }
25         { 1 "christian" }
26         { 2 "muslim" }
27         { 3 "jewish" }
28     } <radio-buttons> "religion" set
29 ] unit-test
30
31 \ <radio-buttons> must-infer
32
33 \ <toggle-buttons> must-infer
34
35 \ <checkbox> must-infer
36
37 [ 0 ] [
38     "religion" get gadget-child value>>
39 ] unit-test
40
41 [ 2 ] [
42     "religion" get gadget-child control-value
43 ] unit-test