Pictures System Tests
Tests for Scaling and Rotation
Seed pattern:
def sp(size: Int) = pict { t =>
import t._
invisible()
setAnimationDelay(0)
repeat (4) {
forward(size)
right()
}
}
def p = sp(50)
Code for running test:
clear()
axesOn()
show(pic)
Test1
val pic = scale(2) -> p
pic should go from 0 to 100
Test2
val pic = scale(2) * trans(50, 0) -> p
pic should go from 100 to 200
Test3
val pic = scale(2) -> HPics(
p,
p
)
pic should go from 0 to 200
Test4
val pic = scale(2) * trans(50,0) -> HPics(
p,
p
)
pic should go from 50 to 250
Test5
val pic = HPics(
scale(2) -> p,
p
)
pic should go from 0 to 150
first p should go from 0 to 100
Test6
val pic = HPics(
p,
scale(2) -> p
)
pic should go from 0 to 200
2nd p should go from 100 to 200
Test7
val pic = HPics(
p,
HPics(
scale(2) -> p,
p
)
)
pic should go from 0 to 200
2nd p should go from 50 to 150
Test8
val pic = HPics(
p,
HPics(
p,
scale(2) -> p
)
)
pic should go from 0 to 250
3rd p should go from 150 to 250
Test9
val pic = HPics(
p,
scale(2) -> HPics(
p,
p
)
)