| | 1 | | using DCL; |
| | 2 | | using DCL.Components; |
| | 3 | | using DCL.Helpers; |
| | 4 | | using DCL.Models; |
| | 5 | | using NUnit.Framework; |
| | 6 | | using System.Collections; |
| | 7 | | using UnityEngine; |
| | 8 | | using UnityEngine.TestTools; |
| | 9 | |
|
| | 10 | | public class UIContainerStackVisualTests : UIVisualTestsBase |
| | 11 | | { |
| | 12 | | [UnityTest] |
| | 13 | | [Explicit] |
| | 14 | | [VisualTest] |
| | 15 | | [Category("Explicit")] |
| 0 | 16 | | public IEnumerator UIContainerStackVisualTests_Generate() { yield return VisualTestHelpers.GenerateBaselineForTest(U |
| | 17 | |
|
| | 18 | | [UnityTest] |
| | 19 | | [VisualTest] |
| | 20 | | [Category("Visual Tests")] |
| | 21 | | public IEnumerator UIContainerStackTest1() |
| | 22 | | { |
| 1 | 23 | | yield return InitUIVisualTestScene("UIContainerStackTest"); |
| | 24 | |
|
| 1 | 25 | | string mainContainerId = "herodes"; |
| 1 | 26 | | yield return CreateUIComponent<UIContainerStack, UIContainerStack.Model>(CLASS_ID.UI_CONTAINER_STACK, new UICont |
| | 27 | | { |
| | 28 | | parentComponent = screenSpaceId, |
| | 29 | | color = Color.green, |
| | 30 | | width = new UIValue(50f, UIValue.Unit.PERCENT), |
| | 31 | | height = new UIValue(50f, UIValue.Unit.PERCENT) |
| | 32 | | }, mainContainerId); |
| | 33 | |
|
| 1 | 34 | | yield return CreateUIComponent<UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContain |
| | 35 | | { |
| | 36 | | parentComponent = mainContainerId, |
| | 37 | | color = Color.blue, |
| | 38 | | width = new UIValue(200f), |
| | 39 | | height = new UIValue(200f) |
| | 40 | | }, "testContainerRect1"); |
| | 41 | |
|
| 1 | 42 | | DCLTexture texture = TestHelpers.CreateDCLTexture(scene, TestAssetsUtils.GetPath() + "/Images/atlas.png"); |
| 1 | 43 | | yield return texture.routine; |
| 1 | 44 | | yield return CreateUIComponent<UIImage, UIImage.Model>(CLASS_ID.UI_IMAGE_SHAPE, new UIImage.Model |
| | 45 | | { |
| | 46 | | parentComponent = mainContainerId, |
| | 47 | | source = texture.id, |
| | 48 | | width = new UIValue(100f), |
| | 49 | | height = new UIValue(100f), |
| | 50 | | positionX = new UIValue(20f), |
| | 51 | | sourceWidth = 100f, |
| | 52 | | sourceHeight = 100f |
| | 53 | | }, "testUIImage"); |
| | 54 | |
|
| 1 | 55 | | string mainContainer2Id = "herodes2"; |
| 1 | 56 | | yield return CreateUIComponent<UIContainerStack, UIContainerStack.Model>(CLASS_ID.UI_CONTAINER_STACK, new UICont |
| | 57 | | { |
| | 58 | | parentComponent = mainContainerId, |
| | 59 | | color = Color.red, |
| | 60 | | stackOrientation = UIContainerStack.StackOrientation.HORIZONTAL, |
| | 61 | | positionX = new UIValue(20f), |
| | 62 | | positionY = new UIValue(20f), |
| | 63 | | width = new UIValue(200f), |
| | 64 | | height = new UIValue(200f) |
| | 65 | | }, mainContainer2Id); |
| | 66 | |
|
| 1 | 67 | | yield return CreateUIComponent<UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContain |
| | 68 | | { |
| | 69 | | parentComponent = mainContainer2Id, |
| | 70 | | color = Color.blue, |
| | 71 | | width = new UIValue(200f), |
| | 72 | | height = new UIValue(200f), |
| | 73 | | positionY = new UIValue(0f) |
| | 74 | | }, "testContainerRect2"); |
| | 75 | |
|
| 1 | 76 | | yield return CreateUIComponent<UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContain |
| | 77 | | { |
| | 78 | | parentComponent = mainContainer2Id, |
| | 79 | | color = Color.magenta, |
| | 80 | | width = new UIValue(200f), |
| | 81 | | height = new UIValue(200f), |
| | 82 | | positionY = new UIValue(10f) |
| | 83 | | }, "testContainerRect3"); |
| | 84 | |
|
| 1 | 85 | | yield return CreateUIComponent<UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContain |
| | 86 | | { |
| | 87 | | parentComponent = mainContainer2Id, |
| | 88 | | color = Color.yellow, |
| | 89 | | width = new UIValue(200f), |
| | 90 | | height = new UIValue(200f), |
| | 91 | | positionY = new UIValue(20f) |
| | 92 | | }, "testContainerRect4"); |
| | 93 | |
|
| 1 | 94 | | yield return VisualTestHelpers.TakeSnapshot(new Vector3(0f, 2f, 0f)); |
| 1 | 95 | | } |
| | 96 | | } |