< Summary

Class:SwitchToggle
Assembly:UIHelpers
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/UIHelpers/SwitchToggle/Scripts/SwitchToggle.cs
Covered lines:9
Uncovered lines:0
Coverable lines:9
Total lines:24
Line coverage:100% (9 of 9)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SwitchToggle()0%110100%
Awake()0%110100%
OnEnable()0%110100%
OnValueChanged(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/UIHelpers/SwitchToggle/Scripts/SwitchToggle.cs

#LineLine coverage
 1using UnityEngine;
 2using UnityEngine.UI;
 3
 4public class SwitchToggle : Toggle
 5{
 16    private static readonly int animatorOnBoolean = Animator.StringToHash("isOn");
 7
 8    [SerializeField] Animator switchAnimator;
 9
 10    protected override void Awake()
 11    {
 1612        base.Awake();
 1613        OnValueChanged(this.isOn);
 1614        this.onValueChanged.AddListener(OnValueChanged);
 1615    }
 16
 17    protected override void OnEnable()
 18    {
 1719        base.OnEnable();
 1720        OnValueChanged(this.isOn);
 1721    }
 22
 7023    private void OnValueChanged(bool value) { switchAnimator.SetBool(animatorOnBoolean, value); }
 24}