Make Grabbingtest scene load independent from build settings

This commit is contained in:
Pascal Serrarens 2022-02-02 17:32:11 +01:00
parent 7496bc6e2a
commit 88ac83ea46
2 changed files with 7 additions and 21 deletions

View File

@ -9,17 +9,18 @@ using NUnit.Framework;
namespace Passer.Humanoid { namespace Passer.Humanoid {
public class GrabbingTest { public class GrabbingTest {
public void Setup() { [UnitySetUp]
UnityEngine.SceneManagement.SceneManager.LoadScene("[Test]GrabbingHumanoid"); public IEnumerator Setup() {
//UnityEngine.SceneManagement.SceneManager.LoadScene("[Test]GrabbingHumanoid");
//UnityEngine.SceneManagement.SceneManager.LoadScene("Passer/Humanoid/Demo/Environments/ObjectTable_env", LoadSceneMode.Additive); //UnityEngine.SceneManagement.SceneManager.LoadScene("Passer/Humanoid/Demo/Environments/ObjectTable_env", LoadSceneMode.Additive);
UnityEditor.SceneManagement.EditorSceneManager.LoadSceneInPlayMode("Packages/HumanoidControl4_Free/Tests/Runtime/Grabbing/Scenes/[Test]GrabbingHumanoid.unity", new LoadSceneParameters(LoadSceneMode.Single));
yield return new WaitForSeconds(0.1F);
} }
[UnityTest] [UnityTest]
[Category("Grabbing")] [Category("Grabbing")]
public IEnumerator GrabStaticObject() { public IEnumerator GrabStaticObject() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>(); HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null); Assert.IsFalse(humanoid == null);
@ -63,9 +64,6 @@ namespace Passer.Humanoid {
[UnityTest] [UnityTest]
[Category("Grabbing")] [Category("Grabbing")]
public IEnumerator GrabStaticObjectHandle() { public IEnumerator GrabStaticObjectHandle() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>(); HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null); Assert.IsFalse(humanoid == null);
@ -112,9 +110,6 @@ namespace Passer.Humanoid {
[UnityTest] [UnityTest]
[Category("Grabbing")] [Category("Grabbing")]
public IEnumerator GrabHeavyObjectHandle() { public IEnumerator GrabHeavyObjectHandle() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>(); HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null); Assert.IsFalse(humanoid == null);
@ -162,9 +157,6 @@ namespace Passer.Humanoid {
[UnityTest] [UnityTest]
[Category("Grabbing")] [Category("Grabbing")]
public IEnumerator GrabRigidbody() { public IEnumerator GrabRigidbody() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>(); HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null); Assert.IsFalse(humanoid == null);
@ -213,9 +205,6 @@ namespace Passer.Humanoid {
[UnityTest] [UnityTest]
[Category("Grabbing")] [Category("Grabbing")]
public IEnumerator GrabRigidbodyHandle() { public IEnumerator GrabRigidbodyHandle() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>(); HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null); Assert.IsFalse(humanoid == null);
@ -263,9 +252,6 @@ namespace Passer.Humanoid {
[UnityTest] [UnityTest]
[Category("Grabbing")] [Category("Grabbing")]
public IEnumerator GrabKinematicRigidbodyWithPhysics() { public IEnumerator GrabKinematicRigidbodyWithPhysics() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>(); HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null); Assert.IsFalse(humanoid == null);

View File

@ -10,7 +10,7 @@ namespace Passer.Humanoid {
public class Sites_Test { public class Sites_Test {
[UnitySetUp] [UnitySetUp]
public IEnumerator Setup() { public IEnumerator Setup() {
Scene x = UnityEditor.SceneManagement.EditorSceneManager.LoadSceneInPlayMode("Packages/HumanoidControl4_Free/Tests/Runtime/Sites/[Test]HumanoidVisitor Desktop.unity", new LoadSceneParameters(LoadSceneMode.Single)); UnityEditor.SceneManagement.EditorSceneManager.LoadSceneInPlayMode("Packages/HumanoidControl4_Free/Tests/Runtime/Sites/[Test]HumanoidVisitor Desktop.unity", new LoadSceneParameters(LoadSceneMode.Single));
yield return new WaitForSeconds(0.1F); yield return new WaitForSeconds(0.1F);
} }