54 lines
4.8 KiB
Kotlin
54 lines
4.8 KiB
Kotlin
import com.gorios.lanvoice.avatar.*
|
|
|
|
fun emotionActionCheck() {
|
|
val sha="b".repeat(64)
|
|
val runtime=continuousPack().let { old -> old.copy(apertureMode=true,patches=old.patches.map { patch ->
|
|
patch.copy(levels=List(5) { MouthPatchLevel(it,it/4f,"patches/${patch.frameIndex}-$it.png",sha) })
|
|
}) }
|
|
fun clip(audio: Boolean)=mapOf<String,Any?>("path" to "clips/bridge.mp4","sha256" to sha,"hasAudio" to audio,
|
|
"width" to 480,"height" to 848,"fpsNumerator" to 24,"fpsDenominator" to 1,"frameCount" to 48,"ptsUs" to List(48) { it*1_000_000L/24 },"durationUs" to 2_000_000L)
|
|
fun edge(id: String,from: String,to: String)=mapOf<String,Any?>("id" to id,"from" to from,"to" to to,
|
|
"fromPtsUs" to 4_000_000L,"toPtsUs" to 0L,"fromAnchor" to "A","toAnchor" to "A","fromFrame" to 96,"toFrame" to 0,"clip" to clip(false))
|
|
fun conversation(id: String)=mapOf<String,Any?>("id" to id,"emotion" to if(id=="neutral") "neutral" else "happy",
|
|
"visualIntensity" to if(id=="neutral") 0 else 1,"mouthBodySha256" to sha,
|
|
"runtimeManifest" to mapOf("path" to "$id/manifest.json","sha256" to sha),"entryAnchor" to "A","exitAnchor" to "A",
|
|
"legalExitFrames" to listOf(96),"loopEdge" to "$id-loop")
|
|
val edges=listOf(edge("neutral-loop","neutral","neutral"),edge("happy-loop","happy","happy"),
|
|
edge("in","neutral","happy"),edge("out","happy","neutral"))
|
|
val actions=listOf("asset_01","asset_02").map { mapOf<String,Any?>("id" to it,"kind" to "dance",
|
|
"mouthAllowed" to false,"disallowTALK" to true,"entryAnchor" to "A","returnAnchor" to "A",
|
|
"sourcePackageId" to "neutral","sourceFrame" to 96,"sourcePtsUs" to 4_000_000L,
|
|
"returnPackageId" to "neutral","returnFrame" to 0,"returnPtsUs" to 0L,
|
|
"clip" to clip(true),"audioEndUs" to 1_900_000L) }
|
|
val root=mapOf<String,Any?>("schemaVersion" to 2,"identityId" to "a01","packId" to "a01-expression-action-v1",
|
|
"fallbackPackageId" to "neutral","conversationPackages" to listOf(conversation("neutral"),conversation("happy")),
|
|
"edges" to edges,"actions" to actions)
|
|
fun read(data: Map<String,Any?>,pin: String=sha)=EmotionActionManifest.read(data,sha,pin) { _,hash -> if(hash==sha) runtime else null }
|
|
check(read(root)?.actionPack?.assets?.size==2)
|
|
check(read(root+("actions" to emptyList<Any>()))?.actionPack==null)
|
|
check(read(root,"a".repeat(64))==null)
|
|
check(read(root+("approved" to true),"")==null)
|
|
check(read(root+("conversationPackages" to listOf(conversation("neutral"),conversation("happy")+("mouthBodySha256" to "a".repeat(64)))))==null)
|
|
check(read(root+("edges" to edges.dropLast(1)))==null)
|
|
for(change in listOf(mapOf("mouthAllowed" to true),mapOf("disallowTALK" to false),mapOf("returnAnchor" to "B"),
|
|
mapOf("audioEndUs" to 2_000_001L),mapOf("clip" to clip(false)),mapOf("clip" to clip(true)+("path" to "../escape.mp4")))) {
|
|
check(read(root+("actions" to listOf(actions[0]+change,actions[1])))==null)
|
|
}
|
|
val pose=mapOf<String,Any?>("id" to "suit-adjust","kind" to "waiting_pose","mouthAllowed" to false,
|
|
"entryAnchor" to "A","returnAnchor" to "A","sourcePackageId" to "neutral","returnPackageId" to "neutral",
|
|
"sourceFrame" to 0,"returnFrame" to 0,"sourcePtsUs" to 0L,"returnPtsUs" to 0L,"clip" to clip(false))
|
|
val waiting=mapOf<String,Any?>("schemaVersion" to 1,"microphoneAllowed" to false,"ttsAllowed" to false,"mouthAllowed" to false,
|
|
"idlePackageId" to "neutral","talkPackageId" to "neutral","poses" to listOf(pose))
|
|
check(read(root+("waiting" to waiting))?.waiting?.poses?.single()?.id=="suit-adjust")
|
|
for(change in listOf(mapOf("microphoneAllowed" to true),mapOf("ttsAllowed" to true),mapOf("mouthAllowed" to true),
|
|
mapOf("talkPackageId" to "missing"),mapOf("idlePackageId" to "happy"),mapOf("poses" to listOf(pose,pose)),mapOf("poses" to emptyList<Any>())))
|
|
check(read(root+("waiting" to waiting+change))==null)
|
|
for(change in listOf(mapOf("sourceFrame" to 1),mapOf("returnPtsUs" to 1),mapOf("sourcePackageId" to "happy"),mapOf("mouthAllowed" to true),
|
|
mapOf("audioEndUs" to 1900000),mapOf("kind" to "dance"),mapOf("mouthRuntimeManifest" to mapOf("path" to "x")),
|
|
mapOf("clip" to clip(true)),mapOf("clip" to clip(false)+("width" to 720)),mapOf("clip" to clip(false)+("path" to "../wrong.mp4")),
|
|
mapOf("clip" to clip(false)+("ptsUs" to listOf(0L,0L)))))
|
|
check(read(root+("waiting" to waiting+("poses" to listOf(pose+change))))==null)
|
|
println("PASS: 19 production waiting contract admission/rejection assertions: silent body-only, strict pin/source-return0/PTS/shape/paths/unique IDs, no dance or fake mouths")
|
|
println("PASS: production v2 index exact external pin/own body-mouth SHA/runtime04/complete bridges/music bounds/no TALK, synthetic metadata only")
|
|
}
|