< Summary

Class:MainScripts.DCL.Controllers.HUD.SettingsPanelHUDDesktop.Scripts.ScreenResolutionUtils
Assembly:SettingsPanelHUDDesktop
File(s):/tmp/workspace/explorer-desktop/unity-renderer-desktop/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUDDesktop/Scripts/ScreenResolutionUtils.cs
Covered lines:0
Uncovered lines:6
Coverable lines:6
Total lines:26
Line coverage:0% (0 of 6)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Apply(...)0%2100%
GetResolution(...)0%2100%

File(s)

/tmp/workspace/explorer-desktop/unity-renderer-desktop/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUDDesktop/Scripts/ScreenResolutionUtils.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using MainScripts.DCL.Controllers.SettingsDesktop;
 3using UnityEngine;
 4
 5namespace MainScripts.DCL.Controllers.HUD.SettingsPanelHUDDesktop.Scripts
 6{
 7    public static class ScreenResolutionUtils
 8    {
 9        private static Resolution[] resolutions;
 010        public static IReadOnlyList<Resolution> Resolutions => resolutions ??= Screen.resolutions;
 11
 12        public static void Apply(DisplaySettings displaySettings)
 13        {
 014            var fullscreenMode = displaySettings.GetFullScreenMode();
 15
 016            var resolution = GetResolution(displaySettings);
 017            Screen.SetResolution(resolution.width, resolution.height, fullscreenMode, resolution.refreshRate);
 018        }
 19
 20        // Resolution list goes from the smallest to the biggest, our index is inverted for usage reasons so 0 is the bi
 21        private static Resolution GetResolution(DisplaySettings displaySettings)
 22        {
 023            return Resolutions[Resolutions.Count - 1 - displaySettings.resolutionSizeIndex];
 24        }
 25    }
 26}