< Summary

Class:DCL.Components.UIReferencesContainer
Assembly:DCL.Components.UI
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/UI/UIReferencesContainer.cs
Covered lines:5
Uncovered lines:2
Coverable lines:7
Total lines:47
Line coverage:71.4% (5 of 7)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
OnPointerDown(...)0%4.374071.43%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/UI/UIReferencesContainer.cs

#LineLine coverage
 1using System.Diagnostics.Tracing;
 2using UnityEngine;
 3using UnityEngine.UI;
 4using UnityEngine.EventSystems;
 5using DCL.Interface;
 6
 7namespace DCL.Components
 8{
 9    public class UIReferencesContainer : MonoBehaviour, IPointerDownHandler
 10    {
 11        [System.NonSerialized] public UIShape owner;
 12
 13        [Header("Basic Fields")]
 14        [Tooltip("This needs to always have the root RectTransform.")]
 15        public RectTransform rectTransform;
 16
 17        public CanvasGroup canvasGroup;
 18
 19        public HorizontalLayoutGroup layoutGroup;
 20        public LayoutElement layoutElement;
 21        public RectTransform layoutElementRT;
 22
 23        [Tooltip("Children of this UI object will reparent to this rectTransform.")]
 24        public RectTransform childHookRectTransform;
 25
 26        bool VERBOSE = false;
 27
 28        public void OnPointerDown(PointerEventData eventData)
 29        {
 19430            UIShape.Model ownerModel = (UIShape.Model) owner.GetModel();
 31
 19432            if (VERBOSE)
 33            {
 034                Debug.Log("pointer current raycast: " + eventData.pointerCurrentRaycast,
 35                    eventData.pointerCurrentRaycast.gameObject);
 036                Debug.Log("pointer press raycast: " + eventData.pointerPressRaycast,
 37                    eventData.pointerPressRaycast.gameObject);
 38            }
 39
 19440            if (!string.IsNullOrEmpty(ownerModel.onClick) &&
 41                eventData.pointerPressRaycast.gameObject == childHookRectTransform.gameObject)
 42            {
 543                WebInterface.ReportOnClickEvent(owner.scene.sceneData.sceneNumber, ownerModel.onClick);
 44            }
 19445        }
 46    }
 47}