< Summary

Class:DCLPlugins.DebugPlugins.Commons.WatchEntityShapeHandler
Assembly:DebugPlugins_Commons_ShapeWatcher
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/DebugPlugins/Commons/ShapeWatcher/WatchEntityShapeHandler.cs
Covered lines:17
Uncovered lines:0
Coverable lines:17
Total lines:46
Line coverage:100% (17 of 17)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
WatchEntityShapeHandler(...)0%220100%
Dispose()0%110100%
OnShapeUpdated(...)0%330100%
OnShapeCleaned(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/DebugPlugins/Commons/ShapeWatcher/WatchEntityShapeHandler.cs

#LineLine coverage
 1using DCL.Models;
 2
 3namespace DCLPlugins.DebugPlugins.Commons
 4{
 5    public class WatchEntityShapeHandler
 6    {
 7        private readonly IDCLEntity entity;
 8        private readonly IShapeListener listener;
 9
 2010        public WatchEntityShapeHandler(IDCLEntity entity, IShapeListener listener)
 11        {
 2012            this.entity = entity;
 2013            this.listener = listener;
 14
 2015            if (entity.meshesInfo.currentShape != null)
 16            {
 1717                OnShapeUpdated(entity);
 18            }
 19
 2020            entity.OnMeshesInfoUpdated += OnShapeUpdated;
 2021            entity.OnMeshesInfoCleaned += OnShapeCleaned;
 2022        }
 23
 24        public void Dispose()
 25        {
 2026            entity.OnMeshesInfoUpdated -= OnShapeUpdated;
 2027            entity.OnMeshesInfoCleaned -= OnShapeCleaned;
 28
 2029            listener.Dispose();
 2030        }
 31
 32        private void OnShapeUpdated(IDCLEntity entity)
 33        {
 1934            if (entity.meshesInfo.currentShape != null
 35                && entity.meshesInfo.meshRootGameObject != null)
 36            {
 1837                listener.OnShapeUpdated(entity);
 38            }
 1939        }
 40
 41        private void OnShapeCleaned(IDCLEntity entity)
 42        {
 243            listener.OnShapeCleaned(entity);
 244        }
 45    }
 46}