No Description
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.

TestScriptAssetMenuItems.cs 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. namespace UnityEditor.TestTools.TestRunner.GUI.TestAssets
  3. {
  4. /// <summary>
  5. /// The set of Menu Items dedicated to creating test assets: Test Scripts and Custom Test Assemblies.
  6. /// </summary>
  7. internal static class TestScriptAssetMenuItems
  8. {
  9. internal const string addNewFolderWithTestAssemblyDefinitionMenuItem = "Assets/Create/Testing/Tests Assembly Folder";
  10. internal const string addNewTestScriptMenuItem = "Assets/Create/Testing/C# Test Script";
  11. /// <summary>
  12. /// Adds a new folder asset and an associated Custom Test Assembly in the active folder path.
  13. /// </summary>
  14. [MenuItem(addNewFolderWithTestAssemblyDefinitionMenuItem, false, 83)]
  15. public static void AddNewFolderWithTestAssemblyDefinition()
  16. {
  17. TestScriptAssetsCreator.Instance.AddNewFolderWithTestAssemblyDefinition();
  18. }
  19. /// <summary>
  20. /// Checks if it is possible to add a new Custom Test Assembly inside the active folder path.
  21. /// </summary>
  22. /// <returns>False if the active folder path already contains a Custom Test Assembly; true otherwise.</returns>
  23. [MenuItem(addNewFolderWithTestAssemblyDefinitionMenuItem, true, 83)]
  24. public static bool CanAddNewFolderWithTestAssemblyDefinition()
  25. {
  26. var testAssemblyAlreadyExists = TestScriptAssetsCreator.Instance.ActiveFolderContainsTestAssemblyDefinition();
  27. return !testAssemblyAlreadyExists;
  28. }
  29. /// <summary>
  30. /// Adds a new Test Script asset in the active folder path.
  31. /// </summary>
  32. [MenuItem(addNewTestScriptMenuItem, false, 83)]
  33. public static void AddNewTestScript()
  34. {
  35. TestScriptAssetsCreator.Instance.AddNewTestScript();
  36. }
  37. /// <summary>
  38. /// Checks if it is possible to add a new Test Script in the active folder path.
  39. /// </summary>
  40. /// <returns>True if a Test Script can be compiled in the active folder path; false otherwise.</returns>
  41. [MenuItem(addNewTestScriptMenuItem, true, 83)]
  42. public static bool CanAddNewTestScript()
  43. {
  44. var testScriptWillCompile = TestScriptAssetsCreator.Instance.TestScriptWillCompileInActiveFolder();
  45. return testScriptWillCompile;
  46. }
  47. }
  48. }