@@ -152,8 +152,8 @@ internal class LivenessStateTest {
152152 }
153153
154154 @Test
155- fun `beginning state is running ` () {
156- assertTrue(livenessState.livenessCheckState is LivenessCheckState .Running )
155+ fun `beginning state is initial ` () {
156+ assertTrue(livenessState.livenessCheckState is LivenessCheckState .Initial )
157157 }
158158
159159 @Test
@@ -263,9 +263,26 @@ internal class LivenessStateTest {
263263 }
264264
265265 @Test
266- fun `challenge runs after retrieving session info` () {
267- val faceLivenessSession = mockk<FaceLivenessSession >(relaxed = true )
266+ fun `challenge runs after retrieving session info and detected face far enough away` () {
267+ val faceTargetChallenge = mockk<FaceTargetChallenge >(relaxed = true )
268+ val challenges = listOf<FaceLivenessSessionChallenge >(faceTargetChallenge)
269+ every { faceTargetChallenge.faceTargetMatching.faceDistanceThresholdMin } returns 1f
270+ val faceLivenessSession = FaceLivenessSession (
271+ challengeId = " 12345" ,
272+ challengeType = FaceLivenessChallengeType .FaceMovementAndLightChallenge ,
273+ challenges = challenges,
274+ onVideoEvent = { },
275+ onChallengeResponseEvent = { },
276+ stopLivenessSession = { }
277+ )
268278 livenessState.onLivenessSessionReady(faceLivenessSession)
279+
280+ val faceRect = RectF (20f , 20f , 100f , 100f )
281+ val leftEye = FaceDetector .Landmark (25f , 40f )
282+ val rightEye = FaceDetector .Landmark (75f , 40f )
283+ val mouth = FaceDetector .Landmark (40f , 80f )
284+ livenessState.onFrameFaceUpdate(faceRect, leftEye, rightEye, mouth)
285+
269286 assertTrue(livenessState.livenessCheckState is LivenessCheckState .Running )
270287 assertTrue(livenessState.readyForOval)
271288 }
@@ -392,7 +409,7 @@ internal class LivenessStateTest {
392409 val rightEye = FaceDetector .Landmark (75f , 40f )
393410 val mouth = FaceDetector .Landmark (40f , 80f )
394411 livenessState.onFrameFaceUpdate(faceRect, leftEye, rightEye, mouth)
395- assertTrue(livenessState.livenessCheckState is LivenessCheckState .Running )
412+ assertTrue(livenessState.livenessCheckState is LivenessCheckState .Initial )
396413 }
397414
398415 @Test
0 commit comments