modular-avatar/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.cs
bd_ f99930999e
fix: compatibility break with animator defaults (#686)
Changes in 1.9.0 broke existing avatars that used animators with
different default values than the MA Parameters fields. This change
makes overriding the animator defaults require an explicit configuration;
this is technically a change which would require a minor version bump,
but as this is addressing a major-version-level compatibility break in 1.9.0,
we're going to push this out at a minor version this time.
2024-02-21 20:40:31 +09:00

38 lines
1.1 KiB
C#

using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using modular_avatar_tests;
using nadena.dev.modular_avatar.core;
using nadena.dev.ndmf;
using NUnit.Framework;
using UnityEditor.Animations;
using UnityEngine;
using VRC.SDK3.Avatars.Components;
using AvatarProcessor = nadena.dev.modular_avatar.core.editor.AvatarProcessor;
public class PreexistingParamsTest : TestBase
{
[Test]
public void TestPreexistingParameterOverwritePolicy()
{
var prefab = CreatePrefab("PreexistingParamsTest.prefab");
AvatarProcessor.ProcessAvatar(prefab);
var parameters = ((AnimatorController)FindFxController(prefab).animatorController).parameters;
var paramDict = parameters.ToImmutableDictionary(p => p.name, p => p.defaultInt);
foreach (var kvp in paramDict)
{
if (kvp.Key == "default_override" || kvp.Key == "animator_only")
{
Assert.AreEqual(1, kvp.Value);
}
else
{
Assert.AreEqual(11, kvp.Value);
}
}
}
}