< Summary

Class:DCL.SettingsCommon.SettingsControllers.SpecificControllers.FPSLimitControlController
Assembly:SettingsControllers
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/FPSLimitControlController.cs
Covered lines:6
Uncovered lines:0
Coverable lines:6
Total lines:31
Line coverage:100% (6 of 6)
Covered branches:0
Total branches:0

Metrics

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

File(s)

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

#LineLine coverage
 1using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 2using UnityEngine;
 3#if UNITY_WEBGL && !UNITY_EDITOR
 4using System.Runtime.InteropServices;
 5#endif
 6
 7namespace DCL.SettingsCommon.SettingsControllers.SpecificControllers
 8{
 9    [CreateAssetMenu(menuName = "Settings/Controllers/Controls/FPS Limit", fileName = "FPSLimitControlController")]
 10    public class FPSLimitControlController : ToggleSettingsControlController
 11    {
 12        const int MAX_FPS = 240;
 13
 214        public override object GetStoredValue() { return currentQualitySetting.fpsCap; }
 15
 16        public override void UpdateSetting(object newValue)
 17        {
 218            currentQualitySetting.fpsCap = (bool)newValue;
 219            ToggleFPSCap(currentQualitySetting.fpsCap);
 220        }
 21
 22#if UNITY_WEBGL && !UNITY_EDITOR
 23        [DllImport("__Internal")] public static extern void ToggleFPSCap(bool useFPSCap);
 24#else
 25        public static void ToggleFPSCap(bool useFPSCap)
 26        {
 227            Application.targetFrameRate = useFPSCap ? 30 : MAX_FPS;
 228        }
 29#endif
 30    }
 31}