< Summary

Class:DCL.SettingsPanelHUD.Widgets.SettingsWidgetController
Assembly:SettingsPanelHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUD/Scripts/WidgetsModule/SettingsWidgetController.cs
Covered lines:5
Uncovered lines:0
Coverable lines:5
Total lines:45
Line coverage:100% (5 of 5)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SettingsWidgetController()0%110100%
AddControl(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUD/Scripts/WidgetsModule/SettingsWidgetController.cs

#LineLine coverage
 1using DCL.SettingsPanelHUD.Controls;
 2using System.Collections.Generic;
 3using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 4using UnityEngine;
 5
 6namespace DCL.SettingsPanelHUD.Widgets
 7{
 8    /// <summary>
 9    /// Interface to implement a controller for a WIDGET.
 10    /// </summary>
 11    public interface ISettingsWidgetController
 12    {
 13        /// <summary>
 14        /// List of all CONTROLS added to the WIDGET.
 15        /// </summary>
 16        List<ISettingsControlView> controls { get; }
 17
 18        /// <summary>
 19        /// Adds a CONTROL into the WIDGET.
 20        /// </summary>
 21        /// <param name="newControl">New CONTROL that will be added.</param>
 22        /// <param name="newControlController">Controller belonging to the new CONTROL.</param>
 23        /// <param name="controlConfig">Model that will contain the configuration of the new CONTROL.</param>
 24        void AddControl(ISettingsControlView newControl, SettingsControlController newControlController, SettingsControl
 25    }
 26
 27    /// <summary>
 28    /// This controller is in charge of manage all the logic related to a WIDGET.
 29    /// </summary>
 30    [CreateAssetMenu(menuName = "Settings/Controllers/Widget", fileName = "SettingsWidgetController")]
 31    public class SettingsWidgetController : ScriptableObject, ISettingsWidgetController
 32    {
 733        public List<ISettingsControlView> controls { get; } = new List<ISettingsControlView>();
 34
 35        public void AddControl(
 36            ISettingsControlView newControl,
 37            SettingsControlController newControlController,
 38            SettingsControlModel controlConfig)
 39        {
 2840            newControl.Initialize(controlConfig, newControlController);
 2841            controls.Add(newControl);
 2842            SettingsPanelDataStore.i.controls.controlControllers.Add(newControlController);
 2843        }
 44    }
 45}