< Summary

Class:DCL.ECSComponents.UITransformComponentHandler
Assembly:DCL.ECSComponents.UITransform
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/UITransform/Handler/UITransformComponentHandler.cs
Covered lines:7
Uncovered lines:3
Coverable lines:10
Total lines:40
Line coverage:70% (7 of 10)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
UITransformComponentHandler(...)0%2100%
OnComponentCreated(...)0%110100%
OnComponentRemoved(...)0%110100%
OnComponentModelUpdated(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/UITransform/Handler/UITransformComponentHandler.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using DCL.Controllers;
 4using DCL.ECS7.UI;
 5using DCL.ECSRuntime;
 6using DCL.Models;
 7using UnityEngine;
 8using UnityEngine.UIElements;
 9using Random = UnityEngine.Random;
 10
 11namespace DCL.ECSComponents
 12{
 13    public class UITransformComponentHandler : IECSComponentHandler<PBUiTransform>
 14    {
 15        private readonly IUIDataContainer uiDataContainer;
 16
 017        public UITransformComponentHandler(IUIDataContainer dataContainer)
 18        {
 019            this.uiDataContainer = dataContainer;
 020        }
 21
 22        public void OnComponentCreated(IParcelScene scene, IDCLEntity entity)
 23        {
 1724        }
 25
 26        public void OnComponentRemoved(IParcelScene scene, IDCLEntity entity)
 27        {
 28            // If we remove an UITransform from a entity, it should have the root entity as parent
 129            entity.parentId = SpecialEntityId.SCENE_ROOT_ENTITY;
 130            uiDataContainer.RemoveUITransform(scene,entity);
 131        }
 32
 33        public void OnComponentModelUpdated(IParcelScene scene, IDCLEntity entity, PBUiTransform model)
 34        {
 1835            entity.parentId = model.Parent;
 36
 1837            uiDataContainer.AddUIComponent(scene,entity, model);
 1838        }
 39    }
 40}