< Summary

Class:DCL.Tutorial.TutorialStep_Tooltip
Assembly:Onboarding
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/Steps/Initial/TutorialStep_Tooltip.cs
Covered lines:16
Uncovered lines:4
Coverable lines:20
Total lines:58
Line coverage:80% (16 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
TutorialStep_Tooltip()0%110100%
Update()0%4.074083.33%
OnPointerDown(...)0%2100%
OnStepStart()0%220100%
OnStepExecute()0%330100%
OnStepPlayHideAnimation()0%440100%
SetTooltipPosition()0%2100%
OverrideSetMaxTimeToHide(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/Steps/Initial/TutorialStep_Tooltip.cs

#LineLine coverage
 1using System.Collections;
 2using UnityEngine;
 3using UnityEngine.EventSystems;
 4
 5namespace DCL.Tutorial
 6{
 7    /// <summary>
 8    /// Class that represents one of the tooltip steps included in the onboarding tutorial.
 9    /// </summary>
 10    public class TutorialStep_Tooltip : TutorialStep, IPointerDownHandler
 11    {
 12        [SerializeField] protected RectTransform tooltipTransform;
 13        [SerializeField] bool setMaxTimeToHide = false;
 1614        [SerializeField] float maxTimeToHide = 5f;
 15
 16        private bool tooltipStarted = false;
 17        private float timeSinceWasOpened = 0f;
 18        internal bool stepIsFinished = false;
 19        internal bool isRelatedFeatureActived = false;
 20
 21        protected virtual void Update()
 22        {
 5423            if (!setMaxTimeToHide || !tooltipStarted)
 4824                return;
 25
 626            timeSinceWasOpened += Time.deltaTime;
 27
 628            if (timeSinceWasOpened >= maxTimeToHide)
 029                stepIsFinished = true;
 630        }
 31
 032        public virtual void OnPointerDown(PointerEventData eventData) { stepIsFinished = true; }
 33
 34        public override void OnStepStart()
 35        {
 936            base.OnStepStart();
 37
 938            SetTooltipPosition();
 39
 940            if (tutorialController != null)
 941                tutorialController.SetTeacherPosition(teacherPositionRef.position);
 42
 943            tooltipStarted = true;
 944        }
 45
 4546        public override IEnumerator OnStepExecute() { yield return new WaitUntil(() => stepIsFinished); }
 47
 48        public override IEnumerator OnStepPlayHideAnimation()
 49        {
 950            yield return base.OnStepPlayHideAnimation();
 1851            yield return new WaitUntil(() => !isRelatedFeatureActived);
 952        }
 53
 054        protected virtual void SetTooltipPosition() { }
 55
 056        public void OverrideSetMaxTimeToHide(bool setMaxTimeToHide) { this.setMaxTimeToHide = setMaxTimeToHide; }
 57    }
 58}