Files
baji-vc/tests/avatar/AvatarCheck.kt
T

61 lines
3.1 KiB
Kotlin

import com.gorios.lanvoice.avatar.*
import com.gorios.lanvoice.audio.PlaybackActivity
import com.gorios.lanvoice.dialogue.*
import android.content.Context
import android.media.MediaPlayer
import android.view.TextureView
fun main() {
dynamicBodyCheck()
actionCheck()
emotionActionCheck()
conversationPackageCheck()
actualMediaViewCheck()
mediaBoundaryCheck()
idleVariantCheck()
fullActionGraphCheck()
checkContinuous()
checkEngineering()
checkSafeDriver()
checkCodecPort()
checkAutoConversation()
checkSafePlanner()
checkSafetyManifest()
val unannotated = AvatarVideoView(Context(),AvatarPack("idle.mp4","talk.mp4","static.png","waiting.png"))
unannotated.render(AvatarMode.IDLE,true); unannotated.render(AvatarMode.TALK,true)
check(MediaPlayer.created.isEmpty()) // no implicit hard-cut path for unreviewed metadata
unannotated.dispose()
val controller = AvatarController()
for (emotion in RoleEmotion.entries) for (intensity in if (emotion == RoleEmotion.NEUTRAL) listOf(0) else listOf(1,2)) {
val request = ReplyEmotion(emotion, intensity, EmotionSource.MODEL,7L,2)
val selected = controller.select(true,request,PlaybackActivity(7,3,true,960,1920))
check(selected.desiredMode == AvatarMode.TALK && selected.requestedEmotion == request)
check(selected.resolvedAssetEmotion == AssetEmotion())
check(selected.emotionFallback == (emotion != RoleEmotion.NEUTRAL))
check(controller.select(false,request,PlaybackActivity(7,3,true,960,1920)).desiredMode == AvatarMode.WAITING)
check(controller.select(true,request,PlaybackActivity(6,2,true,960,1920)).desiredMode == AvatarMode.IDLE)
check(controller.select(true,request,null).desiredMode == AvatarMode.IDLE)
}
val call = CallIntent()
check(!call.consumeStart(true,true,true))
check(call.dial(false,false) && !call.dial(false,false))
check(!call.consumeStart(true,true,false))
call.background(); check(call.pending)
call.cancel(); call.permissionResult(true)
check(!call.consumeStart(true,true,true)) // canceled permission cannot resurrect a call
check(call.dial(false,false)); call.permissionResult(false); check(!call.pending)
check(call.dial(false,true)); check(!call.consumeStart(true,false,true))
check(!call.consumeStart(false,true,true)); check(call.consumeStart(true,true,true))
check(!call.consumeStart(true,true,true))
call.resumeAfterCameraPermission(true); call.background(true)
check(call.consumeStart(true,true,true))
check(call.dial(false,true)); call.background(); check(!call.pending)
val still = AvatarVideoView(Context(),AvatarPack(fallback="standing.png"))
still.render(AvatarMode.TALK,true,5,1)
check(MediaPlayer.created.isEmpty()) // metadata absence cannot activate arbitrary switching
still.render(AvatarMode.IDLE,false); still.dispose()
AvatarVideoView(Context(),null).render(AvatarMode.TALK,true)
println("PASS: seven requested labels preserved/neutral resolved fallback, old-turn fence; explicit dial/permission/cancel/background; static standing view/missing graph never allocates legacy players")
}