< Summary

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

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
 4511    public UiContainerHandler(Func<IInternalECSComponent<InternalUiContainer>> componentGet)
 12    {
 4513        this.thisComponent = componentGet();
 4514    }
 15
 4516    public void OnComponentCreated(IParcelScene scene, IDCLEntity entity) { }
 17
 18    public void OnComponentRemoved(IParcelScene scene, IDCLEntity entity)
 19    {
 4520        var containerData = thisComponent.GetFor(scene, entity);
 4521        if (containerData != null)
 22        {
 4523            containerData.Value.model.parentElement?.Remove(containerData.Value.model.rootElement);
 24        }
 2525    }
 26
 27    public void OnComponentModelUpdated(IParcelScene scene, IDCLEntity entity, InternalUiContainer model)
 28    {
 11129        if (model.rootElement.childCount == 0 && model.components.Count == 0 && entity.entityId != SpecialEntityId.SCENE
 30        {
 131            thisComponent.RemoveFor(scene, entity);
 32        }
 11133    }
 34}