< Summary

Class:UIToggle
Assembly:AvatarEditorHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/AvatarEditorHUD/Scripts/UIToggle.cs
Covered lines:5
Uncovered lines:4
Coverable lines:9
Total lines:34
Line coverage:55.5% (5 of 9)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
OnDestroy()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/AvatarEditorHUD/Scripts/UIToggle.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using UnityEngine;
 5using UnityEngine.UI;
 6
 7[RequireComponent(typeof(Toggle))]
 8public abstract class UIToggle : MonoBehaviour
 9{
 10    protected Toggle toggle;
 11
 12    public bool isOn
 13    {
 014        get { return toggle.isOn; }
 15        set
 16        {
 017            if (value != toggle.isOn)
 18            {
 019                toggle.isOn = value;
 20            }
 021        }
 22    }
 23
 24    protected void Awake()
 25    {
 69426        toggle = GetComponent<Toggle>();
 69427        OnValueChanged(toggle.isOn);
 69428        toggle.onValueChanged.AddListener(OnValueChanged);
 69429    }
 30
 138831    private void OnDestroy() { toggle.onValueChanged.RemoveListener(OnValueChanged); }
 32
 33    protected abstract void OnValueChanged(bool isOn);
 34}