< Summary

Class:ButtonAudioHandler
Assembly:HUDCommon
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Common/Audio/HUDElements/ButtonAudioHandler.cs
Covered lines:1
Uncovered lines:14
Coverable lines:15
Total lines:48
Line coverage:6.6% (1 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
OnPointerEnter(...)0%12300%
OnPointerDown(...)0%12300%
OnPointerUp(...)0%20400%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Common/Audio/HUDElements/ButtonAudioHandler.cs

#LineLine coverage
 1using UnityEngine;
 2using UnityEngine.EventSystems;
 3using UnityEngine.UI;
 4
 5public class ButtonAudioHandler : GeneralHUDElementAudioHandler
 6{
 7    protected Selectable selectable;
 8    [SerializeField]
 9    AudioEvent extraClickEvent = null;
 10
 949011    void Awake() { selectable = GetComponent<Selectable>(); }
 12
 13    public override void OnPointerEnter(PointerEventData eventData)
 14    {
 015        if (selectable != null)
 16        {
 017            if (selectable.interactable)
 18            {
 019                base.OnPointerEnter(eventData);
 20            }
 21        }
 022    }
 23
 24    public override void OnPointerDown(PointerEventData eventData)
 25    {
 026        if (selectable != null)
 27        {
 028            if (selectable.interactable)
 29            {
 030                base.OnPointerDown(eventData);
 31            }
 32        }
 033    }
 34
 35    public override void OnPointerUp(PointerEventData eventData)
 36    {
 037        if (selectable != null)
 38        {
 039            if (selectable.interactable)
 40            {
 041                base.OnPointerUp(eventData);
 42
 043                if (extraClickEvent != null)
 044                    extraClickEvent.Play(true);
 45            }
 46        }
 047    }
 48}