]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/gadgets/buttons/buttons-tests.factor
a8e864a25975e3efe2e93cbee97b075dda821caf
[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 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 { 0 } [
32     "religion" get gadget-child value>>
33 ] unit-test
34
35 { 2 } [
36     "religion" get gadget-child control-value
37 ] unit-test