fix: time the HUD graph from the game's frames as shown on screen

This commit is contained in:
maxjivi05 authored and MaxsTechReview committed 2026-10-26 12:02:17 -04:00
1 parent eaaecf0661
commit 1f60e57749
6 files changed
+110 -30

No files matched your search

@@ -0,0 +1,18 @@
package com.droiddeck.launcher.session
import org.junit.Assert.assertArrayEquals
import org.junit.Assert.assertEquals
import org.junit.Test
class PerfHudGraphTest {
@Test fun theGraphShowsOnlyFramesFromThisHudRun() {
val samples = floatArrayOf(9f, 9f, 9f, 9f, 9f, 16.7f, 33.4f, 16.6f)
assertArrayEquals(floatArrayOf(16.7f, 33.4f, 16.6f), PerfHud.recent(samples, 105, 102), 0f)
assertEquals(0, PerfHud.recent(samples, 103, 102).size)
}
@Test fun anEarlySessionShowsWhatWasShownSoFar() {
val samples = floatArrayOf(16.6f, 16.7f, 120f, 0f, 0f, 0f)
assertArrayEquals(floatArrayOf(16.6f, 16.7f, 50f), PerfHud.recent(samples, 3, 0), 0f)
}
}