< Summary

Line coverage
86%
Covered lines: 20
Uncovered lines: 3
Coverable lines: 23
Total lines: 71
Line coverage: 86.9%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
get_Color()100%11100%
get_UseXYZColorSpace()100%11100%
get_SpectralFileName()100%11100%
get_SpectralFactor()100%11100%
get_IsSpectral()100%11100%
get_IsRGB()100%22100%
get_IsXYZ()100%22100%
ToDebuggerDisplayString()0%2040%

File(s)

https://raw.githubusercontent.com/JeremyAnsel/JeremyAnsel.Media.WavefrontObj/dbbfcd213b7c54f49194f82fcd56e790cca193c3/JeremyAnsel.Media.WavefrontObj/JeremyAnsel.Media.WavefrontObj/ObjMaterialColor.cs

#LineLine coverage
 1// <copyright file="ObjMaterialColor.cs" company="Jérémy Ansel">
 2// Copyright (c) 2017, 2019 Jérémy Ansel
 3// </copyright>
 4// <license>
 5// Licensed under the MIT license. See LICENSE.txt
 6// </license>
 7
 8namespace JeremyAnsel.Media.WavefrontObj
 9{
 10    [System.Diagnostics.DebuggerDisplay("{ToDebuggerDisplayString(),nq}")]
 11    public class ObjMaterialColor
 12    {
 25213        public ObjMaterialColor()
 14        {
 25215            this.SpectralFactor = 1.0f;
 25216        }
 17
 18        public ObjMaterialColor(float x, float y, float z)
 3019            : this()
 20        {
 3021            this.Color = new ObjVector3(x, y, z);
 3022        }
 23
 24        public ObjMaterialColor(string? spectralFileName)
 1525            : this()
 26        {
 1527            this.SpectralFileName = spectralFileName;
 1528        }
 29
 30        public ObjMaterialColor(string? spectralFileName, float factor)
 1531            : this()
 32        {
 1533            this.SpectralFileName = spectralFileName;
 1534            this.SpectralFactor = factor;
 1535        }
 36
 37537        public ObjVector3 Color { get; set; }
 38
 18339        public bool UseXYZColorSpace { get; set; }
 40
 34541        public string? SpectralFileName { get; set; }
 42
 36643        public float SpectralFactor { get; set; }
 44
 45        public bool IsSpectral
 46        {
 47            get
 48            {
 22249                return !string.IsNullOrWhiteSpace(this.SpectralFileName);
 50            }
 51        }
 52
 53        public bool IsRGB
 54        {
 5455            get { return !this.IsSpectral && !this.UseXYZColorSpace; }
 56        }
 57
 58        public bool IsXYZ
 59        {
 5460            get { return !this.IsSpectral && this.UseXYZColorSpace; }
 61        }
 62
 63        private string ToDebuggerDisplayString()
 64        {
 065            if (IsSpectral) return $"Spectral:{SpectralFileName} Factor:{SpectralFactor}";
 066            if (UseXYZColorSpace) return $"X:{Color.X} Y:{Color.X} Z:{Color.X}";
 067            return $"R:{Color.X} G:{Color.X} B:{Color.X}";
 68        }
 69    }
 70}
 71