< Summary

Class:DCL.Components.ConeShape
Assembly:DCL.Components.ParametrizedShape
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/ParametrizedShapes/ConeShape.cs
Covered lines:13
Uncovered lines:1
Coverable lines:14
Total lines:51
Line coverage:92.8% (13 of 14)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Model()0%110100%
GetDataFromJSON(...)0%110100%
ConeShape()0%110100%
GetClassId()0%2100%
GenerateGeometry()0%110100%
ShouldGenerateNewMesh(...)0%880100%

File(s)

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

#LineLine coverage
 1using DCL.Controllers;
 2using DCL.Helpers;
 3using DCL.Models;
 4using System;
 5using UnityEngine;
 6
 7namespace DCL.Components
 8{
 9    public class ConeShape : ParametrizedShape<ConeShape.Model>
 10    {
 11        [System.Serializable]
 12        new public class Model : BaseShape.Model
 13        {
 14            public float radiusTop = 0f;
 5915            public float radiusBottom = 1f;
 5916            public float segmentsHeight = 1f;
 5917            public float segmentsRadial = 36f;
 18            public bool openEnded = false;
 19            public float? radius;
 5920            public float arc = 360f;
 21
 2722            public override BaseModel GetDataFromJSON(string json) { return Utils.SafeFromJson<Model>(json); }
 23        }
 24
 4225        public ConeShape() { model = new Model(); }
 26
 027        public override int GetClassId() { return (int) CLASS_ID.CONE_SHAPE; }
 28
 29        public override Mesh GenerateGeometry()
 30        {
 1331            var model = (Model) this.model;
 1332            return PrimitiveMeshBuilder.BuildCone(50, model.radiusTop, model.radiusBottom, 2f, 0f, true, false);
 33        }
 34
 35        protected override bool ShouldGenerateNewMesh(BaseShape.Model newModel)
 36        {
 2737            if (currentMesh == null)
 1738                return true;
 39
 1040            Model newConeModel = newModel as Model;
 1041            var model = (Model) this.model;
 1042            return newConeModel.radius != model.radius
 43                   || newConeModel.radiusTop != model.radiusTop
 44                   || newConeModel.radiusBottom != model.radiusBottom
 45                   || newConeModel.segmentsHeight != model.segmentsHeight
 46                   || newConeModel.segmentsRadial != model.segmentsRadial
 47                   || newConeModel.openEnded != model.openEnded
 48                   || newConeModel.arc != model.arc;
 49        }
 50    }
 51}