2 USING: ui.gadgets ui.gadgets.packs ui.gadgets.worlds tools.test
3 namespaces models kernel ;
5 [ T{ rect f { 10 10 } { 20 20 } } ]
7 T{ rect f { 10 10 } { 50 50 } }
8 T{ rect f { -10 -10 } { 40 40 } }
12 [ T{ rect f { 200 200 } { 0 0 } } ]
14 T{ rect f { 100 100 } { 50 50 } }
15 T{ rect f { 200 200 } { 40 40 } }
20 T{ rect f { 100 100 } { 50 50 } }
21 T{ rect f { 200 200 } { 40 40 } }
26 T{ rect f { 100 100 } { 50 50 } }
27 T{ rect f { 120 120 } { 40 40 } }
32 T{ rect f { 1000 100 } { 50 50 } }
33 T{ rect f { 120 120 } { 40 40 } }
41 [ ] [ <gadget> <fooey> set-gadget-delegate ] unit-test
42 [ ] [ f <fooey> set-gadget-delegate ] unit-test
46 ! c contains b contains a
49 "a" get "b" get add-gadget
51 "b" get "c" get add-gadget
54 { 100 200 } "a" get set-rect-loc
55 { 200 100 } "b" get set-rect-loc
57 ! give c a loc, it doesn't matter
58 { -1000 23 } "c" get set-rect-loc
60 ! what is the location of a inside c?
61 "a" get "c" get relative-loc
65 { 10 10 } "g1" get set-rect-loc
66 { 30 30 } "g1" get set-rect-dim
68 { 20 20 } "g2" get set-rect-loc
69 { 50 500 } "g2" get set-rect-dim
71 { 100 200 } "g3" get set-rect-dim
73 "g1" get "g2" get add-gadget
74 "g2" get "g3" get add-gadget
76 [ { 30 30 } ] [ "g1" get screen-loc ] unit-test
77 [ { 30 30 } ] [ "g1" get screen-rect rect-loc ] unit-test
78 [ { 30 30 } ] [ "g1" get screen-rect rect-dim ] unit-test
79 [ { 20 20 } ] [ "g2" get screen-loc ] unit-test
80 [ { 20 20 } ] [ "g2" get screen-rect rect-loc ] unit-test
81 [ { 50 180 } ] [ "g2" get screen-rect rect-dim ] unit-test
82 [ { 0 0 } ] [ "g3" get screen-loc ] unit-test
83 [ { 0 0 } ] [ "g3" get screen-rect rect-loc ] unit-test
84 [ { 100 200 } ] [ "g3" get screen-rect rect-dim ] unit-test
87 { 300 300 } "g1" get set-rect-dim
89 "g2" get "g1" get add-gadget
90 { 20 20 } "g2" get set-rect-loc
91 { 20 20 } "g2" get set-rect-dim
93 "g3" get "g1" get add-gadget
94 { 100 100 } "g3" get set-rect-loc
95 { 20 20 } "g3" get set-rect-dim
97 [ t ] [ { 30 30 } "g2" get inside? ] unit-test
99 [ t ] [ { 30 30 } "g1" get (pick-up) "g2" get eq? ] unit-test
101 [ t ] [ { 30 30 } "g1" get pick-up "g2" get eq? ] unit-test
103 [ t ] [ { 110 110 } "g1" get pick-up "g3" get eq? ] unit-test
106 "g4" get "g2" get add-gadget
107 { 5 5 } "g4" get set-rect-loc
108 { 1 1 } "g4" get set-rect-dim
110 [ t ] [ { 25 25 } "g1" get pick-up "g4" get eq? ] unit-test