< Summary

Class:DCL.ECSComponents.UIBackgroundHandler
Assembly:DCL.ECSComponents.UIBackground
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/UIBackground/UIBackgroundHandler.cs
Covered lines:0
Uncovered lines:19
Coverable lines:19
Total lines:49
Line coverage:0% (0 of 19)
Covered branches:0
Total branches:0

Metrics

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

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/UIBackground/UIBackgroundHandler.cs

#LineLine coverage
 1using DCL.Controllers;
 2using DCL.ECS7.InternalComponents;
 3using DCL.ECSComponents.UIAbstractElements;
 4using DCL.ECSComponents.Utils;
 5using DCL.ECSRuntime;
 6using DCL.Models;
 7using DCL.UIElements.Image;
 8
 9namespace DCL.ECSComponents
 10{
 11    public class UIBackgroundHandler : UIElementHandlerBase, IECSComponentHandler<PBUiBackground>
 12    {
 13        private readonly AssetPromiseKeeper_Texture fontPromiseKeeper;
 14        private UITextureUpdater textureUpdater;
 15
 016        internal DCLImage image { get; private set; }
 17
 18        public UIBackgroundHandler(IInternalECSComponent<InternalUiContainer> internalUiContainer, int componentId, Asse
 019            : base(internalUiContainer, componentId)
 20        {
 021            this.fontPromiseKeeper = fontPromiseKeeper;
 022        }
 23
 24        public void OnComponentCreated(IParcelScene scene, IDCLEntity entity)
 25        {
 026            var container = AddComponentToEntity(scene, entity);
 027            image = new DCLImage(container.rootElement);
 28
 029            textureUpdater = new UITextureUpdater(image, fontPromiseKeeper);
 030        }
 31
 32        public void OnComponentRemoved(IParcelScene scene, IDCLEntity entity)
 33        {
 034            RemoveComponentFromEntity(scene, entity);
 035            image.Dispose();
 036            image = null;
 037            textureUpdater.Dispose();
 038        }
 39
 40        public void OnComponentModelUpdated(IParcelScene scene, IDCLEntity entity, PBUiBackground model)
 41        {
 042            textureUpdater.Update(model.Texture, scene);
 043            image.Color = model.GetColor().ToUnityColor();
 044            image.Slices = model.GetBorder().ToUnityBorder();
 045            image.UVs = model.Uvs.ToDCLUVs();
 046            image.ScaleMode = model.TextureMode.ToDCLImageScaleMode();
 047        }
 48    }
 49}