< Summary

Class:DCL.GLTFast.Wrappers.GltfTextureDownloaderWrapper
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/GLTFast/Wrappers/GLTFTextureDownloaderWrapper.cs
Covered lines:0
Uncovered lines:16
Coverable lines:16
Total lines:49
Line coverage:0% (0 of 16)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GltfTextureDownloaderWrapper(...)0%2100%
MoveNext()0%2100%
Dispose()0%2100%

File(s)

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

#LineLine coverage
 1using System;
 2using GLTFast.Loading;
 3using UnityEngine;
 4using UnityEngine.Networking;
 5
 6namespace DCL.GLTFast.Wrappers
 7{
 8    internal class GltfTextureDownloaderWrapper : ITextureDownload
 9    {
 10        private readonly IWebRequestAsyncOperation asyncOp;
 11
 012        public GltfTextureDownloaderWrapper(IWebRequestAsyncOperation asyncOp)
 13        {
 014            this.asyncOp = asyncOp;
 015        }
 16
 017        public bool Success => asyncOp.isSucceeded;
 018        public string Error => asyncOp.webRequest.error;
 019        public byte[] Data => asyncOp.webRequest.downloadHandler.data;
 020        public string Text => asyncOp.webRequest.downloadHandler.text;
 021        public bool? IsBinary => true;
 22
 23        public bool MoveNext() =>
 024            asyncOp.MoveNext();
 25
 26        public Texture2D Texture
 27        {
 28            get
 29            {
 30                Texture2D texture2D;
 31
 032                if (asyncOp.webRequest.downloadHandler is DownloadHandlerTexture downloadHandlerTexture) { texture2D = d
 033                else { return null; }
 34
 35#if UNITY_WEBGL
 036                texture2D.Compress(false);
 37#endif
 038                texture2D = TextureHelpers.ClampSize(texture2D, DataStore.i.textureConfig.gltfMaxSize.Get(), true);
 39
 040                return texture2D;
 41            }
 42        }
 43
 44        public void Dispose()
 45        {
 046            asyncOp.Dispose();
 047        }
 48    }
 49}