< 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:43
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
 14        public event System.Action OnCleanup;
 15
 16        public void ConfigureTexture(TextureWrapMode textureWrapMode, FilterMode textureFilterMode, bool makeNoLongerRea
 17        {
 5318            if (texture == null)
 019                return;
 20
 5321            texture.wrapMode = textureWrapMode;
 5322            texture.filterMode = textureFilterMode;
 23
 24#if !UNITY_STANDALONE
 25            texture.Compress(false);
 26#endif
 27
 5328            texture.Apply(textureFilterMode != FilterMode.Point, makeNoLongerReadable);
 5329        }
 30
 31        public override void Cleanup()
 32        {
 11633            OnCleanup?.Invoke();
 11634            PersistentAssetCache.RemoveImage(texture);
 11635            Object.Destroy(texture);
 11636        }
 37
 038        public void Dispose() { Cleanup(); }
 39
 040        public int width => texture.width;
 041        public int height => texture.height;
 42    }
 43}