< Summary

Class:ColorToggle
Assembly:AvatarEditorHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/AvatarEditorHUD/Scripts/ColorToggle.cs
Covered lines:10
Uncovered lines:5
Coverable lines:15
Total lines:45
Line coverage:66.6% (10 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
Initialize(...)0%110100%
OnClick()0%6200%

File(s)

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

#LineLine coverage
 1using UnityEngine;
 2using UnityEngine.UI;
 3
 4public class ColorToggle : UIButton
 5{
 06    public Color color { get; private set; }
 7
 8    [SerializeField]
 9    private Image colorPicker;
 10
 11    [SerializeField]
 12    private Image selectionHighlight;
 13
 14    private bool selectedValue;
 15
 16    public bool selected
 17    {
 018        get { return selectedValue; }
 19        set
 20        {
 155521            selectedValue = value;
 155522            selectionHighlight.enabled = selectedValue;
 155523        }
 24    }
 25
 26    public event System.Action<ColorToggle> OnClicked;
 27
 28    private new void Awake()
 29    {
 91030        base.Awake();
 91031        Application.quitting += () =>
 32        {
 033            OnClicked = null;
 034        };
 91035    }
 36
 37    public void Initialize(Color c, bool on)
 38    {
 138039        color = c;
 138040        colorPicker.color = color;
 138041        selected = on;
 138042    }
 43
 044    protected override void OnClick() { OnClicked?.Invoke(this); }
 45}