< Summary

Class:PlayerInfoCollectibleItem
Assembly:PlayerInfoCardHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/PlayerInfoCardHUD/PlayerInfoCollectibleItem.cs
Covered lines:4
Uncovered lines:12
Coverable lines:16
Total lines:45
Line coverage:25% (4 of 16)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize(...)0%3.333066.67%
OnEnable()0%6200%
GetThumbnail()0%2100%
OnThumbnailReady(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/PlayerInfoCardHUD/PlayerInfoCollectibleItem.cs

#LineLine coverage
 1using DCL;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5public class PlayerInfoCollectibleItem : MonoBehaviour
 6{
 7    [SerializeField] private Image thumbnail;
 8
 9    internal WearableItem collectible;
 10    private bool finishedLoading = false;
 11
 12    public void Initialize(WearableItem collectible)
 13    {
 15514        this.collectible = collectible;
 15
 15516        if (this.collectible == null)
 017            return;
 18
 15519        if (gameObject.activeInHierarchy)
 020            GetThumbnail();
 15521    }
 22
 23    private void OnEnable()
 24    {
 025        if (collectible == null)
 026            return;
 27
 028        GetThumbnail();
 029    }
 30
 31    private void GetThumbnail()
 32    {
 033        string url = collectible.ComposeThumbnailUrl();
 34
 35
 036        ThumbnailsManager.GetThumbnail(url, OnThumbnailReady);
 037    }
 38
 39    private void OnThumbnailReady(Asset_Texture texture)
 40    {
 041        thumbnail.sprite = ThumbnailsManager.GetOrCreateSpriteFromTexture(texture.texture, out _);
 42
 043        finishedLoading = true;
 044    }
 45}