< Summary

Class:GDX.Developer.Reports.Resource.Objects.TextureObjectInfo
Assembly:GDX
File(s):D:/BuildAgent/work/GDX-Documentation/Projects/GDX_Development/Packages/com.dotbunny.gdx/GDX/Developer/Reports/Resource/Objects/TextureObjectInfo.cs
Covered lines:20
Uncovered lines:6
Coverable lines:26
Total lines:76
Line coverage:76.9% (20 of 26)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:3
Method coverage:66.6% (2 of 3)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Clone()0%2100%
Populate(...)0%110100%
GetDetailedInformation(...)0%5.25080%

File(s)

D:/BuildAgent/work/GDX-Documentation/Projects/GDX_Development/Packages/com.dotbunny.gdx/GDX/Developer/Reports/Resource/Objects/TextureObjectInfo.cs

#LineLine coverage
 1// Copyright (c) 2020-2022 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5#if !UNITY_DOTSRUNTIME
 6
 7using UnityEngine;
 8using UnityEngine.Experimental.Rendering;
 9
 10namespace GDX.Developer.Reports.Resource.Objects
 11{
 12    /// <exception cref="UnsupportedRuntimeException">Not supported on DOTS Runtime.</exception>
 13    public sealed class TextureObjectInfo : ObjectInfo
 14    {
 15        public new const string TypeDefinition = "GDX.Developer.Reports.Resource.Objects.TextureObjectInfo,GDX";
 16        public GraphicsFormat Format;
 17        public int Height;
 18
 19        public bool IsReadable;
 20        public int Width;
 21
 22        /// <summary>
 23        /// Create a clone of this object.
 24        /// </summary>
 25        /// <returns></returns>
 26        public override ObjectInfo Clone()
 027        {
 028            return new TextureObjectInfo()
 29            {
 30                CopyCount = CopyCount,
 31                MemoryUsage = MemoryUsage,
 32                Name = Name,
 33                Reference = Reference,
 34                TotalMemoryUsage = TotalMemoryUsage,
 35                Type = Type,
 36                Height = Height,
 37                IsReadable = IsReadable,
 38                Width = Width,
 39                Format = Format
 40            };
 041        }
 42
 43        public override void Populate(Object targetObject, TransientReference reference = null)
 314444        {
 314445            base.Populate(targetObject, reference);
 314446            Texture textureAsset = (Texture)targetObject;
 47
 48            // Useful texture information
 314449            Width = textureAsset.width;
 314450            Height = textureAsset.height;
 314451            IsReadable = textureAsset.isReadable;
 314452            Format = textureAsset.graphicsFormat;
 314453        }
 54
 55        public override string GetDetailedInformation(int maximumWidth)
 316456        {
 57
 58            // Always a width of 11
 316459            string size = $"{Width.ToString()}x{Height.ToString()}".PadRight(11);
 60
 316461            int formatWidth = maximumWidth - 15;
 316462            string format = Format.ToString();
 316463            if (format.IsNumeric())
 81264            {
 81265                format = $"Unknown ({format})";
 81266            }
 316467            format = format.PadRight(formatWidth);
 316468            if (format.Length > formatWidth)
 069            {
 070                format = format.Substring(0, formatWidth);
 071            }
 316472            return $"{size} {format} {(IsReadable ? "RW" : "")}";
 316473        }
 74    }
 75}
 76#endif