[orx-keyframer] Add support for backticked identifier names, replace spek tests

This commit is contained in:
Edwin Jakobs
2022-07-28 19:10:28 +02:00
parent 225c2850fa
commit 5fa4e724c1
9 changed files with 273 additions and 254 deletions

View File

@@ -2,34 +2,31 @@ import org.amshove.kluent.`should be`
import org.amshove.kluent.shouldBeNear
import org.openrndr.extra.keyframer.KeyframerChannel
import org.openrndr.extras.easing.Easing
import org.spekframework.spek2.Spek
import org.spekframework.spek2.style.specification.describe
object TestKeyframerChannel : Spek({
import kotlin.test.Test
describe("a keyframer channel without keys") {
class TestKeyframerChannel {
@Test
fun `a keyframer channel without keys`() {
val kfc = KeyframerChannel()
it ("should return null when asking for value before first key time") {
kfc.value(0.0) `should be` null
}
kfc.value(0.0) `should be` null
}
describe("a keyframer channel with a single key") {
@Test
fun `a keyframer channel with a single key`() {
val kfc = KeyframerChannel()
kfc.add(0.0, 1.0, Easing.Linear.function)
kfc.value(0.0)?.shouldBeNear(1.0, 10E-6)
it ("should return null when asking for value before first key time") {
kfc.value(-1.0) `should be` null
}
kfc.value(-1.0) `should be` null
}
describe("a keyframer channel with two keys") {
@Test
fun `a keyframer channel with two keys`() {
val kfc = KeyframerChannel()
kfc.add(0.0, 1.0, Easing.Linear.function)
kfc.add(1.0, 2.0, Easing.Linear.function)
kfc.value(0.0)?.shouldBeNear(1.0, 10E-6)
it ("should return null when asking for value before first key time") {
kfc.value(-1.0) `should be` null
}
kfc.value(-1.0) `should be` null
}
})
}