< Summary

Class:DCL.SettingsPanelHUD.Controls.DropdownItemColorSwap
Assembly:SettingsPanelHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUD/Scripts/ControlsModule/DropdownItemColorSwap.cs
Covered lines:0
Uncovered lines:8
Coverable lines:8
Total lines:34
Line coverage:0% (0 of 8)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
OnEnable()0%2100%
OnDisable()0%2100%
OnValueChanged(...)0%30500%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUD/Scripts/ControlsModule/DropdownItemColorSwap.cs

#LineLine coverage
 1using TMPro;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5namespace DCL.SettingsPanelHUD.Controls
 6{
 7    public class DropdownItemColorSwap : MonoBehaviour
 8    {
 9        [SerializeField] private Toggle toggle;
 10        [SerializeField] private TextMeshProUGUI targetText;
 11        [SerializeField] private Image targetBackground;
 12        [SerializeField] private Color textOn;
 13        [SerializeField] private Color textOff;
 14        [SerializeField] private Color bgOn;
 15        [SerializeField] private Color bgOff;
 16
 17        private void OnEnable()
 18        {
 019            toggle.onValueChanged.AddListener(OnValueChanged);
 020            OnValueChanged(toggle.isOn);
 021        }
 22
 23        private void OnDisable()
 24        {
 025            toggle.onValueChanged.RemoveListener(OnValueChanged);
 026        }
 27
 28        private void OnValueChanged(bool value)
 29        {
 030            targetText.color = value ? textOn : textOff;
 031            targetBackground.color = value ? bgOn : bgOff;
 032        }
 33    }
 34}