31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using NUnit.Framework;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
public sealed class MatchWaitingPrefabLayoutTests
|
|
{
|
|
private const string PrefabPath = "Assets/Game/Art/UI/Prefab/UI_MatchWaiting.prefab";
|
|
|
|
[Test]
|
|
public void WaitingPanel_IsCenteredInSafeArea()
|
|
{
|
|
GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject>(PrefabPath);
|
|
Assert.That(prefab, Is.Not.Null);
|
|
|
|
RectTransform root = prefab.GetComponent<RectTransform>();
|
|
Assert.That(root.anchorMin, Is.EqualTo(Vector2.zero));
|
|
Assert.That(root.anchorMax, Is.EqualTo(Vector2.one));
|
|
Assert.That(root.anchoredPosition, Is.EqualTo(Vector2.zero));
|
|
Assert.That(root.sizeDelta, Is.EqualTo(Vector2.zero));
|
|
|
|
Transform panel = prefab.transform.Find("SafeArea/Panel_Waiting");
|
|
Assert.That(panel, Is.Not.Null);
|
|
|
|
RectTransform rect = panel.GetComponent<RectTransform>();
|
|
Assert.That(rect.anchorMin, Is.EqualTo(new Vector2(0.5f, 0.5f)));
|
|
Assert.That(rect.anchorMax, Is.EqualTo(new Vector2(0.5f, 0.5f)));
|
|
Assert.That(rect.pivot, Is.EqualTo(new Vector2(0.5f, 0.5f)));
|
|
Assert.That(rect.anchoredPosition, Is.EqualTo(Vector2.zero));
|
|
}
|
|
}
|