// Copyright (c) 2025 EFramework Innovation. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
using NUnit.Framework;
using EFramework.Unity.UIPlugin;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
///
/// TestUISpriteAnimationEditor 是 UISpriteAnimationEditor 的单元测试。
///
public class TestUISpriteAnimationEditor
{
[Test]
public void Create()
{
// 执行菜单操作创建Sprite Animation
EditorApplication.ExecuteMenuItem("GameObject/UI/Sprite Animation");
// 验证结果
var createdObject = Selection.activeGameObject;
Assert.That(createdObject, Is.Not.Null, "应当创建新的游戏对象");
Assert.That(createdObject.name, Is.EqualTo("Sprite Animation"), "游戏对象名称应为'Sprite Animation'");
// 验证组件
var spriteAnimation = createdObject.GetComponent();
Assert.That(spriteAnimation, Is.Not.Null, "应当添加UISpriteAnimation组件");
var image = createdObject.GetComponent();
Assert.That(image, Is.Not.Null, "应当包含Image组件");
// 清理
if (createdObject != null) GameObject.DestroyImmediate(createdObject);
}
}