< Summary

Class:DCL.Asset_Texture
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Texture/Asset_Texture.cs
Covered lines:9
Uncovered lines:5
Coverable lines:14
Total lines:42
Line coverage:64.2% (9 of 14)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ConfigureTexture(...)0%2.022083.33%
Cleanup()0%220100%
Dispose()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Texture/Asset_Texture.cs

#LineLine coverage
 1using System;
 2using UnityEngine;
 3using UnityEngine.Experimental.Rendering;
 4using UnityGLTF.Cache;
 5using Object = UnityEngine.Object;
 6
 7namespace DCL
 8{
 9    public class Asset_Texture : Asset, ITexture
 10    {
 011        public Texture2D texture { get; set; }
 12        public Asset_Texture dependencyAsset; // to store the default tex asset and release it accordingly
 13        public event System.Action OnCleanup;
 14
 15        public void ConfigureTexture(TextureWrapMode textureWrapMode, FilterMode textureFilterMode, bool makeNoLongerRea
 16        {
 5317            if (texture == null)
 018                return;
 19
 5320            texture.wrapMode = textureWrapMode;
 5321            texture.filterMode = textureFilterMode;
 22
 23#if !UNITY_STANDALONE
 24            texture.Compress(false);
 25#endif
 26
 5327            texture.Apply(textureFilterMode != FilterMode.Point, makeNoLongerReadable);
 5328        }
 29
 30        public override void Cleanup()
 31        {
 11632            OnCleanup?.Invoke();
 11633            PersistentAssetCache.RemoveImage(texture);
 11634            Object.Destroy(texture);
 11635        }
 36
 037        public void Dispose() { Cleanup(); }
 38
 039        public int width => texture.width;
 040        public int height => texture.height;
 41    }
 42}