< Summary

Class:GDX.Developer.Reports.Resource.Objects.ObjectInfoFactory
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/Developer/Reports/Resource/Objects/ObjectInfoFactory.cs
Covered lines:5
Uncovered lines:25
Coverable lines:30
Total lines:76
Line coverage:16.6% (5 of 30)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:2
Method coverage:50% (1 of 2)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetObjectInfo(...)0%1101000%
GetObjectInfoType(...)0%39.6310033.33%

File(s)

./Packages/com.dotbunny.gdx/GDX/Developer/Reports/Resource/Objects/ObjectInfoFactory.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 System;
 8using UnityEngine;
 9
 10namespace GDX.Developer.Reports.Resource.Objects
 11{
 12    /// <exception cref="UnsupportedRuntimeException">Not supported on DOTS Runtime.</exception>
 13    public static class ObjectInfoFactory
 14    {
 15        public static ObjectInfo GetObjectInfo(Type targetType)
 016        {
 017            if (targetType == typeof(Texture2D) ||
 18                targetType == typeof(Texture3D) ||
 19                targetType == typeof(Texture2DArray) ||
 20                targetType == typeof(RenderTexture) ||
 21                targetType == typeof(Cubemap) ||
 22                targetType == typeof(CubemapArray))
 023            {
 024                return new TextureObjectInfo();
 25            }
 26
 027            if (targetType == typeof(Mesh))
 028            {
 029                return new MeshObjectInfo();
 30            }
 31
 032            if (targetType == typeof(Shader))
 033            {
 034                return new ShaderObjectInfo();
 35            }
 36
 037            if (targetType == typeof(AssetBundle))
 038            {
 039                return new AssetBundleObjectInfo();
 40            }
 41
 042            return new ObjectInfo();
 043        }
 44
 45        public static Type GetObjectInfoType(Type targetType)
 146        {
 147            if (targetType == typeof(Texture2D) ||
 48                targetType == typeof(Texture3D) ||
 49                targetType == typeof(Texture2DArray) ||
 50                targetType == typeof(RenderTexture) ||
 51                targetType == typeof(Cubemap) ||
 52                targetType == typeof(CubemapArray))
 153            {
 154                return typeof(TextureObjectInfo);
 55            }
 56
 057            if (targetType == typeof(Mesh))
 058            {
 059                return typeof(MeshObjectInfo);
 60            }
 61
 062            if (targetType == typeof(Shader))
 063            {
 064                return typeof(ShaderObjectInfo);
 65            }
 66
 067            if (targetType == typeof(AssetBundle))
 068            {
 069                return typeof(AssetBundleObjectInfo);
 70            }
 71
 072            return typeof(ObjectInfo);
 173        }
 74    }
 75}
 76#endif // !UNITY_DOTSRUNTIME

Coverage by test methods


Methods/Properties

GetObjectInfo(System.Type)
GetObjectInfoType(System.Type)