Added runtime tests

This commit is contained in:
Pascal Serrarens 2022-01-12 12:29:36 +01:00
parent 0ac54a38e1
commit 839a38a211
18 changed files with 21784 additions and 5085 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ff94049756253d94ca84d0d29a2dbe99
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

8
Tests/Runtime.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2c2d5b56e687065479b25d399d0d4b7e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5fcfdabdc0d7b7c4ea0fdaa92ebef004
folderAsset: yes
timeCreated: 1558946432
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,362 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
using System.Collections;
#if pHUMANOID4
using NUnit.Framework;
namespace Passer.Humanoid {
public class GrabbingTest {
public void Setup() {
UnityEngine.SceneManagement.SceneManager.LoadScene("[Test]GrabbingHumanoid");
//UnityEngine.SceneManagement.SceneManager.LoadScene("Passer/Humanoid/Demo/Environments/ObjectTable_env", LoadSceneMode.Additive);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabStaticObject() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
HandTarget hand = humanoid.rightHandTarget;
GameObject obj = GameObject.Find("StaticCube");
Assert.IsFalse(obj == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return humanoid.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
hand.Grab(obj, false);
Assert.AreEqual(null, hand.grabbedObject);
Assert.AreEqual(null, hand.grabSocket.attachedTransform);
Assert.AreEqual(null, hand.grabbedHandle);
Assert.AreEqual(null, hand.grabSocket.attachedHandle);
#endregion Grab
#region LetGo
hand.LetGo();
Assert.AreEqual(null, hand.grabbedObject);
Assert.AreEqual(null, hand.grabSocket.attachedTransform);
Assert.AreEqual(null, hand.grabbedHandle);
Assert.AreEqual(null, hand.grabSocket.attachedHandle);
#endregion Let Go
yield return new WaitForSeconds(1);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabStaticObjectHandle() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
HandTarget hand = humanoid.rightHandTarget;
GameObject obj = GameObject.Find("StaticCubeWithHandle");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsFalse(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return humanoid.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
hand.Grab(obj, false);
Assert.AreEqual(handle.gameObject, hand.grabbedObject);
Assert.AreEqual(handle.gameObject, hand.grabSocket.attachedTransform.gameObject);
Assert.AreEqual(handle, hand.grabbedHandle);
Assert.AreEqual(handle, hand.grabSocket.attachedHandle);
#endregion Grab
#region LetGo
hand.LetGo();
Assert.AreEqual(null, hand.grabbedObject);
Assert.AreEqual(null, hand.grabSocket.attachedTransform);
Assert.AreEqual(null, hand.grabbedHandle);
Assert.AreEqual(null, hand.grabSocket.attachedHandle);
#endregion Let Go
yield return new WaitForSeconds(1);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabHeavyObjectHandle() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
HandTarget hand = humanoid.rightHandTarget;
GameObject obj = GameObject.Find("HeavyCube");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsFalse(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return humanoid.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
hand.Grab(obj, false);
Assert.AreEqual(obj, hand.grabbedObject);
Assert.AreEqual(obj, hand.grabSocket.attachedTransform.gameObject);
Assert.AreEqual(handle, hand.grabbedHandle);
Assert.AreEqual(handle, hand.grabSocket.attachedHandle);
Assert.AreEqual(obj.transform.parent, hand.grabSocket.transform);
#endregion Grab
#region LetGo
hand.LetGo();
Assert.AreEqual(null, hand.grabbedObject);
Assert.AreEqual(null, hand.grabSocket.attachedTransform);
Assert.AreEqual(null, hand.grabbedHandle);
Assert.AreEqual(null, hand.grabSocket.attachedHandle);
#endregion Let Go
yield return new WaitForSeconds(1);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabRigidbody() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
HandTarget hand = humanoid.rightHandTarget;
GameObject obj = GameObject.Find("CubeRigidbody");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsTrue(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return humanoid.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
hand.Grab(obj, false);
Assert.AreEqual(obj, hand.grabbedObject);
Assert.AreEqual(null, hand.grabSocket.attachedTransform);
Assert.AreEqual(null, hand.grabbedHandle);
Assert.AreEqual(null, hand.grabSocket.attachedHandle);
Assert.AreEqual(obj.transform.parent, hand.handRigidbody.transform);
#endregion Grab
#region LetGo
hand.LetGo();
Assert.AreEqual(null, hand.grabbedObject);
Assert.AreEqual(null, hand.grabSocket.attachedTransform);
Assert.AreEqual(null, hand.grabbedHandle);
Assert.AreEqual(null, hand.grabSocket.attachedHandle);
#endregion Let Go
yield return new WaitForSeconds(1);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabRigidbodyHandle() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
HandTarget hand = humanoid.rightHandTarget;
GameObject obj = GameObject.Find("CubeWithHandle");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsFalse(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return humanoid.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
hand.Grab(obj, false);
Assert.AreEqual(obj, hand.grabbedObject);
Assert.AreEqual(obj, hand.grabSocket.attachedTransform.gameObject);
Assert.AreEqual(handle, hand.grabbedHandle);
Assert.AreEqual(handle, hand.grabSocket.attachedHandle);
Assert.AreEqual(obj.transform.parent, hand.grabSocket.transform);
#endregion Grab
#region LetGo
hand.LetGo();
Assert.AreEqual(null, hand.grabbedObject);
Assert.AreEqual(null, hand.grabSocket.attachedTransform);
Assert.AreEqual(null, hand.grabbedHandle);
Assert.AreEqual(null, hand.grabSocket.attachedHandle);
#endregion Let Go
yield return new WaitForSeconds(1);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabKinematicRigidbodyWithPhysics() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
HandTarget hand = humanoid.rightHandTarget;
GameObject obj = GameObject.Find("KinematicCube");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsFalse(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return humanoid.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
//GameObject grabbedObject = Grab(humanoid, obj);
//Assert.AreEqual(obj, grabbedObject);
hand.Grab(obj, false);
Assert.AreEqual(obj, hand.grabbedObject);
#endregion Grab
#region LetGo
hand.LetGo();
Assert.AreEqual(null, hand.grabbedObject);
Assert.AreEqual(null, hand.grabSocket.attachedTransform);
Assert.AreEqual(null, hand.grabbedHandle);
Assert.AreEqual(null, hand.grabSocket.attachedHandle);
#endregion Let Go
yield return new WaitForSeconds(1);
}
//[UnityTest]
//[Category("Grabbing")]
//public IEnumerator GrabMechanicalJoint() {
// Setup();
// yield return new WaitForSeconds(1);
// HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
// Assert.IsFalse(humanoid == null);
// HandTarget hand = humanoid.rightHandTarget;
// GameObject obj = GameObject.Find("MechanicalJointCube");
// Assert.IsFalse(obj == null);
// Handle handle = obj.GetComponentInChildren<Handle>();
// Assert.IsFalse(handle == null);
// SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
// Assert.IsFalse(location == null);
// #region Walk
// yield return humanoid.WalkTo(location.transform.position, location.transform.rotation);
// #endregion Walk
// #region Grab
// //GameObject grabbedObject = Grab(humanoid, obj);
// //Assert.AreEqual(obj, grabbedObject);
// hand.Grab(obj, false);
// Assert.AreEqual(obj, hand.grabbedObject);
// #endregion Grab
// #region LetGo
// hand.LetGo();
// Assert.AreEqual(null, hand.grabbedObject);
// Assert.AreEqual(null, hand.grabSocket.attachedTransform);
// Assert.AreEqual(null, hand.grabbedHandle);
// Assert.AreEqual(null, hand.grabSocket.attachedHandle);
// #endregion Let Go
// yield return new WaitForSeconds(1);
//}
}
}
#endif
#endif

View File

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

View File

@ -0,0 +1,349 @@
/*
#if UNITY_EDITOR
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
namespace Passer.Pawn {
public class GrabbingTest {
//static GrabbingTest() {
// EditorSceneManager.sceneOpened += SceneOpened;
//}
//private static void SceneOpened(Scene scene, OpenSceneMode mode) {
// if ((scene.name == "ObjectTable Pawn" ||
// scene.name == "ObjectTable Pawn VR" ||
// scene.name == "ObjectTable Humanoid") &&
// EditorSceneManager.loadedSceneCount == 1) {
// Debug.Log("Additive opening ObjectTable scene");
// EditorSceneManager.OpenScene("Assets/PawnControl/Demo/Environments/ObjectTable.unity", OpenSceneMode.Additive);
// }
//}
public void Setup() {
UnityEngine.SceneManagement.SceneManager.LoadSceneAsync("_TestCases/Grabbing/[Test]GrabbingPawn");
UnityEngine.SceneManagement.SceneManager.LoadSceneAsync("Passer/PawnControl/Demo/Environments/ObjectTable", LoadSceneMode.Additive);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabStaticObject() {
Debug.Log("[GrabbingPawnTest] GrabStaticObject");
//System.Console.WriteLine("[GrabbingPawnTest] GrabStaticObject");
Setup();
Debug.Log("[GrabbingPawnTest] GrabStaticObject - loading scene");
yield return new WaitForSeconds(1);
Debug.Log("[GrabbingPawnTest] GrabStaticObject - loaded scene");
PawnControl pawn = Object.FindObjectOfType<PawnControl>();
Assert.IsFalse(pawn == null);
GameObject obj = GameObject.Find("StaticCube");
Assert.IsFalse(obj == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
Debug.Log("[GrabbingPawnTest] GrabStaticObject - start walking");
#region Walk
yield return pawn.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
Debug.Log("[GrabbingPawnTest] GrabStaticObject - end walking, grabbing");
#region Grab
GameObject grabbedObject = Grab(pawn, obj);
Assert.IsTrue(grabbedObject == null);
#endregion Grab
Debug.Log("[GrabbingPawnTest] GrabStaticObject - grabbed, let go");
#region LetGo
grabbedObject = LetGo(pawn);
#endregion Let Go
Debug.Log("[GrabbingPawnTest] GrabStaticObject - let go complete");
yield return new WaitForSeconds(1);
System.Console.WriteLine("[GrabbingPawnTest] GrabStaticObject SUCCESS");
yield return null;
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabStaticObjectHandle() {
Setup();
yield return new WaitForSeconds(1);
PawnControl pawn = Object.FindObjectOfType<PawnControl>();
Assert.IsFalse(pawn == null);
GameObject obj = GameObject.Find("StaticCubeWithHandle");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsFalse(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return pawn.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
GameObject grabbedObject = Grab(pawn, obj);
Assert.AreEqual(handle.gameObject, grabbedObject);
#endregion Grab
#region LetGo
grabbedObject = LetGo(pawn);
#endregion Let Go
yield return new WaitForSeconds(1);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabHeavyObjectHandle() {
Setup();
yield return new WaitForSeconds(1);
PawnControl pawn = Object.FindObjectOfType<PawnControl>();
Assert.IsFalse(pawn == null);
GameObject obj = GameObject.Find("HeavyCube");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsFalse(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return pawn.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
GameObject grabbedObject = Grab(pawn, obj);
Assert.AreEqual(obj, grabbedObject);
#endregion Grab
#region LetGo
grabbedObject = LetGo(pawn);
#endregion Let Go
yield return new WaitForSeconds(1);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabRigidbody() {
Setup();
yield return new WaitForSeconds(1);
PawnControl pawn = Object.FindObjectOfType<PawnControl>();
Assert.IsFalse(pawn == null);
GameObject obj = GameObject.Find("CubeRigidbody");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsTrue(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return pawn.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
GameObject grabbedObject = Grab(pawn, obj);
Assert.AreEqual(obj, grabbedObject);
#endregion Grab
#region LetGo
grabbedObject = LetGo(pawn);
#endregion Let Go
yield return new WaitForSeconds(1);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabRigidbodyHandle() {
Setup();
yield return new WaitForSeconds(1);
PawnControl pawn = Object.FindObjectOfType<PawnControl>();
Assert.IsFalse(pawn == null);
PawnHand hand = pawn.rightHandTarget;
GameObject obj = GameObject.Find("CubeWithHandle");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsFalse(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return pawn.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
hand.Grab(obj, false);
Assert.AreEqual(obj, hand.grabbedObject);
Assert.AreEqual(obj, hand.grabSocket.attachedTransform.gameObject);
Assert.AreEqual(handle, hand.grabbedHandle);
Assert.AreEqual(handle, hand.grabSocket.attachedHandle);
Assert.AreEqual(obj.transform.parent, hand.grabSocket.transform);
#endregion Grab
#region LetGo
hand.LetGo();
Assert.AreEqual(null, hand.grabbedObject);
Assert.AreEqual(null, hand.grabSocket.attachedTransform);
Assert.AreEqual(null, hand.grabbedHandle);
Assert.AreEqual(null, hand.grabSocket.attachedHandle);
#endregion Let Go
yield return new WaitForSeconds(1);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabKinematicRigidbodyWithPhysics() {
Setup();
yield return new WaitForSeconds(1);
PawnControl pawn = Object.FindObjectOfType<PawnControl>();
Assert.IsFalse(pawn == null);
GameObject obj = GameObject.Find("KinematicCube");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsFalse(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return pawn.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
GameObject grabbedObject = Grab(pawn, obj);
Assert.AreEqual(obj, grabbedObject);
#endregion Grab
#region LetGo
grabbedObject = LetGo(pawn);
#endregion Let Go
yield return new WaitForSeconds(1);
}
[UnityTest]
[Category("Grabbing")]
public IEnumerator GrabMechanicalJoint() {
Setup();
yield return new WaitForSeconds(1);
PawnControl pawn = Object.FindObjectOfType<PawnControl>();
Assert.IsFalse(pawn == null);
GameObject obj = GameObject.Find("MechanicalJointCube");
Assert.IsFalse(obj == null);
Handle handle = obj.GetComponentInChildren<Handle>();
Assert.IsFalse(handle == null);
SpawnPoint location = obj.transform.parent.GetComponentInChildren<SpawnPoint>();
Assert.IsFalse(location == null);
#region Walk
yield return pawn.WalkTo(location.transform.position, location.transform.rotation);
#endregion Walk
#region Grab
GameObject grabbedObject = Grab(pawn, obj);
Assert.AreEqual(obj, grabbedObject);
#endregion Grab
#region LetGo
grabbedObject = LetGo(pawn);
#endregion Let Go
yield return new WaitForSeconds(1);
}
#region Tools
protected GameObject Grab(PawnControl pawn, GameObject obj) {
pawn.rightHandTarget.Grab(obj, false);
return pawn.rightHandTarget.grabbedObject;
}
protected GameObject LetGo(PawnControl pawn) {
pawn.rightHandTarget.LetGo();
return pawn.rightHandTarget.grabbedObject;
}
#endregion Tools
}
}
#endif
*/

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 29ea255a2b0c5524788f855308aacea9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 01d908cf642d4d14aaaabb5c2bcc9b6c
timeCreated: 1558946518
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
{
"name": "PasserVR.HumanoidControl.RuntimeTests",
"references": [
"GUID:27619889b8ba8c24980f49ee34dbb44a",
"GUID:2a4d79bf57ab5b3479378915b7996c30"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 42fbfae02a51adc488acfb17e7361974
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Tests/Runtime/Sites.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f136bcd3b9f4a1d459627d4d0a46b94d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,221 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
#if pHUMANOID4
using NUnit.Framework;
namespace Passer.Humanoid {
public class Sites_Test {
public void Setup() {
UnityEngine.SceneManagement.SceneManager.LoadScene("HumanoidControl/Runtime/Visitors/HumanoidVisitor Desktop");
}
[UnityTest]
[Category("Sites")]
public IEnumerator VisitShootingRange() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
SiteNavigator navigator = humanoid.GetComponentInChildren<SiteNavigator>();
Assert.IsFalse(navigator == null);
navigator.LoadSiteFromURL("serrarens.nl/sites/shootingrange");
yield return new WaitForSeconds(2);
int sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
Assert.AreEqual(1, sceneCount);
bool found = false;
for (int i = 0; i < sceneCount; i++) {
Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i);
if (scene.name == "ShootingRange")
found = true;
}
Assert.IsTrue(found);
yield return new WaitForSeconds(1);
// Destroy explicitly, because DontDestroyOnLoad is enabled
Object.Destroy(humanoid.gameObject);
yield return new WaitForSeconds(0.1F);
}
[UnityTest]
[Category("Sites")]
public IEnumerator VisitSocialSpace() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
SiteNavigator navigator = humanoid.GetComponentInChildren<SiteNavigator>();
Assert.IsFalse(navigator == null);
navigator.LoadSiteFromURL("serrarens.nl/sites/socialspace");
yield return new WaitForSeconds(2);
int sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
Assert.AreEqual(1, sceneCount);
bool found = false;
for (int i = 0; i < sceneCount; i++) {
Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i);
if (scene.name == "SocialSpace")
found = true;
}
Assert.IsTrue(found);
yield return new WaitForSeconds(1);
// Destroy explicitly, because DontDestroyOnLoad is enabled
Object.Destroy(humanoid.gameObject);
yield return new WaitForSeconds(0.1F);
}
[UnityTest]
[Category("Sites")]
public IEnumerator VisitAvatarShop() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
SiteNavigator navigator = humanoid.GetComponentInChildren<SiteNavigator>();
Assert.IsFalse(navigator == null);
navigator.LoadSiteFromURL("serrarens.nl/sites/avatarshop");
yield return new WaitForSeconds(2);
int sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
Assert.AreEqual(1, sceneCount);
bool found = false;
for (int i = 0; i < sceneCount; i++) {
Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i);
if (scene.name == "AvatarShop")
found = true;
}
Assert.IsTrue(found);
yield return new WaitForSeconds(1);
// Destroy explicitly, because DontDestroyOnLoad is enabled
Debug.Log("Destroying humanoid gameObject");
Object.Destroy(humanoid.gameObject);
yield return new WaitForSeconds(0.1F);
}
[UnityTest]
[Category("Sites")]
public IEnumerator VisitGroceryStore() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
SiteNavigator navigator = humanoid.GetComponentInChildren<SiteNavigator>();
Assert.IsFalse(navigator == null);
navigator.LoadSiteFromURL("serrarens.nl/sites/grocerystore");
yield return new WaitForSeconds(2);
int sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
Assert.AreEqual(1, sceneCount);
bool found = false;
for (int i = 0; i < sceneCount; i++) {
Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i);
if (scene.name == "GroceryStore")
found = true;
}
Assert.IsTrue(found);
yield return new WaitForSeconds(1);
// Destroy explicitly, because DontDestroyOnLoad is enabled
Object.Destroy(humanoid.gameObject);
yield return new WaitForSeconds(0.1F);
}
[UnityTest]
[Category("Sites")]
public IEnumerator VisitTour() {
Setup();
yield return new WaitForSeconds(1);
HumanoidControl humanoid = Object.FindObjectOfType<HumanoidControl>();
Assert.IsFalse(humanoid == null);
SiteNavigator navigator = humanoid.GetComponentInChildren<SiteNavigator>();
Assert.IsFalse(navigator == null);
navigator.LoadSiteFromURL("serrarens.nl/sites/shootingrange");
yield return new WaitForSeconds(2);
int sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
Assert.AreEqual(1, sceneCount);
bool found = false;
for (int i = 0; i < sceneCount; i++) {
Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i);
if (scene.name == "ShootingRange")
found = true;
}
Assert.IsTrue(found);
navigator.LoadSiteFromURL("serrarens.nl/sites/socialspace");
yield return new WaitForSeconds(2);
sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
Assert.AreEqual(1, sceneCount);
found = false;
for (int i = 0; i < sceneCount; i++) {
Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i);
if (scene.name == "SocialSpace")
found = true;
}
Assert.IsTrue(found);
navigator.LoadSiteFromURL("serrarens.nl/sites/avatarshop");
yield return new WaitForSeconds(2);
sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
Assert.AreEqual(1, sceneCount);
found = false;
for (int i = 0; i < sceneCount; i++) {
Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i);
if (scene.name == "AvatarShop")
found = true;
}
Assert.IsTrue(found);
navigator.LoadSiteFromURL("serrarens.nl/sites/grocerystore");
yield return new WaitForSeconds(2);
sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
Assert.AreEqual(1, sceneCount);
found = false;
for (int i = 0; i < sceneCount; i++) {
Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i);
if (scene.name == "GroceryStore")
found = true;
}
Assert.IsTrue(found);
yield return new WaitForSeconds(1);
// Destroy explicitly, because DontDestroyOnLoad is enabled
Object.Destroy(humanoid.gameObject);
yield return new WaitForSeconds(0.1F);
}
}
}
#endif

View File

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