Esempio n. 1
0
        public virtual void TearDown()
        {
            if (!m_Initialized)
            {
                return;
            }

            try
            {
                InputSystem.Restore();
                runtime.Dispose();

                // Unhook from play mode state changes.
                #if UNITY_EDITOR
                if (m_OnPlayModeStateChange != null)
                {
                    EditorApplication.playModeStateChanged -= m_OnPlayModeStateChange;
                }
                #endif

                // Re-enable input debugger.
                #if UNITY_EDITOR
                InputDebuggerWindow.Enable();
                #endif
            }
            catch (Exception exception)
            {
                Debug.LogError("Failed to shut down and restore input system after test " + TestContext.CurrentContext.Test.Name);
                Debug.LogException(exception);
                throw;
            }

            m_Initialized = false;
        }
Esempio n. 2
0
        public virtual void TearDown()
        {
            try
            {
                // Destroy any GameObject in the current scene that isn't hidden and isn't the
                // test runner object. Do this first so that any cleanup finds the system in the
                // state it expects.
                var scene = SceneManager.GetActiveScene();
                foreach (var go in scene.GetRootGameObjects())
                {
                    if (go.hideFlags != 0 || go.name.Contains("tests runner"))
                    {
                        continue;
                    }
                    Object.DestroyImmediate(go);
                }

                InputSystem.Restore();
                runtime.Dispose();

                // Re-enable input debugger.
                #if UNITY_EDITOR
                InputDebuggerWindow.Enable();
                #endif
            }
            catch (Exception exception)
            {
                Debug.LogError("Failed to shut down and restore input system after test " + TestContext.CurrentContext.Test.Name);
                Debug.LogException(exception);
                throw;
            }
        }
Esempio n. 3
0
        public virtual void TearDown()
        {
            if (!m_Initialized)
            {
                return;
            }

            try
            {
                // Destroy any GameObject in the current scene that isn't hidden and isn't the
                // test runner object. Do this first so that any cleanup finds the system in the
                // state it expects.
                var scene = SceneManager.GetActiveScene();
                foreach (var go in scene.GetRootGameObjects())
                {
                    if (go.hideFlags != 0 || go.name.Contains("tests runner"))
                    {
                        continue;
                    }
                    Object.DestroyImmediate(go);
                }

                InputSystem.Restore();
                runtime.Dispose();

                // Unhook from play mode state changes.
                #if UNITY_EDITOR
                if (m_OnPlayModeStateChange != null)
                {
                    EditorApplication.playModeStateChanged -= m_OnPlayModeStateChange;
                }
                #endif

                // Re-enable input debugger.
                #if UNITY_EDITOR
                InputDebuggerWindow.Enable();
                #endif
            }
            catch (Exception exception)
            {
                Debug.LogError("Failed to shut down and restore input system after test " + TestContext.CurrentContext.Test.Name);
                Debug.LogException(exception);
                throw;
            }

            m_Initialized = false;
        }