[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[s8] points and rectangles

"Point copy tests"
| p c |
p := 5@5.
c := p copy x: 10.
p x = 10 ifTrue: [ self error: 'Wrong value in (p) x'].
c x = 10 ifFalse: [ self error: 'Wrong value in (c) x'].
5 @ 5=p ifFalse: [ self error: 'Wrong point, must be 5@5' ].
#ok


"Rectangle copy tests"
| t c |
t := 5@5 extent: 10@10.
c := t copy leftTop: 10@10.
t leftTop x = 10 ifTrue: [ self error: 'Wrong t'].
c leftTop x = 10 ifFalse: [ self error: 'Wrong c'].
5 @ 5 + 5 = c leftTop ifFalse: [ self error: 'Wrong leftTop' ].
#ok