factor/library/test/gadgets.factor

66 lines
1.8 KiB
Factor
Raw Normal View History

2005-01-31 22:32:06 -05:00
IN: scratchpad
USING: gadgets kernel lists math namespaces test ;
[ t ] [
[
2000 x set
2000 y set
2005-02-05 11:52:24 -05:00
2030 2040 rect> 10 20 300 400 <rectangle> inside?
2005-01-31 22:32:06 -05:00
] with-scope
] unit-test
[ f ] [
[
2000 x set
2000 y set
2005-02-05 11:52:24 -05:00
2500 2040 rect> 10 20 300 400 <rectangle> inside?
2005-01-31 22:32:06 -05:00
] with-scope
] unit-test
[ t ] [
[
-10 x set
-20 y set
2005-02-05 11:52:24 -05:00
0 0 rect> 10 20 300 400 <rectangle> inside?
2005-01-31 22:32:06 -05:00
] with-scope
] unit-test
[ 11 11 41 41 ] [
2005-02-07 10:24:03 -05:00
[
1 x set
1 y set
2005-02-07 18:42:33 -05:00
10 10 30 30 <rectangle> <gadget> rect>screen
2005-02-07 10:24:03 -05:00
] with-scope
2005-01-31 22:32:06 -05:00
] unit-test
[ t ] [
2005-02-07 10:24:03 -05:00
[
0 x set
0 y set
2005-02-05 11:52:24 -05:00
0 0 rect> -10 -10 20 20 <rectangle> <gadget> [ pick-up ] keep =
2005-02-07 10:24:03 -05:00
] with-scope
2005-01-31 22:32:06 -05:00
] unit-test
: funny-rect ( x -- rect )
10 10 30 <rectangle> <gadget>
2005-02-07 10:24:03 -05:00
dup [ 255 0 0 ] foreground set-paint-property ;
2005-01-31 22:32:06 -05:00
[ f ] [
2005-02-07 10:24:03 -05:00
[
0 x set
0 y set
2005-02-05 11:52:24 -05:00
35 0 rect>
2005-01-31 22:32:06 -05:00
[ 10 30 50 70 ] [ funny-rect ] map
2005-02-07 10:24:03 -05:00
pick-up-list
] with-scope
2005-01-31 22:32:06 -05:00
] unit-test
[ 1 3 2 ] [ #{ 1 2 }# #{ 3 4 }# x1/x2/y1 ] unit-test
[ 1 3 4 ] [ #{ 1 2 }# #{ 3 4 }# x1/x2/y2 ] unit-test
[ 1 2 4 ] [ #{ 1 2 }# #{ 3 4 }# x1/y1/y2 ] unit-test
[ 3 2 4 ] [ #{ 1 2 }# #{ 3 4 }# x2/y1/y2 ] unit-test
2005-02-07 10:24:03 -05:00
[ -90 ] [ 10 10 -100 -200 <line> shape-x ] unit-test
[ 20 ] [ 10 10 100 200 <line> [ 20 30 rot move-shape ] keep shape-x ] unit-test
[ 30 ] [ 10 10 100 200 <line> [ 20 30 rot move-shape ] keep shape-y ] unit-test
[ 20 ] [ 110 110 -100 -200 <line> [ 20 30 rot move-shape ] keep shape-x ] unit-test
[ 30 ] [ 110 110 -100 -200 <line> [ 20 30 rot move-shape ] keep shape-y ] unit-test
[ 10 ] [ 110 110 -100 -200 <line> [ 400 400 rot resize-shape ] keep shape-x ] unit-test
[ 400 ] [ 110 110 -100 -200 <line> [ 400 400 rot resize-shape ] keep shape-w ] unit-test