< Summary

Class:PlaneShapeShould
Assembly:ParametrizedShapesTests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/ParametrizedShapes/Tests/PlaneShapeShould.cs
Covered lines:20
Uncovered lines:0
Coverable lines:20
Total lines:68
Line coverage:100% (20 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BeUpdatedCorrectly()0%220100%
UpdateUVsCorrectly()0%330100%
DefaultMissingValuesOnUpdate()0%440100%
BeReplacedCorrectlyWhenAnotherComponentIsAttached()0%330100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/ParametrizedShapes/Tests/PlaneShapeShould.cs

#LineLine coverage
 1using System.Collections;
 2using DCL.Components;
 3using DCL.Helpers;
 4using DCL.Models;
 5using NUnit.Framework;
 6using UnityEngine;
 7using UnityEngine.TestTools;
 8
 9public class PlaneShapeShould : IntegrationTestSuite_Legacy
 10{
 11    [UnityTest]
 12    public IEnumerator BeUpdatedCorrectly()
 13    {
 114        string entityId = "3";
 115        TestHelpers.InstantiateEntityWithShape(scene, entityId, DCL.Models.CLASS_ID.PLANE_SHAPE, Vector3.zero);
 16
 117        var meshName = scene.entities[entityId].gameObject.GetComponentInChildren<MeshFilter>().mesh.name;
 118        Assert.AreEqual("DCL Plane Instance", meshName);
 119        yield break;
 20    }
 21
 22    [UnityTest]
 23    public IEnumerator UpdateUVsCorrectly()
 24    {
 125        float[] uvs = new float[] { 0, 0.75f, 0.25f, 0.75f, 0.25f, 1, 0, 1, 0, 0.75f, 0.25f, 0.75f, 0.25f, 1, 0, 1 };
 26
 27        IDCLEntity entity;
 28
 129        PlaneShape plane = TestHelpers.InstantiateEntityWithShape<PlaneShape, PlaneShape.Model>(
 30            scene,
 31            DCL.Models.CLASS_ID.PLANE_SHAPE,
 32            Vector3.zero,
 33            out entity,
 34            new PlaneShape.Model()
 35            {
 36                height = 1,
 37                width = 1,
 38                uvs = uvs
 39            });
 40
 141        yield return plane.routine;
 42
 143        Assert.IsTrue(entity != null);
 144        Assert.IsTrue(plane != null);
 145        Assert.IsTrue(plane.currentMesh != null);
 146        CollectionAssert.AreEqual(Utils.FloatArrayToV2List(uvs), plane.currentMesh.uv);
 147    }
 48
 49    [UnityTest]
 50    public IEnumerator DefaultMissingValuesOnUpdate()
 51    {
 152        var component =
 53            TestHelpers.SharedComponentCreate<PlaneShape, PlaneShape.Model>(scene, CLASS_ID.PLANE_SHAPE);
 154        yield return component.routine;
 55
 156        Assert.IsFalse(component == null);
 57
 158        yield return TestHelpers.TestSharedComponentDefaultsOnUpdate<PlaneShape.Model, PlaneShape>(scene,
 59            CLASS_ID.PLANE_SHAPE);
 160    }
 61
 62    [UnityTest]
 63    public IEnumerator BeReplacedCorrectlyWhenAnotherComponentIsAttached()
 64    {
 165        yield return TestHelpers.TestAttachedSharedComponentOfSameTypeIsReplaced<PlaneShape.Model, PlaneShape>(
 66            scene, CLASS_ID.PLANE_SHAPE);
 167    }
 68}