Skip to content
Snippets Groups Projects
Commit 5a082f6b authored by Kai Biermeier's avatar Kai Biermeier
Browse files

Merge branch 'feature/test_uiv2' into 'develop'

Feature/test uiv2

See merge request skrings/varobotprojectgroup!37
parents 6739b779 7718fbf9
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_IndirectSpecularColor: {r: 0.44657868, g: 0.49641263, b: 0.5748171, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
......@@ -4202,6 +4202,30 @@ GameObject:
type: 3}
m_PrefabInstance: {fileID: 144441167}
m_PrefabAsset: {fileID: 0}
--- !u!1 &144441188 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6692587530742083234, guid: 069cdf7c0a7ea474c918343c0343cc86,
type: 3}
m_PrefabInstance: {fileID: 144441167}
m_PrefabAsset: {fileID: 0}
--- !u!1 &144441189 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1186295300589225987, guid: 069cdf7c0a7ea474c918343c0343cc86,
type: 3}
m_PrefabInstance: {fileID: 144441167}
m_PrefabAsset: {fileID: 0}
--- !u!1 &144441190 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 3370187928065975173, guid: 069cdf7c0a7ea474c918343c0343cc86,
type: 3}
m_PrefabInstance: {fileID: 144441167}
m_PrefabAsset: {fileID: 0}
--- !u!1 &144441191 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6692587529518248386, guid: 069cdf7c0a7ea474c918343c0343cc86,
type: 3}
m_PrefabInstance: {fileID: 144441167}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &146598904
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -16242,8 +16266,8 @@ Camera:
m_GameObject: {fileID: 1371337042}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_ClearFlags: 1
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
......@@ -16257,7 +16281,7 @@ Camera:
width: 1
height: 1
near clip plane: 0.1
far clip plane: 50
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
......@@ -22114,6 +22138,13 @@ MonoBehaviour:
- {fileID: 919676792}
- {fileID: 144441186}
- {fileID: 144441187}
- {fileID: 144441191}
- {fileID: 1609685945}
- {fileID: 144441190}
- {fileID: 144441189}
- {fileID: 144441188}
- {fileID: 1923218422}
- {fileID: 294295796}
--- !u!4 &1995007756
Transform:
m_ObjectHideFlags: 0
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
using UnityEngine.UI;
using System.Text;
using System.Text.RegularExpressions;
public class BasicUITests
{
[UnityTest]
public IEnumerator SpawnCubeTest() { // both for spawning and despawning cubes
// PRE
yield return SceneManager.LoadSceneAsync(1);
GameObject TestRefManInstance = GameObject.Find("TestReferenceManager");
TestReferenceManager TestRefManInstanceC = TestRefManInstance.GetComponent<TestReferenceManager>();
//Spawn button
var SpawnBtn = TestRefManInstanceC.arrReferences[23]; //ModifiedUI/Canvas/Menu_OtherTools/Viewport/Content/SpawnCube
Assert.NotNull(SpawnBtn, "Spawn Cube Button should exist");
var SpawnBtnC = SpawnBtn.GetComponent<Button>();
Assert.NotNull(SpawnBtnC, "Spawn Cube Button should be a button");
//Despawn button
var DeSpawnBtn = TestRefManInstanceC.arrReferences[25]; //ModifiedUI/Canvas/Menu_Control/Control_Despawn
Assert.NotNull(DeSpawnBtn, "Despawn Cube Button should exist");
var DeSpawnBtnC = DeSpawnBtn.GetComponent<Button>();
Assert.NotNull(DeSpawnBtnC, "Despawn Cube Button should be a button");
var cubeParent = TestRefManInstanceC.arrReferences[24]; //DoBotContainer/scenario/GeneratedCubes
Assert.NotNull(cubeParent, "Spawn Cube parent should exist");
var cubeCount = cubeParent.transform.childCount;
yield return new WaitForDomainReload();
yield return new WaitForSeconds(15);
// TC Spawn Cube
EventSystem.current.SetSelectedGameObject(SpawnBtn);
SpawnBtnC.onClick.Invoke();
yield return new WaitForDomainReload();
yield return new WaitForSeconds(30);
// POST Spawn Cube
var spawnCubeCount = cubeParent.transform.childCount;
var increasedCubeCount = cubeCount+1;
Assert.True(increasedCubeCount == spawnCubeCount, "Cube should be spawned");
yield return new WaitForDomainReload();
yield return new WaitForSeconds(8);
// TC Despawn Cube
LogAssert.Expect(LogType.Log,new Regex("Received DeleteModelResponse - statusMessage: DeleteModel: successfully deleted model success: True+"));
EventSystem.current.SetSelectedGameObject(DeSpawnBtn);
DeSpawnBtnC.onClick.Invoke();
yield return new WaitForDomainReload();
yield return new WaitForSeconds(8);
// POST Despawn Cube
var despawnCubeCount = cubeParent.transform.childCount;
}
[UnityTest]
public IEnumerator ProfilerTest() { //test visibility of the Profiler
// PRE
yield return SceneManager.LoadSceneAsync(1);
GameObject TestRefManInstance = GameObject.Find("TestReferenceManager");
TestReferenceManager TestRefManInstanceC = TestRefManInstance.GetComponent<TestReferenceManager>();
var ProfilerBtn = TestRefManInstanceC.arrReferences[26]; //ModifiedUI/Canvas/Menu_ToggleFeatures/Viewport/Content/Profiler
yield return new WaitForDomainReload();
yield return new WaitForSeconds(8); //wait to generate the dynamic game object profiler in the scene
Assert.NotNull(ProfilerBtn, "Profiler Button should exist");
var ProfilerBtnC = ProfilerBtn.GetComponent<Button>();
Assert.NotNull(ProfilerBtnC, "Profiler Button should be a button");
var mixedRealityPlaySpace = GameObject.Find("MixedRealityPlayspace");
var diagnostics = mixedRealityPlaySpace.transform.GetChild(1);
var ProfilerUI = diagnostics.transform.GetChild(0);
yield return new WaitForDomainReload();
yield return new WaitForSeconds(8);
Assert.IsInstanceOf<Transform>(ProfilerUI); //dynamically generated objects are of type Transform and not Game Object
// TC Profiler disappearance
EventSystem.current.SetSelectedGameObject(ProfilerBtn);
ProfilerBtnC.onClick.Invoke();
yield return new WaitForDomainReload();
yield return new WaitForSeconds(8);
yield return new WaitForDomainReload();
yield return new WaitForSeconds(8);
// TC Profiler appearance
ProfilerBtnC.onClick.Invoke();
yield return new WaitForDomainReload();
yield return new WaitForSeconds(10);
}
[UnityTest]
public IEnumerator SphereResetTest() { //TC for OtherTools -> Sphere Reset button
// PRE
yield return SceneManager.LoadSceneAsync(1);
GameObject TestRefManInstance = GameObject.Find("TestReferenceManager");
TestReferenceManager TestRefManInstanceC = TestRefManInstance.GetComponent<TestReferenceManager>();
var SphereResetBtn = TestRefManInstanceC.arrReferences[27]; //ModifiedUI/Canvas/Menu_OtherTools/Viewport/Content/SphereReset
yield return new WaitForDomainReload();
yield return new WaitForSeconds(8); //wait to generate the dynamic game object in the scene
Assert.NotNull(SphereResetBtn, "Sphere Reset Button should exist");
var SphereResetBtnC = SphereResetBtn.GetComponent<Button>();
Assert.NotNull(SphereResetBtnC, "Sphere Reset Button should be a button");
var TargetSphere = TestRefManInstanceC.arrReferences[28]; //DoBotContainer/scenario/world/Dobot_Loader/TargetSphereContainer/RealTargetSphere
Assert.NotNull(TargetSphere, "Target Sphere should exist");
//TC: whether the target sphere gets reset
var SphereCoord = TestRefManInstanceC.arrReferences[29]; //DoBotContainer/scenario/world/Dobot_Loader/TargetSphereContainer/RealTargetSphere/ROSCoords
var SphereCoordC = SphereCoord.GetComponent<Transform>();
EventSystem.current.SetSelectedGameObject(SphereResetBtn);
SphereResetBtnC.onClick.Invoke();
yield return new WaitForDomainReload();
yield return new WaitForSeconds(8);
int checkX = (int)SphereCoordC.position.x;
int checkY = (int)SphereCoordC.position.y;
int checkZ = (int)SphereCoordC.position.z;
//Assert.AreEqual(expectedValue, to be matched with, "String message in case of condition failure");
//The values below are world values returned from transform in the scene for SphereCoordC.
Assert.AreEqual(8, checkX, "Sphere is not reset in X position");
Assert.AreEqual(0, checkY, "Sphere is not reset in Y position");
Assert.AreEqual(-22, checkZ, "Sphere is not reset in Z position");
}
}
fileFormatVersion: 2
guid: f578ae38057994d17868779e5fe32845
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment