| | 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 UIImageVisualTests : UIVisualTestsBase |
| | 11 | | { |
| | 12 | | [UnityTest] |
| | 13 | | [VisualTest] |
| | 14 | | [Explicit] |
| | 15 | | [Category("Explicit")] |
| 0 | 16 | | public IEnumerator UIImageVisualTests_Generate() { yield return VisualTestHelpers.GenerateBaselineForTest(UIImageTes |
| | 17 | |
|
| | 18 | | [UnityTest] |
| | 19 | | [VisualTest] |
| | 20 | | [Category("Visual Tests")] |
| | 21 | | public IEnumerator UIImageTest1() |
| | 22 | | { |
| 1 | 23 | | yield return InitUIVisualTestScene("UIImageTest"); |
| | 24 | |
|
| 1 | 25 | | string mainContainerId = "herodes"; |
| 1 | 26 | | yield return CreateUIComponent<UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContain |
| | 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.red, |
| | 38 | | width = new UIValue(128f), |
| | 39 | | height = new UIValue(128f) |
| | 40 | | }, "imageBack"); |
| | 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(128f), |
| | 49 | | height = new UIValue(128f), |
| | 50 | | sourceWidth = 128f, |
| | 51 | | sourceHeight = 128f, |
| | 52 | | sourceTop = 0f, |
| | 53 | | sourceLeft = 0f, |
| | 54 | | paddingLeft = 10f, |
| | 55 | | paddingRight = 10f, |
| | 56 | | paddingTop = 10f, |
| | 57 | | paddingBottom = 10f, |
| | 58 | | isPointerBlocker = true, |
| | 59 | | }, "testUIImage"); |
| | 60 | |
|
| 1 | 61 | | yield return VisualTestHelpers.TakeSnapshot(new Vector3(0f, 2f, 0f)); |
| 1 | 62 | | } |
| | 63 | | } |