< Summary

Class:MainScripts.DCL.Controllers.Settings.SettingsControllers.SpecificControllers.ShaderQualityControlController
Assembly:SettingsControllers
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/ShaderQualityControlController.cs
Covered lines:10
Uncovered lines:11
Coverable lines:21
Total lines:47
Line coverage:47.6% (10 of 21)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:3
Method coverage:100% (3 of 3)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ShaderQualityControlController()0%110100%
GetStoredValue()0%110100%
UpdateSetting(...)0%9.855042.11%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/ShaderQualityControlController.cs

#LineLine coverage
 1using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 2using System;
 3using UnityEngine;
 4using ShaderQuality = DCL.SettingsCommon.QualitySettings.ShaderQuality;
 5
 6namespace MainScripts.DCL.Controllers.Settings.SettingsControllers.SpecificControllers
 7{
 8    [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Shader Quality", fileName = "ShaderQualityControlControll
 9    public class ShaderQualityControlController : SpinBoxSettingsControlController
 10    {
 11        [SerializeField] private OutlineScreenEffectFeature outlineScreenEffectFeature;
 12
 113        private static readonly int GAUSSIAN_BLUR_KERNEL_SIZE = Shader.PropertyToID("gaussianBlurQuality");
 14
 15        public override object GetStoredValue() =>
 116            (int)currentQualitySetting.shaderQuality;
 17
 18        public override void UpdateSetting(object newValue)
 19        {
 120            OutlineScreenEffectFeature.OutlineSettings outlineSettings = outlineScreenEffectFeature.settings;
 121            currentQualitySetting.shaderQuality = (ShaderQuality)newValue;
 22
 123            switch (currentQualitySetting.shaderQuality)
 24            {
 25                case ShaderQuality.LOW:
 126                    Shader.SetGlobalInt(GAUSSIAN_BLUR_KERNEL_SIZE, 4);
 127                    outlineSettings.blurSize = 1;
 128                    outlineSettings.blurSigma = 5;
 129                    outlineSettings.outlineThickness = 0.5f;
 130                    break;
 31                case ShaderQuality.MID:
 032                    Shader.SetGlobalInt(GAUSSIAN_BLUR_KERNEL_SIZE, 32);
 033                    outlineSettings.blurSize = 1.5f;
 034                    outlineSettings.blurSigma = 5.5f;
 035                    outlineSettings.outlineThickness = 0.75f;
 036                    break;
 37                case ShaderQuality.HIGH:
 038                    Shader.SetGlobalInt(GAUSSIAN_BLUR_KERNEL_SIZE, 64);
 039                    outlineSettings.blurSize = 2;
 040                    outlineSettings.blurSigma = 6;
 041                    outlineSettings.outlineThickness = 1;
 042                    break;
 043                default: throw new ArgumentOutOfRangeException();
 44            }
 45        }
 46    }
 47}