Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637
  1. using NUnit.Framework;
  2. using UnityEditor;
  3. using UnityEditor.SceneManagement;
  4. using UnityEngine.SceneManagement;
  5. namespace TMPro
  6. {
  7. public class TMP_ControlTests
  8. {
  9. Scene scene;
  10. [SetUp]
  11. public void Setup()
  12. {
  13. // Create a new scene and open it
  14. scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene);
  15. }
  16. [TestCase("GameObject/UI/Dropdown - TextMeshPro")]
  17. [TestCase("GameObject/UI/Button - TextMeshPro")]
  18. [TestCase("GameObject/UI/Input Field - TextMeshPro")]
  19. [TestCase("GameObject/UI/Text - TextMeshPro")]
  20. public void TMPControlCreationAndUndoTest(string menuItem)
  21. {
  22. Assert.AreEqual(0, scene.rootCount);
  23. EditorApplication.ExecuteMenuItem(menuItem);
  24. // After creating a TMP control, objects in the scene should be Canvas, EventSystem, and the TMP control
  25. Assert.AreEqual(2, scene.rootCount);
  26. Undo.PerformUndo();
  27. // After undoing, the scene should be back to its original state
  28. Assert.AreEqual(0, scene.rootCount);
  29. }
  30. }
  31. }