< Summary

Class:UiContainerHandler
Assembly:ECS7Plugin.InternalECSComponents
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Handlers/UiContainerHandler.cs
Covered lines:12
Uncovered lines:0
Coverable lines:12
Total lines:35
Line coverage:100% (12 of 12)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
UiContainerHandler(...)0%110100%
OnComponentCreated(...)0%110100%
OnComponentRemoved(...)0%330100%
OnComponentModelUpdated(...)0%440100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Handlers/UiContainerHandler.cs

#LineLine coverage
 1using System;
 2using DCL.Controllers;
 3using DCL.ECS7.InternalComponents;
 4using DCL.ECSRuntime;
 5using DCL.Models;
 6
 7public class UiContainerHandler : IECSComponentHandler<InternalUiContainer>
 8{
 9    private readonly IInternalECSComponent<InternalUiContainer> thisComponent;
 10
 3111    public UiContainerHandler(Func<IInternalECSComponent<InternalUiContainer>> componentGet)
 12    {
 3113        this.thisComponent = componentGet();
 3114    }
 15
 3116    public void OnComponentCreated(IParcelScene scene, IDCLEntity entity) { }
 17
 18    public void OnComponentRemoved(IParcelScene scene, IDCLEntity entity)
 19    {
 420        var containerData = thisComponent.GetFor(scene, entity);
 421        if (containerData != null)
 22        {
 423            containerData.model.parentElement?.Remove(containerData.model.rootElement);
 424            containerData.model.parentElement = null;
 25        }
 426    }
 27
 28    public void OnComponentModelUpdated(IParcelScene scene, IDCLEntity entity, InternalUiContainer model)
 29    {
 8230        if (model.rootElement.childCount == 0 && model.components.Count == 0 && entity.entityId != SpecialEntityId.SCENE
 31        {
 132            thisComponent.RemoveFor(scene, entity);
 33        }
 8234    }
 35}