< Summary

Class:MainScripts.DCL.Controllers.HUD.SettingsPanelHUDDesktop.Scripts.WindowModeControlController
Assembly:SettingsPanelHUDDesktop
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Desktop/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUDDesktop/Scripts/WindowModeControlController.cs
Covered lines:0
Uncovered lines:16
Coverable lines:16
Total lines:50
Line coverage:0% (0 of 16)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:4
Method coverage:0% (0 of 4)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetStoredValue()0%2100%
UpdateSetting(...)0%20400%
SetupBorderless()0%2100%
UpdateResolution()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Desktop/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUDDesktop/Scripts/WindowModeControlController.cs

#LineLine coverage
 1using System;
 2using MainScripts.DCL.Controllers.SettingsDesktop;
 3using MainScripts.DCL.Controllers.SettingsDesktop.SettingsControllers;
 4using MainScripts.DCL.ScriptableObjectsDesktop;
 5using UnityEngine;
 6
 7namespace MainScripts.DCL.Controllers.HUD.SettingsPanelHUDDesktop.Scripts
 8{
 9    [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Window Mode",
 10        fileName = "WindowModeControlController")]
 11    public class WindowModeControlController : SpinBoxSettingsControlControllerDesktop
 12    {
 13        public override object GetStoredValue()
 14        {
 015            return (int)currentDisplaySettings.windowMode;
 16        }
 17
 18        public override void UpdateSetting(object newValue)
 19        {
 020            currentDisplaySettings.windowMode = (WindowMode)(int)newValue;
 21
 022            switch (currentDisplaySettings.windowMode)
 23            {
 24                case WindowMode.Windowed:
 25                case WindowMode.FullScreen:
 026                    UpdateResolution();
 027                    break;
 28                case WindowMode.Borderless:
 029                    SetupBorderless();
 030                    break;
 31                default:
 032                    throw new ArgumentOutOfRangeException();
 33            }
 34
 035            CommonScriptableObjectsDesktop.disableVSync.Set(currentDisplaySettings.windowMode == WindowMode.Windowed);
 036            CommonScriptableObjectsDesktop.disableScreenResolution.Set(currentDisplaySettings.windowMode == WindowMode.B
 037        }
 38
 39        private void SetupBorderless()
 40        {
 041            ApplySettings();
 042            UpdateResolution();
 043        }
 44
 45        private void UpdateResolution()
 46        {
 047            ScreenResolutionUtils.Apply(currentDisplaySettings);
 048        }
 49    }
 50}