< Summary

Class:DCL.ContentModeration.ContentModerationRatingButtonComponentView
Assembly:ContentModerationHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/ContentModerationHUD/ContentModerationRatingButtonComponentView.cs
Covered lines:0
Uncovered lines:17
Coverable lines:17
Total lines:53
Line coverage:0% (0 of 17)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:7
Method coverage:0% (0 of 7)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%6200%
RefreshControl()0%2100%
Select(...)0%56700%
SetCurrentMarkActive(...)0%2100%

File(s)

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

#LineLine coverage
 1using System.Collections.Generic;
 2using TMPro;
 3using UnityEngine;
 4using UnityEngine.UI;
 5
 6namespace DCL.ContentModeration
 7{
 8    public class ContentModerationRatingButtonComponentView : BaseComponentView
 9    {
 10        [SerializeField] private Button ratingButton;
 11        [SerializeField] private GameObject selectedContainer;
 12        [SerializeField] private GameObject unselectedContainer;
 13        [SerializeField] private Color selectedColor;
 14        [SerializeField] private Color unselectedColor;
 15        [SerializeField] private Color backgroundNormalColor;
 16        [SerializeField] private Color backgroundMarkedColor;
 17        [SerializeField] private List<TMP_Text> texts;
 18        [SerializeField] private List<Image> imagesToColor;
 19        [SerializeField] private GameObject currentMark;
 20        [SerializeField] private List<Image> backgroundImages;
 21
 022        public Button RatingButton => ratingButton;
 023        public bool IsMarked { get; private set; }
 24
 25        public override void Awake()
 26        {
 027            base.Awake();
 28
 029            foreach (Image image in imagesToColor)
 030                image.color = selectedColor;
 031        }
 32
 033        public override void RefreshControl() { }
 34
 35        public void Select(bool isSelected)
 36        {
 037            selectedContainer.SetActive(isSelected);
 038            unselectedContainer.SetActive(!isSelected);
 39
 040            foreach (TMP_Text text in texts)
 041                text.color = IsMarked ? selectedColor : unselectedColor;
 42
 043            foreach (Image background in backgroundImages)
 044                background.color = IsMarked && isSelected ? backgroundMarkedColor : backgroundNormalColor;
 045        }
 46
 47        public void SetCurrentMarkActive(bool isActive)
 48        {
 049            IsMarked = isActive;
 050            currentMark.SetActive(isActive);
 051        }
 52    }
 53}