< Summary

Class:DCL.ContentModeration.ContentModerationReportingButtonComponentView
Assembly:ContentModerationHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/ContentModerationHUD/ContentModerationReportingButtonComponentView.cs
Covered lines:6
Uncovered lines:9
Coverable lines:15
Total lines:55
Line coverage:40% (6 of 15)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:6
Method coverage:33.3% (2 of 6)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
Dispose()0%110100%
RefreshControl()0%2100%
Show()0%2100%
Hide()0%2100%
SetContentCategory(...)0%20400%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/ContentModerationHUD/ContentModerationReportingButtonComponentView.cs

#LineLine coverage
 1using DCL.Controllers;
 2using System;
 3using UnityEngine;
 4using UnityEngine.UI;
 5
 6namespace DCL.ContentModeration
 7{
 8    public class ContentModerationReportingButtonComponentView : BaseComponentView, IContentModerationReportingButtonCom
 9    {
 10        [SerializeField] private Button contentModerationButton;
 11        [SerializeField] private Image flagImage;
 12        [SerializeField] private Sprite teenFlagIcon;
 13        [SerializeField] private Sprite adultFlagIcon;
 14        [SerializeField] private Sprite restrictedFlagIcon;
 15
 16        public event Action OnContentModerationPressed;
 17
 18        public override void Awake()
 19        {
 1020            base.Awake();
 1021            contentModerationButton.onClick.AddListener(() => OnContentModerationPressed?.Invoke());
 1022        }
 23
 24        public override void Dispose()
 25        {
 1026            contentModerationButton.onClick.RemoveAllListeners();
 1027            base.Dispose();
 1028        }
 29
 030        public override void RefreshControl() { }
 31
 32        public void Show() =>
 033            base.Show();
 34
 35        public void Hide() =>
 036            base.Hide();
 37
 38        public void SetContentCategory(SceneContentCategory contentCategory)
 39        {
 40            switch (contentCategory)
 41            {
 42                case SceneContentCategory.ADULT:
 043                    flagImage.sprite = adultFlagIcon;
 044                    break;
 45                case SceneContentCategory.RESTRICTED:
 046                    flagImage.sprite = restrictedFlagIcon;
 047                    break;
 48                case SceneContentCategory.TEEN:
 49                default:
 050                    flagImage.sprite = teenFlagIcon;
 51                    break;
 52            }
 053        }
 54    }
 55}