暫無描述
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.

NavigationPresenceInMenus.cs 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.Collections.Generic;
  2. using NUnit.Framework;
  3. using UnityEditor;
  4. using UnityEngine;
  5. namespace Unity.AI.Navigation.Editor.Tests
  6. {
  7. [TestFixture]
  8. [Description("Verifies that the desired Navigation editor menus are accessible with the package.")]
  9. public class NavigationPresenceInMenus
  10. {
  11. GameObject m_ComponentsReceiver;
  12. [OneTimeSetUp]
  13. public void OneTimeSetUp()
  14. {
  15. // Create an empty game object and select it in order for components menus to be available
  16. m_ComponentsReceiver = new GameObject("ComponentsReceiver");
  17. Selection.activeObject = m_ComponentsReceiver;
  18. }
  19. static IEnumerable<string> NavigationMenuItemProvider()
  20. {
  21. yield return "Component/Navigation/Nav Mesh Agent";
  22. yield return "Component/Navigation/Nav Mesh Obstacle";
  23. yield return "Component/Navigation/NavMeshSurface";
  24. yield return "Component/Navigation/NavMeshModifierVolume";
  25. yield return "Component/Navigation/NavMeshModifier";
  26. yield return "Component/Navigation/NavMeshLink";
  27. yield return "Window/AI/Navigation";
  28. }
  29. [Test]
  30. [TestCaseSource(nameof(NavigationMenuItemProvider))]
  31. public void MenuIsEnabled(string menuPath)
  32. {
  33. var menuEnabled = Menu.GetEnabled(menuPath);
  34. Assert.That(menuEnabled, Is.True, $"Navigation component menu '{menuPath}' should be available");
  35. }
  36. [OneTimeTearDown]
  37. public void OneTimeTearDown()
  38. {
  39. Object.DestroyImmediate(m_ComponentsReceiver);
  40. }
  41. }
  42. }