< Summary

Class:DCL.AssetPromise_Gif
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Gif/AssetPromise_Gif.cs
Covered lines:14
Uncovered lines:3
Coverable lines:17
Total lines:47
Line coverage:82.3% (14 of 17)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AssetPromise_Gif(...)0%2100%
GetId()0%110100%
OnLoad(...)0%110100%
OnCancelLoading()0%110100%
AddToLibrary()0%2.262060%
OnBeforeLoadOrReuse()0%110100%
OnAfterLoadOrReuse()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Gif/AssetPromise_Gif.cs

#LineLine coverage
 1using System;
 2using UnityEngine;
 3
 4namespace DCL
 5{
 6    public class AssetPromise_Gif : AssetPromise<Asset_Gif>
 7    {
 8        private readonly string url;
 9        private Coroutine loadingRoutine;
 10
 011        public AssetPromise_Gif(string url) { this.url = url; }
 12
 7413        public override object GetId() { return url; }
 14
 15        protected override void OnLoad(Action OnSuccess, Action OnFail)
 16        {
 1217            var processor = new GifProcessor(url);
 1218            asset.processor = processor;
 1219            loadingRoutine = CoroutineStarter.Start(
 20                processor.Load(
 21                    frames =>
 22                    {
 523                        asset.frames = frames;
 24
 525                        OnSuccess?.Invoke();
 526                    }, OnFail));
 1227        }
 28
 1429        protected override void OnCancelLoading() { CoroutineStarter.Stop(loadingRoutine); }
 30
 31        protected override bool AddToLibrary()
 32        {
 533            if (!library.Add(asset))
 34            {
 035                Debug.Log("add to library fail?");
 036                return false;
 37            }
 38
 539            asset = library.Get(asset.id);
 540            return true;
 41        }
 42
 1543        protected override void OnBeforeLoadOrReuse() { }
 44
 845        protected override void OnAfterLoadOrReuse() { }
 46    }
 47}