< Summary

Class:PreviewMenuPlugin
Assembly:DebugPlugins_PreviewMenu
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/DebugPlugins/PreviewMenu/PreviewMenuPlugin.cs
Covered lines:19
Uncovered lines:0
Coverable lines:19
Total lines:47
Line coverage:100% (19 of 19)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PreviewMenuPlugin()0%110100%
PreviewMenuPlugin(...)0%110100%
Dispose()0%110100%
InitializeView()0%220100%
DisposeView()0%220100%
OnIsPreviewMenuActiveChange(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/DebugPlugins/PreviewMenu/PreviewMenuPlugin.cs

#LineLine coverage
 1using DCL;
 2
 3public class PreviewMenuPlugin : IPlugin
 4{
 5    private readonly IBaseVariable<bool> isPreviewMenuActive;
 6
 7    internal PreviewMenuController menuController;
 8
 29    public PreviewMenuPlugin() : this(DataStore.i.debugConfig.isPreviewMenuActive) { }
 10
 311    internal PreviewMenuPlugin(IBaseVariable<bool> isPreviewMenuActive)
 12    {
 313        this.isPreviewMenuActive = isPreviewMenuActive;
 314        isPreviewMenuActive.OnChange += OnIsPreviewMenuActiveChange;
 15
 316        OnIsPreviewMenuActiveChange(isPreviewMenuActive.Get(), false);
 317    }
 18
 19    public void Dispose()
 20    {
 321        isPreviewMenuActive.OnChange -= OnIsPreviewMenuActiveChange;
 322        DisposeView();
 323    }
 24
 25    private void InitializeView()
 26    {
 227        menuController ??= new PreviewMenuController();
 228    }
 29
 30    private void DisposeView()
 31    {
 532        menuController?.Dispose();
 533        menuController = null;
 534    }
 35
 36    private void OnIsPreviewMenuActiveChange(bool current, bool previous)
 37    {
 438        if (current)
 39        {
 240            InitializeView();
 241        }
 42        else
 43        {
 244            DisposeView();
 45        }
 246    }
 47}