< Summary

Class:InspectorBtnController
Assembly:BuildModeHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/GodMode/Inspector/InspectorBtnController.cs
Covered lines:15
Uncovered lines:0
Coverable lines:15
Total lines:48
Line coverage:100% (15 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize(...)0%110100%
Dispose()0%110100%
Click()0%220100%
ShowTooltip(...)0%110100%
HideTooltip()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/GodMode/Inspector/InspectorBtnController.cs

#LineLine coverage
 1using System;
 2using UnityEngine.EventSystems;
 3
 4public interface IInspectorBtnController
 5{
 6    event Action OnClick;
 7
 8    void Initialize(IInspectorBtnView inspectorBtnView, ITooltipController tooltipController);
 9    void Dispose();
 10    void Click();
 11    void ShowTooltip(BaseEventData eventData, string tooltipText);
 12    void HideTooltip();
 13}
 14
 15public class InspectorBtnController : IInspectorBtnController
 16{
 17    public event Action OnClick;
 18
 19    internal IInspectorBtnView inspectorBtnView;
 20    internal ITooltipController tooltipController;
 21
 22    public void Initialize(IInspectorBtnView inspectorBtnView, ITooltipController tooltipController)
 23    {
 324        this.inspectorBtnView = inspectorBtnView;
 325        this.tooltipController = tooltipController;
 26
 327        inspectorBtnView.OnInspectorButtonClick += Click;
 328        inspectorBtnView.OnShowTooltip += ShowTooltip;
 329        inspectorBtnView.OnHideTooltip += HideTooltip;
 330    }
 31
 32    public void Dispose()
 33    {
 334        inspectorBtnView.OnInspectorButtonClick -= Click;
 335        inspectorBtnView.OnShowTooltip -= ShowTooltip;
 336        inspectorBtnView.OnHideTooltip -= HideTooltip;
 337    }
 38
 239    public void Click() { OnClick?.Invoke(); }
 40
 41    public void ShowTooltip(BaseEventData eventData, string tooltipText)
 42    {
 143        tooltipController.ShowTooltip(eventData);
 144        tooltipController.SetTooltipText(tooltipText);
 145    }
 46
 247    public void HideTooltip() { tooltipController.HideTooltip(); }
 48}