Пример #1
0
        public override void Run()
        {
            if (launchedOutsideApi)
            {
                // Do not use the launcher, as it will be relaunched trough the api. See ctor.
                return;
            }

            IsRunning = true;

            SceneSetup[] previousSceneSetup;
            if (!OpenNewScene(out previousSceneSetup))
            {
                return;
            }

            var callback = AddEventHandler <EditModeRunnerCallback>();

            callback.previousSceneSetup = previousSceneSetup;
            callback.runner             = m_EditModeRunner;
            AddEventHandler <CallbacksDelegatorListener>();

            m_EditModeRunner.Run();
            AddEventHandler <BackgroundListener>();
            AddEventHandler <TestRunCallbackListener>();

            if (m_EditModeRunner.RunningSynchronously)
            {
                m_EditModeRunner.CompleteSynchronously();
            }
        }
Пример #2
0
        public override void Run()
        {
            // Give user chance to save the changes to their currently open scene because we close it and load our own
            var cancelled = !EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();

            if (cancelled)
            {
                return;
            }

            IsRunning = true;
            var exceptionThrown = ExecutePreBuildSetupMethods(m_EditModeRunner.GetLoadedTests(), m_EditModeRunner.GetFilter());

            if (exceptionThrown)
            {
                CallbacksDelegator.instance.RunFailed("Run Failed: One or more errors in a prebuild setup. See the editor log for details.");
                return;
            }

            var undoGroup = Undo.GetCurrentGroup();

            SceneSetup[] previousSceneSetup;
            if (!OpenNewScene(out previousSceneSetup))
            {
                return;
            }

            var callback = AddEventHandler <EditModeRunnerCallback>();

            callback.previousSceneSetup = previousSceneSetup;
            callback.undoGroup          = undoGroup;
            callback.runner             = m_EditModeRunner;
            AddEventHandler <CallbacksDelegatorListener>();

            m_EditModeRunner.Run();
            AddEventHandler <BackgroundListener>();
            AddEventHandler <TestRunCallbackListener>();

            if (m_EditModeRunner.RunningSynchronously)
            {
                m_EditModeRunner.CompleteSynchronously();
            }
        }
        public override void Run()
        {
            if (launchedOutsideApi)
            {
                // Do not use the launcher, as it will be relaunched trough the api. See ctor.
                return;
            }

            IsRunning = true;
            var exceptionThrown = ExecutePreBuildSetupMethods(m_EditModeRunner.GetLoadedTests(), m_EditModeRunner.GetFilter());

            if (exceptionThrown)
            {
                throw new Exception("Run Failed: One or more errors in a prebuild setup. See the editor log for details.");
            }

            var undoGroup = Undo.GetCurrentGroup();

            SceneSetup[] previousSceneSetup;
            if (!OpenNewScene(out previousSceneSetup))
            {
                return;
            }

            var callback = AddEventHandler <EditModeRunnerCallback>();

            callback.previousSceneSetup = previousSceneSetup;
            callback.undoGroup          = undoGroup;
            callback.runner             = m_EditModeRunner;
            AddEventHandler <CallbacksDelegatorListener>();

            m_EditModeRunner.Run();
            AddEventHandler <BackgroundListener>();
            AddEventHandler <TestRunCallbackListener>();

            if (m_EditModeRunner.RunningSynchronously)
            {
                m_EditModeRunner.CompleteSynchronously();
            }
        }