MVP for step mounting in gui

This commit is contained in:
loucass003 committed 2026-10-02 04:05:25 +02:00
1 parent 470e8c37c7
commit 0ef2a782a6
55 files changed
+1537 -839

No files matched your search

@@ -83,4 +83,18 @@ class ResetsTest {
assertEquals(ResetAvailability.NO_TRACKERS, resets.availability(ResetType.YAW))
assertEquals(ResetAvailability.NO_TRACKERS, resets.availability(ResetType.MOUNTING))
}
@Test
fun `a mounting reset is ignored until a mounting method is picked`() = runTest {
val server = buildTestVrServer(backgroundScope)
val settings = buildTestSettings(backgroundScope)
val resets = buildTestResetsManager(server, settings, backgroundScope)
val tracker = buildTestTracker(server.context.scope, buildTestAppContext(server), settings, id = 1, bodyPart = BodyPart.HIP, status = TrackerStatus.OK)
server.context.dispatch(VRServerActions.NewTracker(1, tracker))
resets.context.dispatch(ResetsActions.EndReset(ResetType.FULL))
resets.scheduleReset("test", ResetType.MOUNTING)
runCurrent()
assertEquals(null, resets.context.state.value.status)
}
}
@@ -58,8 +58,10 @@ class TrackingChecklistTest {
.stateIn(scope.backgroundScope, SharingStarted.Eagerly, initialValue = emptyList())
init {
setMountingMethod(MountingMethod.POSE)
checklist.context.behaviours.addAll(
listOf(
MountingMethodCheckBehaviour(settings),
ReliableReferenceCheckBehaviour(trackerStates),
TrackerRestCheckBehaviour(trackerStates),
TrackerErrorCheckBehaviour(trackerStates),
@@ -227,6 +229,25 @@ class TrackingChecklistTest {
assertEquals(false, h.step(TrackingChecklistStepId.MOUNTING_CALIBRATION).valid)
}
@Test
fun `a mounting method is asked for until one is picked`() = runTest {
val h = Harness(this)
h.settings.context.dispatch(SettingsActions.Update { copy(resetsConfig = resetsConfig.copy(mountingMethod = MountingMethod.UNKNOWN)) })
h.addTracker(bodyPart = BodyPart.LOWER_CHEST)
h.addTracker(bodyPart = BodyPart.LEFT_FOOT)
runCurrent()
assertEquals(true, h.step(TrackingChecklistStepId.MOUNTING_METHOD).enabled)
assertEquals(false, h.step(TrackingChecklistStepId.MOUNTING_METHOD).valid)
assertEquals(false, h.step(TrackingChecklistStepId.MOUNTING_CALIBRATION).enabled)
assertEquals(false, h.step(TrackingChecklistStepId.FEET_MOUNTING_CALIBRATION).enabled)
h.setMountingMethod(MountingMethod.POSE)
runCurrent()
assertEquals(false, h.step(TrackingChecklistStepId.MOUNTING_METHOD).enabled)
assertEquals(true, h.step(TrackingChecklistStepId.MOUNTING_CALIBRATION).enabled)
}
@Test
fun `a step mounting calibrates the feet too`() = runTest {
val h = Harness(this)