Auto commit Thu Mar 19 05:01:02 PM CDT 2026

This commit is contained in:
Tretzi
2026-03-19 17:01:02 -05:00
parent aa0b51fbc4
commit c7518b7e9c
4 changed files with 424 additions and 77 deletions

View File

@@ -0,0 +1,34 @@
package com.mindmachine.mvp
import com.mindmachine.mvp.session.TimelineEditorState
import com.mindmachine.mvp.session.TimelineParameters
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
class TimelineParametersTest {
@Test
fun `log scale normalize-denormalize roundtrip is stable`() {
val curves = listOf(
TimelineEditorState.ActiveCurve.VISUAL_RIGHT,
TimelineEditorState.ActiveCurve.AUDIO_LEFT,
TimelineEditorState.ActiveCurve.AUDIO_RIGHT,
)
for (c in curves) {
val n = 0.37f
val v = TimelineParameters.denormalize(c, n)
val n2 = TimelineParameters.normalize(c, v)
assertTrue("Expected normalized roundtrip close for $c but got $n2", kotlin.math.abs(n - n2) < 1e-3f)
}
}
@Test
fun `brightness percent helper stays in range`() {
assertEquals(0, TimelineParameters.brightnessPercentFromNormalized(0f))
assertEquals(100, TimelineParameters.brightnessPercentFromNormalized(1f))
val mid = TimelineParameters.brightnessPercentFromNormalized(0.5f)
assertTrue(mid in 1..99)
}
}