remove unused runtime SceneObjectSpawningTests

This commit is contained in:
vis2k 2021-08-07 19:31:29 +08:00
parent 99109076e4
commit 13c2a42a77
2 changed files with 0 additions and 84 deletions

View File

@ -1,73 +0,0 @@
using System.Collections;
using System.Text.RegularExpressions;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
namespace Mirror.Tests.Runtime
{
public class SceneObjectSpawningTests
{
const string ScenePath = "Assets/Mirror/Tests/Runtime/Scenes/SceneObjectSpawningTestsScene.unity";
readonly Regex errorMessage = new Regex(".*Don't call Instantiate for NetworkIdentities that were in the scene since the beginning \\(aka scene objects\\).*");
NetworkIdentity sceneObject;
[UnitySetUp]
public IEnumerator Setup()
{
// load scene
yield return EditorSceneManager.LoadSceneAsyncInPlayMode(ScenePath, new LoadSceneParameters { loadSceneMode = LoadSceneMode.Additive });
Scene scene = SceneManager.GetSceneByPath(ScenePath);
SceneManager.SetActiveScene(scene);
// wait for networkmanager to awake
yield return null;
NetworkManager.singleton.StartHost();
// wait for start host
yield return null;
sceneObject = GameObject.Find("SceneNetworkIdentity").GetComponent<NetworkIdentity>();
Debug.Assert(sceneObject != null, $"Could not find 'SceneNetworkIdentity' in Scene:{ScenePath}");
}
[UnityTearDown]
public IEnumerator TearDown()
{
NetworkManager.Shutdown();
// unload scene
Scene scene = SceneManager.GetSceneByPath(ScenePath);
yield return SceneManager.UnloadSceneAsync(scene);
}
//[UnityTest]
//public IEnumerator CallingInstantiateOnASceneObjectGivesAHelpfulError()
//{
// // make sure sceneobject has a sceneId
// Assert.That(sceneObject.sceneId, Is.Not.Zero);
// yield return null;
// LogAssert.Expect(LogType.Error, errorMessage);
// GameObject clone = GameObject.Instantiate(sceneObject.gameObject);
// NetworkServer.Spawn(clone);
//}
//[UnityTest]
//public IEnumerator CallingInstantiateOnASceneObjectMutlipleTimesGivesAHelpfulErrorEachTime()
//{
// // make sure sceneobject has a sceneId
// Assert.That(sceneObject.sceneId, Is.Not.Zero);
// yield return null;
// for (int i = 0; i < 5; i++)
// {
// LogAssert.Expect(LogType.Error, errorMessage);
// GameObject clone = GameObject.Instantiate(sceneObject.gameObject);
// NetworkServer.Spawn(clone);
// }
//}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a5922dcacabc9594591a0a328b735087
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: