2024-10-28 01:06:35 +08:00
|
|
|
|
#if MA_VRCSDK3_AVATARS
|
|
|
|
|
|
|
|
|
|
using System.Linq;
|
2024-10-20 08:15:23 +08:00
|
|
|
|
using modular_avatar_tests;
|
|
|
|
|
using nadena.dev.modular_avatar.core;
|
|
|
|
|
using nadena.dev.modular_avatar.core.editor;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using UnityEditor.Animations;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace UnitTests.ReactiveComponent
|
|
|
|
|
{
|
|
|
|
|
internal class ObjectToggleTests : TestBase
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
2025-02-17 14:25:12 +08:00
|
|
|
|
public void WhenObjectIsAlwaysOn_CorrectObjectStateIsSelected()
|
2024-10-20 08:15:23 +08:00
|
|
|
|
{
|
|
|
|
|
var root = CreateRoot("root");
|
|
|
|
|
var obj = CreateChild(root, "obj");
|
|
|
|
|
var toggle = CreateChild(root, "toggle");
|
|
|
|
|
|
|
|
|
|
// Prevent obj from being removed by the GC game objects pass
|
|
|
|
|
obj.AddComponent<MeshRenderer>();
|
|
|
|
|
|
|
|
|
|
var toggleComponent = toggle.AddComponent<ModularAvatarObjectToggle>();
|
|
|
|
|
var aor = new AvatarObjectReference();
|
|
|
|
|
aor.Set(obj);
|
|
|
|
|
|
|
|
|
|
toggleComponent.Objects = new()
|
|
|
|
|
{
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
Active = false,
|
|
|
|
|
Object = aor
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
AvatarProcessor.ProcessAvatar(root);
|
|
|
|
|
|
|
|
|
|
Assert.IsFalse(obj.activeSelf);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-28 01:06:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|