summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-04-19 17:19:32 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-04-19 17:19:32 -0400
commitc55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 (patch)
treeee4d51c7c1d633e11f46453ef1edd3c77c4ef9f7 /Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs
downloadProject-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.gz
Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.bz2
Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.zip
Inital commit
Diffstat (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs')
-rw-r--r--Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs
new file mode 100644
index 0000000..e1ad8c7
--- /dev/null
+++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections;
+using UnityEditor;
+
+namespace UnityEngine.TestTools
+{
+ public class EnterPlayMode : IEditModeTestYieldInstruction
+ {
+ public bool ExpectDomainReload { get; }
+ public bool ExpectedPlaymodeState { get; private set; }
+
+ public EnterPlayMode(bool expectDomainReload = true)
+ {
+ ExpectDomainReload = expectDomainReload;
+ }
+
+ public IEnumerator Perform()
+ {
+ if (EditorApplication.isPlaying)
+ {
+ throw new Exception("Editor is already in PlayMode");
+ }
+ if (EditorUtility.scriptCompilationFailed)
+ {
+ throw new Exception("Script compilation failed");
+ }
+ yield return null;
+ ExpectedPlaymodeState = true;
+
+ EditorApplication.UnlockReloadAssemblies();
+ EditorApplication.isPlaying = true;
+
+ while (!EditorApplication.isPlaying)
+ {
+ yield return null;
+ }
+ }
+ }
+}