< Summary

Class:GDX.Developer.Reports.Resource.Objects.TextureObjectInfo
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/Developer/Reports/Resource/Objects/TextureObjectInfo.cs
Covered lines:20
Uncovered lines:6
Coverable lines:26
Total lines:77
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)

./Packages/com.dotbunny.gdx/GDX/Developer/Reports/Resource/Objects/TextureObjectInfo.cs

#LineLine coverage
 1// Copyright (c) 2020-2024 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)
 315644        {
 315645            base.Populate(targetObject, reference);
 315646            Texture textureAsset = (Texture)targetObject;
 47
 48            // Useful texture information
 315649            Width = textureAsset.width;
 315650            Height = textureAsset.height;
 315651            IsReadable = textureAsset.isReadable;
 315652            Format = textureAsset.graphicsFormat;
 315653        }
 54
 55        public override string GetDetailedInformation(int maximumWidth)
 317256        {
 57            // Always a width of 11
 317258            string size = $"{Width.ToString()}x{Height.ToString()}".PadRight(11);
 59
 317260            int formatWidth = maximumWidth - 15;
 317261            string format = Format.ToString();
 317262            if (format.IsNumeric())
 82863            {
 82864                format = $"Unknown ({format})";
 82865            }
 66
 317267            format = format.PadRight(formatWidth);
 317268            if (format.Length > formatWidth)
 069            {
 070                format = format.Substring(0, formatWidth);
 071            }
 72
 317273            return $"{size} {format} {(IsReadable ? "RW" : "")}";
 317274        }
 75    }
 76}
 77#endif // !UNITY_DOTSRUNTIME

Coverage by test methods





Methods/Properties

Clone()
Populate(UnityEngine.Object, GDX.Developer.TransientReference)
GetDetailedInformation(System.Int32)