< Summary

Class:CatalogBtnController
Assembly:BuildModeHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/GodMode/CatalogBtnController.cs
Covered lines:16
Uncovered lines:0
Coverable lines:16
Total lines:51
Line coverage:100% (16 of 16)
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%
SetActive(...)0%110100%

File(s)

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

#LineLine coverage
 1using System;
 2using UnityEngine.EventSystems;
 3
 4public interface ICatalogBtnController
 5{
 6    event Action OnClick;
 7
 8    void Initialize(ICatalogBtnView catalogBtnView, ITooltipController tooltipController);
 9    void Dispose();
 10    void Click();
 11    void ShowTooltip(BaseEventData eventData, string tooltipText);
 12    void HideTooltip();
 13    void SetActive(bool isActive);
 14}
 15
 16public class CatalogBtnController : ICatalogBtnController
 17{
 18    public event Action OnClick;
 19
 20    internal ICatalogBtnView catalogBtnView;
 21    internal ITooltipController tooltipController;
 22
 23    public void Initialize(ICatalogBtnView catalogBtnView, ITooltipController tooltipController)
 24    {
 525        this.catalogBtnView = catalogBtnView;
 526        this.tooltipController = tooltipController;
 27
 528        catalogBtnView.OnCatalogButtonClick += Click;
 529        catalogBtnView.OnShowTooltip += ShowTooltip;
 530        catalogBtnView.OnHideTooltip += HideTooltip;
 531    }
 32
 33    public void Dispose()
 34    {
 535        catalogBtnView.OnCatalogButtonClick -= Click;
 536        catalogBtnView.OnShowTooltip -= ShowTooltip;
 537        catalogBtnView.OnHideTooltip -= HideTooltip;
 538    }
 39
 240    public void Click() { OnClick?.Invoke(); }
 41
 42    public void ShowTooltip(BaseEventData eventData, string tooltipText)
 43    {
 144        tooltipController.ShowTooltip(eventData);
 145        tooltipController.SetTooltipText(tooltipText);
 146    }
 47
 248    public void HideTooltip() { tooltipController.HideTooltip(); }
 49
 450    public void SetActive(bool isActive) { catalogBtnView.SetActive(isActive); }
 51}