< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Model()0%110100%
GetDataFromJSON(...)0%110100%
CylinderShape()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/CylinderShape.cs

#LineLine coverage
 1using DCL.Controllers;
 2using DCL.Helpers;
 3using DCL.Models;
 4using System;
 5using UnityEngine;
 6
 7namespace DCL.Components
 8{
 9    public class CylinderShape : ParametrizedShape<CylinderShape.Model>
 10    {
 11        [System.Serializable]
 12        new public class Model : BaseShape.Model
 13        {
 3914            public float radiusTop = 1f;
 3915            public float radiusBottom = 1f;
 3916            public float segmentsHeight = 1f;
 3917            public float segmentsRadial = 36f;
 18            public bool openEnded = false;
 19            public float? radius;
 3920            public float arc = 360f;
 21
 2022            public override BaseModel GetDataFromJSON(string json) { return Utils.SafeFromJson<Model>(json); }
 23        }
 24
 2725        public CylinderShape() { model = new Model(); }
 26
 027        public override int GetClassId() { return (int) CLASS_ID.CYLINDER_SHAPE; }
 28
 29        public override Mesh GenerateGeometry()
 30        {
 731            var model = (Model) this.model;
 732            return PrimitiveMeshBuilder.BuildCylinder(50, model.radiusTop, model.radiusBottom, 2f, 0f, true, false);
 33        }
 34
 35        protected override bool ShouldGenerateNewMesh(BaseShape.Model newModel)
 36        {
 2037            if (currentMesh == null)
 1138                return true;
 39
 940            Model newCylinderModel = newModel as Model;
 941            var model = (Model) this.model;
 942            return newCylinderModel.radius != model.radius
 43                   || newCylinderModel.radiusTop != model.radiusTop
 44                   || newCylinderModel.radiusBottom != model.radiusBottom
 45                   || newCylinderModel.segmentsHeight != model.segmentsHeight
 46                   || newCylinderModel.segmentsRadial != model.segmentsRadial
 47                   || newCylinderModel.openEnded != model.openEnded
 48                   || newCylinderModel.arc != model.arc;
 49        }
 50    }
 51}