< Summary

Class:DCL.SettingsPanelHUD.Controls.ToggleSettingsControlView
Assembly:SettingsPanelHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUD/Scripts/ControlsModule/ToggleSettingsControlView.cs
Covered lines:10
Uncovered lines:3
Coverable lines:13
Total lines:40
Line coverage:76.9% (10 of 13)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize(...)0%110100%
RefreshControl()0%220100%

File(s)

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

#LineLine coverage
 1using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5namespace DCL.SettingsPanelHUD.Controls
 6{
 7    /// <summary>
 8    /// MonoBehaviour that represents the view of a TOGGLE type CONTROL.
 9    /// </summary>
 10    public class ToggleSettingsControlView : SettingsControlView
 11    {
 12        [SerializeField] private Toggle toggle;
 13
 014        public Toggle toggleControl { get => toggle; }
 15
 16        private ToggleSettingsControlController toggleController;
 17
 18        public override void Initialize(SettingsControlModel controlConfig, SettingsControlController settingsControlCon
 19        {
 1120            toggleController = (ToggleSettingsControlController)settingsControlController;
 21
 1122            base.Initialize(controlConfig, toggleController);
 1123            toggleController.UpdateSetting(toggle.isOn);
 24
 1125            toggle.onValueChanged.AddListener(isOn =>
 26            {
 027                ApplySetting(isOn);
 028            });
 1129        }
 30
 31        public override void RefreshControl()
 32        {
 1133            base.RefreshControl();
 34
 1135            bool newValue = (bool)toggleController.GetStoredValue();
 1136            if (toggle.isOn != newValue)
 237                toggle.isOn = newValue;
 1138        }
 39    }
 40}