| | 1 | | using NUnit.Framework; |
| | 2 | | using System.Collections; |
| | 3 | | using DCL; |
| | 4 | | using DCL.Components; |
| | 5 | | using DCL.Controllers; |
| | 6 | | using DCL.Helpers; |
| | 7 | | using Newtonsoft.Json; |
| | 8 | | using UnityEngine; |
| | 9 | | using UnityEngine.TestTools; |
| | 10 | |
|
| | 11 | | namespace SceneBoundariesCheckerTests |
| | 12 | | { |
| | 13 | | public class SceneBoundariesCheckerTests_DebugMode : IntegrationTestSuite_Legacy |
| | 14 | | { |
| 0 | 15 | | protected override bool enableSceneIntegrityChecker => false; |
| 10 | 16 | | protected override bool justSceneSetUp => true; |
| | 17 | |
|
| | 18 | | protected override IEnumerator SetUp() |
| | 19 | | { |
| 10 | 20 | | yield return base.SetUp(); |
| | 21 | |
|
| 10 | 22 | | yield return SetUp_CharacterController(); |
| | 23 | |
|
| 10 | 24 | | Environment.i.world.sceneBoundsChecker.SetFeedbackStyle(new SceneBoundsFeedbackStyle_RedFlicker()); |
| 10 | 25 | | Environment.i.world.sceneBoundsChecker.timeBetweenChecks = 0f; |
| | 26 | |
|
| 10 | 27 | | UnityEngine.Assertions.Assert.IsTrue(Environment.i.world.sceneBoundsChecker.enabled); |
| 10 | 28 | | UnityEngine.Assertions.Assert.IsTrue(Environment.i.world.sceneBoundsChecker.GetFeedbackStyle() is SceneBound |
| 10 | 29 | | } |
| | 30 | |
|
| | 31 | | [UnityTest] |
| | 32 | | public IEnumerator ResetMaterialCorrectlyWhenInvalidEntitiesAreRemoved() |
| | 33 | | { |
| 1 | 34 | | var entity = TestHelpers.CreateSceneEntity(scene); |
| 1 | 35 | | TestHelpers.SetEntityTransform(scene, entity, new DCLTransform.Model { position = new Vector3(8, 1, 8) }); |
| 1 | 36 | | TestHelpers.CreateAndSetShape(scene, entity.entityId, DCL.Models.CLASS_ID.GLTF_SHAPE, JsonConvert.SerializeO |
| | 37 | | new |
| | 38 | | { |
| | 39 | | src = TestAssetsUtils.GetPath() + "/GLB/PalmTree_01.glb" |
| | 40 | | })); |
| | 41 | |
|
| 1 | 42 | | LoadWrapper gltfShape = GLTFShape.GetLoaderForEntity(entity); |
| 7 | 43 | | yield return new UnityEngine.WaitUntil(() => gltfShape.alreadyLoaded); |
| | 44 | |
|
| 1 | 45 | | yield return null; |
| | 46 | |
|
| 1 | 47 | | SBC_Asserts.AssertMeshIsValid(entity.meshesInfo); |
| | 48 | | // Move object to surpass the scene boundaries |
| 1 | 49 | | TestHelpers.SetEntityTransform(scene, entity, new DCLTransform.Model { position = new Vector3(18, 1, 18) }); |
| | 50 | |
|
| 1 | 51 | | yield return null; |
| | 52 | |
|
| 1 | 53 | | SBC_Asserts.AssertMeshIsInvalid(entity.meshesInfo); |
| | 54 | |
|
| 1 | 55 | | TestHelpers.RemoveSceneEntity(scene, entity.entityId); |
| | 56 | |
|
| 1 | 57 | | Environment.i.platform.parcelScenesCleaner.ForceCleanup(); |
| | 58 | |
|
| 1 | 59 | | yield return null; |
| | 60 | |
|
| 1 | 61 | | var entity2 = TestHelpers.CreateSceneEntity(scene); |
| | 62 | |
|
| 1 | 63 | | TestHelpers.SetEntityTransform(scene, entity2, new DCLTransform.Model { position = new Vector3(8, 1, 8) }); |
| 1 | 64 | | TestHelpers.CreateAndSetShape(scene, entity2.entityId, DCL.Models.CLASS_ID.GLTF_SHAPE, JsonConvert.Serialize |
| | 65 | | new |
| | 66 | | { |
| | 67 | | src = TestAssetsUtils.GetPath() + "/GLB/PalmTree_01.glb" |
| | 68 | | })); |
| | 69 | |
|
| 1 | 70 | | LoadWrapper gltfShape2 = GLTFShape.GetLoaderForEntity(entity2); |
| | 71 | |
|
| 2 | 72 | | yield return new UnityEngine.WaitUntil(() => gltfShape2.alreadyLoaded); |
| 1 | 73 | | yield return null; |
| | 74 | |
|
| 1 | 75 | | SBC_Asserts.AssertMeshIsValid(entity2.meshesInfo); |
| 1 | 76 | | } |
| | 77 | |
|
| | 78 | | [UnityTest] |
| 2 | 79 | | public IEnumerator PShapeIsInvalidatedWhenStartingOutOfBoundsDebugMode() { yield return SBC_Asserts.PShapeIsInva |
| | 80 | |
|
| | 81 | | [UnityTest] |
| 2 | 82 | | public IEnumerator GLTFShapeIsInvalidatedWhenStartingOutOfBoundsDebugMode() { yield return SBC_Asserts.GLTFShape |
| | 83 | |
|
| | 84 | | [UnityTest] |
| | 85 | | [Explicit("Test taking too long")] |
| | 86 | | [Category("Explicit")] |
| 0 | 87 | | public IEnumerator NFTShapeIsInvalidatedWhenStartingOutOfBoundsDebugMode() { yield return SBC_Asserts.NFTShapeIs |
| | 88 | |
|
| | 89 | | [UnityTest] |
| 2 | 90 | | public IEnumerator PShapeIsInvalidatedWhenLeavingBoundsDebugMode() { yield return SBC_Asserts.PShapeIsInvalidate |
| | 91 | |
|
| | 92 | | [UnityTest] |
| 2 | 93 | | public IEnumerator GLTFShapeIsInvalidatedWhenLeavingBoundsDebugMode() { yield return SBC_Asserts.GLTFShapeIsInva |
| | 94 | |
|
| | 95 | | [UnityTest] |
| | 96 | | [Explicit("Test taking too long")] |
| | 97 | | [Category("Explicit")] |
| 0 | 98 | | public IEnumerator NFTShapeIsInvalidatedWhenLeavingBoundsDebugMode() { yield return SBC_Asserts.NFTShapeIsInvali |
| | 99 | |
|
| | 100 | | [UnityTest] |
| 2 | 101 | | public IEnumerator PShapeIsResetWhenReenteringBoundsDebugMode() { yield return SBC_Asserts.PShapeIsResetWhenReen |
| | 102 | |
|
| | 103 | | [UnityTest] |
| | 104 | | [Explicit("Test taking too long")] |
| | 105 | | [Category("Explicit")] |
| 0 | 106 | | public IEnumerator NFTShapeIsResetWhenReenteringBoundsDebugMode() { yield return SBC_Asserts.NFTShapeIsResetWhen |
| | 107 | |
|
| | 108 | | [UnityTest] |
| 2 | 109 | | public IEnumerator ChildShapeIsEvaluatedDebugMode() { yield return SBC_Asserts.ChildShapeIsEvaluated(scene); } |
| | 110 | |
|
| | 111 | | [UnityTest] |
| 2 | 112 | | public IEnumerator ChildShapeIsEvaluatedOnShapelessParentDebugMode() { yield return SBC_Asserts.ChildShapeIsEval |
| | 113 | |
|
| | 114 | | [UnityTest] |
| 2 | 115 | | public IEnumerator HeightIsEvaluatedDebugMode() { yield return SBC_Asserts.HeightIsEvaluated(scene); } |
| | 116 | |
|
| | 117 | | [UnityTest] |
| 2 | 118 | | public IEnumerator GLTFShapeIsResetWhenReenteringBoundsDebugMode() { yield return SBC_Asserts.GLTFShapeIsResetWh |
| | 119 | | } |
| | 120 | | } |