< Summary

Class:GoToLinkAction
Assembly:UIComponents
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/UIComponents/Scripts/Components/Button/GoToLinkAction.cs
Covered lines:2
Uncovered lines:8
Coverable lines:10
Total lines:29
Line coverage:20% (2 of 10)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Start()0%2100%
OnDestroy()0%2.152066.67%
GoToUrl()0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/UIComponents/Scripts/Components/Button/GoToLinkAction.cs

#LineLine coverage
 1using UnityEngine;
 2
 3[RequireComponent(typeof(ButtonComponentView))]
 4public class GoToLinkAction : MonoBehaviour
 5{
 6    public string urlToGo;
 7
 8    private ButtonComponentView button;
 9
 10    private void Start()
 11    {
 012        button = GetComponent<ButtonComponentView>();
 013        button.onClick.AddListener(GoToUrl);
 014    }
 15
 16    private void OnDestroy()
 17    {
 618        if (button != null)
 019            button.onClick.RemoveAllListeners();
 620    }
 21
 22    internal void GoToUrl()
 23    {
 024        if (string.IsNullOrEmpty(urlToGo))
 025            return;
 26
 027        Application.OpenURL(urlToGo);
 028    }
 29}

Methods/Properties

Start()
OnDestroy()
GoToUrl()