< Summary

Line coverage
100%
Covered lines: 23
Uncovered lines: 0
Coverable lines: 23
Total lines: 71
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
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()100%44100%

File(s)

https://raw.githubusercontent.com/JeremyAnsel/JeremyAnsel.Media.WavefrontObj/636b700b450d7d3262bf9218a7cc67966be4ced8/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    {
 36813        public ObjMaterialColor()
 14        {
 36815            this.SpectralFactor = 1.0f;
 36816        }
 17
 18        public ObjMaterialColor(float x, float y, float z)
 4819            : this()
 20        {
 4821            this.Color = new ObjVector3(x, y, z);
 4822        }
 23
 24        public ObjMaterialColor(string? spectralFileName)
 2025            : this()
 26        {
 2027            this.SpectralFileName = spectralFileName;
 2028        }
 29
 30        public ObjMaterialColor(string? spectralFileName, float factor)
 2031            : this()
 32        {
 2033            this.SpectralFileName = spectralFileName;
 2034            this.SpectralFactor = factor;
 2035        }
 36
 53237        public ObjVector3 Color { get; set; }
 38
 25639        public bool UseXYZColorSpace { get; set; }
 40
 61641        public string? SpectralFileName { get; set; }
 42
 58843        public float SpectralFactor { get; set; }
 44
 45        public bool IsSpectral
 46        {
 47            get
 48            {
 36449                return !string.IsNullOrWhiteSpace(this.SpectralFileName);
 50            }
 51        }
 52
 53        public bool IsRGB
 54        {
 8055            get { return !this.IsSpectral && !this.UseXYZColorSpace; }
 56        }
 57
 58        public bool IsXYZ
 59        {
 8060            get { return !this.IsSpectral && this.UseXYZColorSpace; }
 61        }
 62
 63        private string ToDebuggerDisplayString()
 64        {
 1665            if (IsSpectral) return $"Spectral:{SpectralFileName} Factor:{SpectralFactor}";
 1266            if (UseXYZColorSpace) return $"X:{Color.X} Y:{Color.Y} Z:{Color.Z}";
 467            return $"R:{Color.X} G:{Color.Y} B:{Color.Z}";
 68        }
 69    }
 70}
 71