< Summary

Class:UIContainerStackVisualTests
Assembly:UIContainerRectTests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/UI/UIContainer/Tests/UIContainerStackVisualTests.cs
Covered lines:14
Uncovered lines:1
Coverable lines:15
Total lines:96
Line coverage:93.3% (14 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
UIContainerStackVisualTests_Generate()0%12300%
UIContainerStackTest1()0%12120100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/UI/UIContainer/Tests/UIContainerStackVisualTests.cs

#LineLine coverage
 1using DCL;
 2using DCL.Components;
 3using DCL.Helpers;
 4using DCL.Models;
 5using NUnit.Framework;
 6using System.Collections;
 7using UnityEngine;
 8using UnityEngine.TestTools;
 9
 10public class UIContainerStackVisualTests : UIVisualTestsBase
 11{
 12    [UnityTest]
 13    [Explicit]
 14    [VisualTest]
 15    [Category("Explicit")]
 016    public IEnumerator UIContainerStackVisualTests_Generate() { yield return VisualTestHelpers.GenerateBaselineForTest(U
 17
 18    [UnityTest]
 19    [VisualTest]
 20    [Category("Visual Tests")]
 21    public IEnumerator UIContainerStackTest1()
 22    {
 123        yield return InitUIVisualTestScene("UIContainerStackTest");
 24
 125        string mainContainerId = "herodes";
 126        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
 134        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
 142        DCLTexture texture = TestHelpers.CreateDCLTexture(scene, TestAssetsUtils.GetPath() + "/Images/atlas.png");
 143        yield return texture.routine;
 144        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
 155        string mainContainer2Id = "herodes2";
 156        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
 167        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
 176        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
 185        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
 194        yield return VisualTestHelpers.TakeSnapshot(new Vector3(0f, 2f, 0f));
 195    }
 96}