using System.Collections.Generic;
using NUnit.Framework;
using Unity.Mathematics;
using UnityEngine;
namespace jeanf.scenemanagement.Tests
{
/// Stand-in for SteamAudio's component: the sweep matches it by TYPE NAME (the
/// package has no SteamAudio dependency), so a same-named local class is the real contract.
public class SteamAudioDynamicObject : MonoBehaviour { }
///
/// Locks the two pure parts of hybrid prefab spawning: the sweep (which subtrees leave the
/// baked world and get respawned — get it wrong and audio/UI silently vanish or exist twice)
/// and the pose/scale rule (composing in sweep mode double-applies the subtree root's local
/// TRS, replacing in marker mode loses the prefab's authored scale).
///
public class HybridPrefabScaleTests
{
private const float Tolerance = 1e-3f;
private readonly List _spawned = new List();
private GameObject New(string name, Transform parent = null)
{
var go = new GameObject(name);
if (parent != null) go.transform.SetParent(parent, false);
if (parent == null) _spawned.Add(go);
return go;
}
[TearDown]
public void TearDown()
{
foreach (var go in _spawned)
if (go != null) Object.DestroyImmediate(go);
_spawned.Clear();
}
private static void AssertApproximately(Vector3 expected, Vector3 actual, string label)
{
Assert.That(Vector3.Distance(expected, actual), Is.LessThan(Tolerance),
$"{label}: expected {expected}, got {actual}");
}
// ---- sweep ----
private HybridPrefabAuthoring BuildElevatorLike(out Transform audio, out Transform ui, out Transform cage)
{
var root = New("Elevator");
var authoring = root.AddComponent();
cage = New("ElevatorCage", root.transform).transform;
cage.gameObject.AddComponent();
var doors = New("ElevatorDoors", root.transform).transform;
New("Door_Right", doors).AddComponent();
audio = New("ElevatorAudioAmbiance", root.transform).transform;
New("AudioSource_ACVent", audio).AddComponent();
ui = New("ElevatorUI", root.transform).transform;
New("CanvasRoot", ui).AddComponent