< Summary

Class:DCL.GLTFast.Wrappers.GLTFastTexturePromiseWrapper
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/GLTFast/Wrappers/GLTFTextureDownloaderWrapper.cs
Covered lines:15
Uncovered lines:6
Coverable lines:21
Total lines:54
Line coverage:71.4% (15 of 21)
Covered branches:0
Total branches:0
Covered methods:6
Total methods:12
Method coverage:50% (6 of 12)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GLTFastTexturePromiseWrapper(...)0%110100%
Dispose()0%220100%
GetTexture(...)0%110100%
OnSuccess(...)0%110100%
OnFail(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/GLTFast/Wrappers/GLTFTextureDownloaderWrapper.cs

#LineLine coverage
 1using GLTFast;
 2using System;
 3using GLTFast.Loading;
 4
 5namespace DCL.GLTFast.Wrappers
 6{
 7    internal class GLTFastTexturePromiseWrapper : ITextureDownload
 8    {
 9        private readonly AssetPromiseKeeper_Texture texturePromiseKeeper;
 10        private AssetPromise_Texture assetPromiseTexture;
 11
 3412        public GLTFastTexturePromiseWrapper(AssetPromiseKeeper_Texture texturePromiseKeeper, AssetPromise_Texture assetP
 13        {
 3414            this.texturePromiseKeeper = texturePromiseKeeper;
 3415            this.assetPromiseTexture = assetPromiseTexture;
 16
 3417            this.assetPromiseTexture.OnSuccessEvent += OnSuccess;
 3418            assetPromiseTexture.OnFailEvent += OnFail;
 3419        }
 20
 21        public void Dispose()
 22        {
 10223            if (assetPromiseTexture == null) return;
 24
 3425            assetPromiseTexture.OnSuccessEvent -= OnSuccess;
 3426            assetPromiseTexture.OnFailEvent -= OnFail;
 27
 3428            assetPromiseTexture = null;
 3429        }
 30
 10231        public bool Success { get; private set; }
 32
 033        public string Error { get; private set; }
 34
 035        public byte[] Data => Array.Empty<byte>();
 36
 037        public string Text => string.Empty;
 38
 039        public bool? IsBinary => true;
 40
 41        public IDisposableTexture GetTexture(bool forceSampleLinear) =>
 3442            new GLTFastDisposableDisposableTexturePromise(assetPromiseTexture, texturePromiseKeeper);
 43
 44        private void OnSuccess(Asset_Texture assetTexture)
 45        {
 3446            Success = true;
 3447        }
 48
 49        private void OnFail(Asset_Texture arg1, Exception arg2)
 50        {
 051            Error = arg2.ToString();
 052        }
 53    }
 54}