| | 1 | | using DCL; |
| | 2 | | using DCL.Components; |
| | 3 | | using DCL.Configuration; |
| | 4 | | using DCL.Controllers; |
| | 5 | | using DCL.Helpers; |
| | 6 | | using Newtonsoft.Json; |
| | 7 | | using NUnit.Framework; |
| | 8 | | using System.Collections; |
| | 9 | | using System.Collections.Generic; |
| | 10 | | using Tests; |
| | 11 | | using UnityEngine; |
| | 12 | |
|
| | 13 | | public class BIWOutlinerShould : IntegrationTestSuite_Legacy |
| | 14 | | { |
| | 15 | | private const string ENTITY_ID = "1"; |
| | 16 | | private DCLBuilderInWorldEntity entity; |
| | 17 | | private BIWOutlinerController outlinerController; |
| | 18 | |
|
| | 19 | | protected override IEnumerator SetUp() |
| | 20 | | { |
| 3 | 21 | | yield return base.SetUp(); |
| 3 | 22 | | BuilderInWorldController controller = Resources.FindObjectsOfTypeAll<BuilderInWorldController>()[0]; |
| 3 | 23 | | outlinerController = controller.outlinerController; |
| | 24 | |
|
| 3 | 25 | | TestHelpers.CreateSceneEntity(scene, ENTITY_ID); |
| | 26 | |
|
| 3 | 27 | | TestHelpers.CreateAndSetShape(scene, ENTITY_ID, DCL.Models.CLASS_ID.GLTF_SHAPE, JsonConvert.SerializeObject( |
| | 28 | | new |
| | 29 | | { |
| | 30 | | src = TestAssetsUtils.GetPath() + "/GLB/Trunk/Trunk.glb" |
| | 31 | | })); |
| | 32 | |
|
| 3 | 33 | | LoadWrapper gltfShape = GLTFShape.GetLoaderForEntity(scene.entities[ENTITY_ID]); |
| 21 | 34 | | yield return new DCL.WaitUntil(() => gltfShape.alreadyLoaded); |
| 3 | 35 | | controller.builderInWorldEntityHandler.EnterEditMode(scene); |
| 3 | 36 | | entity = controller.builderInWorldEntityHandler.GetConvertedEntity(scene.entities[ENTITY_ID]); |
| 3 | 37 | | } |
| | 38 | |
|
| | 39 | | [Test] |
| | 40 | | public void OutlineEnity() |
| | 41 | | { |
| 1 | 42 | | outlinerController.OutlineEntity(entity); |
| 1 | 43 | | Assert.IsTrue(outlinerController.IsEntityOutlined(entity)); |
| | 44 | |
|
| 1 | 45 | | outlinerController.CancelEntityOutline(entity); |
| 1 | 46 | | Assert.IsFalse(outlinerController.IsEntityOutlined(entity)); |
| 1 | 47 | | } |
| | 48 | |
|
| | 49 | | [Test] |
| | 50 | | public void OutlineLayer() |
| | 51 | | { |
| 1 | 52 | | outlinerController.OutlineEntity(entity); |
| 1 | 53 | | Assert.AreEqual(entity.rootEntity.meshesInfo.renderers[0].gameObject.layer, BuilderInWorldSettings.SELECTION_LAY |
| | 54 | |
|
| 1 | 55 | | outlinerController.CancelEntityOutline(entity); |
| 1 | 56 | | Assert.AreNotEqual(entity.rootEntity.meshesInfo.renderers[0].gameObject.layer, BuilderInWorldSettings.SELECTION_ |
| 1 | 57 | | } |
| | 58 | |
|
| | 59 | | [Test] |
| | 60 | | public void OutlineLockEntities() |
| | 61 | | { |
| 1 | 62 | | entity.SetIsLockedValue(true); |
| 1 | 63 | | outlinerController.OutlineEntity(entity); |
| 1 | 64 | | Assert.IsFalse(outlinerController.IsEntityOutlined(entity)); |
| 1 | 65 | | } |
| | 66 | | } |